diff --git a/cmd/plugin-backend.go b/cmd/plugin-backend.go index 71c38e024..9392d6934 100644 --- a/cmd/plugin-backend.go +++ b/cmd/plugin-backend.go @@ -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 ( diff --git a/pkg/proxy/proxy.go b/pkg/monitoring/proxy.go similarity index 99% rename from pkg/proxy/proxy.go rename to pkg/monitoring/proxy.go index abdcfa0b3..4bc4aea96 100644 --- a/pkg/proxy/proxy.go +++ b/pkg/monitoring/proxy.go @@ -1,4 +1,4 @@ -package proxy +package monitoring import ( "context" diff --git a/pkg/proxy/sanitize.go b/pkg/monitoring/sanitize.go similarity index 97% rename from pkg/proxy/sanitize.go rename to pkg/monitoring/sanitize.go index d0262ceb0..e0e2f342a 100644 --- a/pkg/proxy/sanitize.go +++ b/pkg/monitoring/sanitize.go @@ -1,5 +1,5 @@ // source: https://github.com/grafana/tempo-operator/blob/4ec7e8b4cb102f52de1e101174f4490b1505eaa1/internal/manifests/naming/sanitize.go -package proxy +package monitoring import ( "regexp" diff --git a/pkg/plugin_handler.go b/pkg/server/plugin_handler.go similarity index 100% rename from pkg/plugin_handler.go rename to pkg/server/plugin_handler.go diff --git a/pkg/server.go b/pkg/server/server.go similarity index 93% rename from pkg/server.go rename to pkg/server/server.go index c3714b2c4..eb90ea1a0 100644 --- a/pkg/server.go +++ b/pkg/server/server.go @@ -21,7 +21,7 @@ import ( "k8s.io/client-go/rest" "k8s.io/client-go/tools/record" - "github.com/openshift/monitoring-plugin/pkg/proxy" + "github.com/openshift/monitoring-plugin/pkg/monitoring" ) var log = logrus.WithField("module", "server") @@ -114,7 +114,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) } @@ -223,8 +223,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 @@ -246,17 +246,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, @@ -364,7 +364,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{ diff --git a/pkg/server_test.go b/pkg/server/server_test.go similarity index 100% rename from pkg/server_test.go rename to pkg/server/server_test.go diff --git a/web/cypress/component/labels.cy.tsx b/web/cypress/component/labels.cy.tsx index fbe7009c1..4cf898f46 100644 --- a/web/cypress/component/labels.cy.tsx +++ b/web/cypress/component/labels.cy.tsx @@ -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', () => { diff --git a/web/cypress/component/mocks/AddToDashboardButton.tsx b/web/cypress/component/mocks/AddToDashboardButton.tsx index 6076b1691..a482858dc 100644 --- a/web/cypress/component/mocks/AddToDashboardButton.tsx +++ b/web/cypress/component/mocks/AddToDashboardButton.tsx @@ -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) => (