Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmd/plugin-backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (

"github.com/sirupsen/logrus"

server "github.com/openshift/monitoring-plugin/pkg"
server "github.com/openshift/monitoring-plugin/pkg/server"
)

var (
Expand Down
2 changes: 1 addition & 1 deletion pkg/proxy/proxy.go → pkg/monitoring/proxy.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package proxy
package monitoring

import (
"context"
Expand Down
2 changes: 1 addition & 1 deletion pkg/proxy/sanitize.go → pkg/monitoring/sanitize.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// source: https://github.com/grafana/tempo-operator/blob/4ec7e8b4cb102f52de1e101174f4490b1505eaa1/internal/manifests/naming/sanitize.go
package proxy
package monitoring

import (
"regexp"
Expand Down
File renamed without changes.
19 changes: 9 additions & 10 deletions pkg/server.go → pkg/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (

"github.com/gorilla/handlers"
"github.com/gorilla/mux"
"github.com/openshift/monitoring-plugin/pkg/monitoring"
"github.com/sirupsen/logrus"
"gopkg.in/yaml.v2"
v1 "k8s.io/api/core/v1"
Expand All @@ -20,8 +21,6 @@ import (
"k8s.io/client-go/kubernetes/scheme"
"k8s.io/client-go/rest"
"k8s.io/client-go/tools/record"

"github.com/openshift/monitoring-plugin/pkg/proxy"
)

var log = logrus.WithField("module", "server")
Expand Down Expand Up @@ -114,7 +113,7 @@ func createHTTPServer(ctx context.Context, cfg *Config) (*http.Server, error) {
return nil, fmt.Errorf("alertmanager and thanos-querier must be set to use the 'acm-alerting' feature flag")
}

if cfg.Port == int(proxy.AlertmanagerPort) || cfg.Port == int(proxy.ThanosQuerierPort) {
if cfg.Port == int(monitoring.AlertmanagerPort) || cfg.Port == int(monitoring.ThanosQuerierPort) {
return nil, fmt.Errorf("cannot set default port to reserved port %d", cfg.Port)
}

Expand Down Expand Up @@ -223,8 +222,8 @@ func createHTTPServer(ctx context.Context, cfg *Config) (*http.Server, error) {

// Start proxy servers if in ACM mode
if tlsEnabled && acmMode {
startProxy(cfg, k8sclient, tlsConfig, timeout, proxy.AlertManagerKind, proxy.AlertmanagerPort)
startProxy(cfg, k8sclient, tlsConfig, timeout, proxy.ThanosQuerierKind, proxy.ThanosQuerierPort)
startProxy(cfg, k8sclient, tlsConfig, timeout, monitoring.AlertManagerKind, monitoring.AlertmanagerPort)
startProxy(cfg, k8sclient, tlsConfig, timeout, monitoring.ThanosQuerierKind, monitoring.ThanosQuerierPort)
}

return httpServer, nil
Expand All @@ -246,17 +245,17 @@ func setupRoutes(cfg *Config) (*mux.Router, *PluginConfig) {
return router, pluginConfig
}

func setupProxyRoutes(cfg *Config, k8sclient *dynamic.DynamicClient, kind proxy.KindType) *mux.Router {
func setupProxyRoutes(cfg *Config, k8sclient *dynamic.DynamicClient, kind monitoring.KindType) *mux.Router {
router := mux.NewRouter()
var proxyUrl string
switch kind {
case proxy.AlertManagerKind:
case monitoring.AlertManagerKind:
proxyUrl = cfg.AlertmanagerUrl
case proxy.ThanosQuerierKind:
case monitoring.ThanosQuerierKind:
proxyUrl = cfg.ThanosQuerierUrl
}

router.PathPrefix("/").Handler(proxy.NewProxyHandler(
router.PathPrefix("/").Handler(monitoring.NewProxyHandler(
k8sclient,
cfg.CertFile,
kind,
Expand Down Expand Up @@ -364,7 +363,7 @@ func configHandler(cfg *Config) (http.HandlerFunc, *PluginConfig) {
}), &pluginConfig
}

func startProxy(cfg *Config, k8sclient *dynamic.DynamicClient, tlsConfig *tls.Config, timeout time.Duration, kind proxy.KindType, port proxy.ProxyPort) {
func startProxy(cfg *Config, k8sclient *dynamic.DynamicClient, tlsConfig *tls.Config, timeout time.Duration, kind monitoring.KindType, port monitoring.ProxyPort) {
proxyRouter := setupProxyRoutes(cfg, k8sclient, kind)
proxyRouter.Use(corsHeaderMiddleware())
proxyServer := &http.Server{
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion web/cypress/component/labels.cy.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Labels } from '../../src/components/labels';
import { Labels } from '../../src/shared/components/labels';

describe('Labels', () => {
it('renders "No labels" when labels is empty', () => {
Expand Down
2 changes: 1 addition & 1 deletion web/cypress/component/mocks/AddToDashboardButton.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AddToDashboardButtonProps } from '../../../src/components/ols-tool-ui/helpers/AddToDashboardButton';
import { AddToDashboardButtonProps } from '../../../src/features/perses-dashboards/ols-tool-ui/helpers/AddToDashboardButton';

export const AddToDashboardButton = ({ query, name, description }: AddToDashboardButtonProps) => (
<button
Expand Down
2 changes: 1 addition & 1 deletion web/cypress/component/mocks/OlsToolUIPersesWrapper.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { OlsToolUIPersesWrapperProps } from '../../../src/components/ols-tool-ui/helpers/OlsToolUIPersesWrapper';
import { OlsToolUIPersesWrapperProps } from '../../../src/features/perses-dashboards/ols-tool-ui/helpers/OlsToolUIPersesWrapper';

export const OlsToolUIPersesWrapper = ({
children,
Expand Down
2 changes: 1 addition & 1 deletion web/cypress/component/ols-tool-ui/ShowTimeseries.cy.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ShowTimeseries } from '../../../src/components/ols-tool-ui/ShowTimeseries';
import { ShowTimeseries } from '../../../src/features/perses-dashboards/ols-tool-ui/ShowTimeseries';

describe('ShowTimeseries', () => {
const tool = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { commonPages } from '../../views/common';
import { listPersesDashboardsPage } from '../../views/perses-dashboards-list-dashboards';
import { persesCreateDashboardsPage } from '../../views/perses-dashboards-create-dashboard';
import { persesDashboardsPage } from '../../views/perses-dashboards';
import { persesMUIDataTestIDs } from '../../../src/components/data-test';
import { persesMUIDataTestIDs } from '../../../src/shared/constants/data-test';

const PROMPT = 'visualize CPU consumption in the openshift-monitoring namespace in last 2 hours';

Expand Down
2 changes: 1 addition & 1 deletion web/cypress/support/commands/dashboards-commands.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import 'cypress-wait-until';
import { DataTestIDs, LegacyTestIDs } from '../../../src/components/data-test';
import { DataTestIDs, LegacyTestIDs } from '../../../src/shared/constants/data-test';
import { waitForPodsReady, waitForResourceCondition } from './wait-utils';

export {};
Expand Down
2 changes: 1 addition & 1 deletion web/cypress/support/commands/perses-commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ export {};

import { nav } from '../../views/nav';
import { listPersesDashboardsPage } from '../../views/perses-dashboards-list-dashboards';
import { listPersesDashboardsOUIAIDs } from '../../../src/components/data-test';
import { listPersesDashboardsOUIAIDs } from '../../../src/shared/constants/data-test';

// Display name prefixes/exact matches for test-created PersesDashboards to delete before
// Perses tests.
Expand Down
2 changes: 1 addition & 1 deletion web/cypress/support/commands/utility-commands.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Classes, DataTestIDs, LegacyTestIDs } from '../../../src/components/data-test';
import { Classes, DataTestIDs, LegacyTestIDs } from '../../../src/shared/constants/data-test';
export {};

declare global {
Expand Down
2 changes: 1 addition & 1 deletion web/cypress/support/monitoring/01.reg_alerts.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
SilenceComment,
WatchdogAlert,
} from '../../fixtures/monitoring/constants';
import { FilterOUIAIDs } from '../../../src/components/data-test';
import { FilterOUIAIDs } from '../../../src/shared/constants/data-test';

export interface PerspectiveConfig {
name: string;
Expand Down
2 changes: 1 addition & 1 deletion web/cypress/support/monitoring/02.reg_metrics_1.cy.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { metricsPage } from '../../views/metrics';
import { Classes, DataTestIDs } from '../../../src/components/data-test';
import { Classes, DataTestIDs } from '../../../src/shared/constants/data-test';
import {
GraphTimespan,
MetricsPagePredefinedQueries,
Expand Down
2 changes: 1 addition & 1 deletion web/cypress/support/monitoring/02.reg_metrics_2.cy.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { metricsPage } from '../../views/metrics';
import { Classes, DataTestIDs } from '../../../src/components/data-test';
import { Classes, DataTestIDs } from '../../../src/shared/constants/data-test';
import {
MetricGraphEmptyState,
MetricsPagePredefinedQueries,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
Classes,
LegacyDashboardPageTestIDs,
DataTestIDs,
} from '../../../src/components/data-test';
} from '../../../src/shared/constants/data-test';
import { metricsPage } from '../../views/metrics';
import { alertingRuleDetailsPage } from '../../views/alerting-rule-details-page';
import { alerts } from '../../fixtures/monitoring/alert';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
SilenceComment,
WatchdogAlert,
} from '../../fixtures/monitoring/constants';
import { FilterOUIAIDs } from '../../../src/components/data-test';
import { FilterOUIAIDs } from '../../../src/shared/constants/data-test';

export interface PerspectiveConfig {
name: string;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { metricsPage } from '../../views/metrics';
import { Classes, DataTestIDs } from '../../../src/components/data-test';
import { Classes, DataTestIDs } from '../../../src/shared/constants/data-test';
import {
MetricsPageUnits,
GraphTimespan,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { metricsPage } from '../../views/metrics';
import { Classes, DataTestIDs } from '../../../src/components/data-test';
import { Classes, DataTestIDs } from '../../../src/shared/constants/data-test';
import {
MetricsPagePredefinedQueries,
MetricsPageQueryInput,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
Classes,
LegacyDashboardPageTestIDs,
DataTestIDs,
} from '../../../src/components/data-test';
} from '../../../src/shared/constants/data-test';
import { metricsPage } from '../../views/metrics';
import { alertingRuleDetailsPage } from '../../views/alerting-rule-details-page';
import { alerts } from '../../fixtures/monitoring/alert';
Expand Down
2 changes: 1 addition & 1 deletion web/cypress/support/perses/00.coo_bvt_perses_admin.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
persesDashboardsEmptyDashboard,
} from '../../fixtures/perses/constants';
import { persesDashboardsPage } from '../../views/perses-dashboards';
import { persesMUIDataTestIDs } from '../../../src/components/data-test';
import { persesMUIDataTestIDs } from '../../../src/shared/constants/data-test';
import { listPersesDashboardsPage } from '../../views/perses-dashboards-list-dashboards';
import { persesDashboardsPanelGroup } from '../../views/perses-dashboards-panelgroup';
import { persesDashboardsPanel } from '../../views/perses-dashboards-panel';
Expand Down
10 changes: 5 additions & 5 deletions web/cypress/support/perses/02.coo_edit_perses_admin.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {
editPersesDashboardsAddVariable,
persesMUIDataTestIDs,
IDs,
} from '../../../src/components/data-test';
} from '../../../src/shared/constants/data-test';
import {
persesDashboardsDashboardDropdownCOO,
persesDashboardsDashboardDropdownPersesDev,
Expand Down Expand Up @@ -319,7 +319,7 @@ export function testCOOEditPerses(perspective: PerspectiveConfig) {
},
);

/**TODO: https://issues.redhat.com/browse/OU-1054 is targeted for COO1.5.0,
/**TODO: https://issues.redhat.com/browse/OU-1054 is targeted for COO1.5.0,
* so, commenting all Datasources related scenarios
it(`6.${perspective.name} perspective - Edit Toolbar - Edit Datasources
- Add and Delete Prometheus Datasource`, () => {
Expand Down Expand Up @@ -372,7 +372,7 @@ export function testCOOEditPerses(perspective: PerspectiveConfig) {
// persesDashboardsPage.clickEditActionButton('Save');
});

it(`7.${perspective.name} perspective - Edit Toolbar - Edit Datasources -
it(`7.${perspective.name} perspective - Edit Toolbar - Edit Datasources -
- Edit Prometheus Datasource`, () => {
cy.log(`7.1. use sidebar nav to go to Observe > Dashboards (Perses)`);
commonPages.titleShouldHaveText('Dashboards');
Expand Down Expand Up @@ -410,11 +410,11 @@ export function testCOOEditPerses(perspective: PerspectiveConfig) {

});

// it(`8.${perspective.name} perspective - Edit Toolbar -
// it(`8.${perspective.name} perspective - Edit Toolbar -
// Edit Datasources - Add Tempo Datasource`, () => {
// });

it(`8.${perspective.name} perspective - Edit Toolbar -
it(`8.${perspective.name} perspective - Edit Toolbar -
- Edit Datasources - Required field validation`, () => {
cy.log(`8.1. use sidebar nav to go to Observe > Dashboards (Perses)`);
commonPages.titleShouldHaveText('Dashboards');
Expand Down
2 changes: 1 addition & 1 deletion web/cypress/support/perses/99.coo_rbac_perses_user1.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
} from '../../fixtures/perses/constants';
import { persesDashboardsEditVariables } from '../../views/perses-dashboards-edit-variables';
import { persesDashboardsPanelGroup } from '../../views/perses-dashboards-panelgroup';
import { persesAriaLabels } from '../../../src/components/data-test';
import { persesAriaLabels } from '../../../src/shared/constants/data-test';
import { persesDashboardsPanel } from '../../views/perses-dashboards-panel';
import { persesDashboardsAddListPanelType } from '../../fixtures/perses/constants';
import { persesImportDashboardsPage } from '../../views/perses-dashboards-import-dashboard';
Expand Down
2 changes: 1 addition & 1 deletion web/cypress/support/perses/99.coo_rbac_perses_user3.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { persesDashboardsPanel } from '../../views/perses-dashboards-panel';
import { persesDashboardsAddListPanelType } from '../../fixtures/perses/constants';
import { persesImportDashboardsPage } from '../../views/perses-dashboards-import-dashboard';
import { nav } from '../../views/nav';
import { persesAriaLabels } from '../../../src/components/data-test';
import { persesAriaLabels } from '../../../src/shared/constants/data-test';

export interface PerspectiveConfig {
name: string;
Expand Down
2 changes: 1 addition & 1 deletion web/cypress/views/alerting-rule-details-page.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { commonPages } from './common';
import { detailsPage } from './details-page';
import { DataTestIDs } from '../../src/components/data-test';
import { DataTestIDs } from '../../src/shared/constants/data-test';

export const alertingRuleDetailsPage = {
assertAlertingRuleDetailsPage: (title: string) => {
Expand Down
2 changes: 1 addition & 1 deletion web/cypress/views/alerting-rule-list-page.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DataTestIDs, Classes, FilterOUIAIDs } from '../../src/components/data-test';
import { DataTestIDs, Classes, FilterOUIAIDs } from '../../src/shared/constants/data-test';
import { Source } from '../fixtures/monitoring/constants';
import { listPage } from './list-page';

Expand Down
2 changes: 1 addition & 1 deletion web/cypress/views/common.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { detailsPage } from './details-page';
import { DataTestIDs } from '../../src/components/data-test';
import { DataTestIDs } from '../../src/shared/constants/data-test';

export const commonPages = {
projectDropdownShouldNotExist: () =>
Expand Down
2 changes: 1 addition & 1 deletion web/cypress/views/details-page.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { commonPages } from './common';
import { DataTestIDs, Classes } from '../../src/components/data-test';
import { DataTestIDs, Classes } from '../../src/shared/constants/data-test';

export const detailsPage = {
sectionHeaderShouldExist: (sectionHeading: string) => {
Expand Down
2 changes: 1 addition & 1 deletion web/cypress/views/incidents-page.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { nav } from './nav';
import { DataTestIDs } from '../../src/components/data-test';
import { DataTestIDs } from '../../src/shared/constants/data-test';

// Hard timeout safety net for findIncidentWithAlert retry loops.
// Prevents infinite loops if cy.waitUntil's timeout mechanism fails.
Expand Down
6 changes: 5 additions & 1 deletion web/cypress/views/legacy-dashboards.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import { commonPages } from './common';
import { LegacyDashboardPageTestIDs, DataTestIDs, Classes } from '../../src/components/data-test';
import {
LegacyDashboardPageTestIDs,
DataTestIDs,
Classes,
} from '../../src/shared/constants/data-test';
import {
MonitoringPageTitles,
LegacyDashboardsTimeRange,
Expand Down
7 changes: 6 additions & 1 deletion web/cypress/views/list-page.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
import { DataTestIDs, Classes, LegacyTestIDs, FilterOUIAIDs } from '../../src/components/data-test';
import {
DataTestIDs,
Classes,
LegacyTestIDs,
FilterOUIAIDs,
} from '../../src/shared/constants/data-test';

const escapeRegExp = (s: string) => s.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');

Expand Down
2 changes: 1 addition & 1 deletion web/cypress/views/metrics.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { commonPages } from './common';
import { DataTestIDs, Classes, IDs } from '../../src/components/data-test';
import { DataTestIDs, Classes, IDs } from '../../src/shared/constants/data-test';
import {
MetricsPageUnits,
MonitoringRefreshInterval,
Expand Down
2 changes: 1 addition & 1 deletion web/cypress/views/nav.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Classes } from '../../src/components/data-test';
import { Classes } from '../../src/shared/constants/data-test';
export const nav = {
sidenav: {
clickNavLink: (path: string[]) => {
Expand Down
2 changes: 1 addition & 1 deletion web/cypress/views/perses-dashboards-create-dashboard.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Classes, IDs, persesAriaLabels } from '../../src/components/data-test';
import { Classes, IDs, persesAriaLabels } from '../../src/shared/constants/data-test';
import { persesCreateDashboard, persesDashboardsModalTitles } from '../fixtures/perses/constants';

export const persesCreateDashboardsPage = {
Expand Down
2 changes: 1 addition & 1 deletion web/cypress/views/perses-dashboards-edit-datasources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
persesMUIDataTestIDs,
editPersesDashboardsAddDatasource,
IDs,
} from '../../src/components/data-test';
} from '../../src/shared/constants/data-test';
import {
persesDashboardsModalTitles,
persesDashboardsRequiredFields,
Expand Down
2 changes: 1 addition & 1 deletion web/cypress/views/perses-dashboards-edit-variables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
persesMUIDataTestIDs,
IDs,
editPersesDashboardsAddVariable,
} from '../../src/components/data-test';
} from '../../src/shared/constants/data-test';
import {
persesDashboardsModalTitles,
persesDashboardsAddListVariableSource,
Expand Down
2 changes: 1 addition & 1 deletion web/cypress/views/perses-dashboards-import-dashboard.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Classes, IDs, persesAriaLabels } from '../../src/components/data-test';
import { Classes, IDs, persesAriaLabels } from '../../src/shared/constants/data-test';
import {
persesDashboardsImportDashboard,
persesDashboardsModalTitles,
Expand Down
2 changes: 1 addition & 1 deletion web/cypress/views/perses-dashboards-list-dashboards.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
IDs,
persesAriaLabels,
LegacyTestIDs,
} from '../../src/components/data-test';
} from '../../src/shared/constants/data-test';
import {
listPersesDashboardsEmptyState,
listPersesDashboardsNoDashboardsFoundState,
Expand Down
2 changes: 1 addition & 1 deletion web/cypress/views/perses-dashboards-panel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
persesAriaLabels,
IDs,
editPersesDashboardsAddPanel,
} from '../../src/components/data-test';
} from '../../src/shared/constants/data-test';
import {
persesDashboardsModalTitles,
persesDashboardsAddPanelAddQueryType,
Expand Down
Loading