From 8e4fe91d940ca7b7ad348f00807f9aa0dad61ac8 Mon Sep 17 00:00:00 2001 From: QuantumEnigmaa Date: Mon, 20 May 2024 12:11:52 +0200 Subject: [PATCH] use capital letters for function names --- pkg/monitoring/mimir/ingress/ingress.go | 2 +- pkg/monitoring/mimir/service.go | 8 ++++---- pkg/monitoring/mimir/utils.go | 4 ++-- pkg/monitoring/prometheusagent/service.go | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/pkg/monitoring/mimir/ingress/ingress.go b/pkg/monitoring/mimir/ingress/ingress.go index 07c52e17..d19129e3 100644 --- a/pkg/monitoring/mimir/ingress/ingress.go +++ b/pkg/monitoring/mimir/ingress/ingress.go @@ -10,7 +10,7 @@ import ( "github.com/giantswarm/observability-operator/pkg/monitoring/mimir" ) -func (ms *MimirService) buildIngressSecret(username string, password string) (*corev1.Secret, error) { +func (ms *MimirService) BuildIngressSecret(username string, password string) (*corev1.Secret, error) { // Uses htpasswd to generate the password hash. secretData, err := exec.Command("htpasswd", "-bn", username, password).Output() if err != nil { diff --git a/pkg/monitoring/mimir/service.go b/pkg/monitoring/mimir/service.go index 1a261c66..894ed98e 100644 --- a/pkg/monitoring/mimir/service.go +++ b/pkg/monitoring/mimir/service.go @@ -21,7 +21,7 @@ func (ms *MimirService) ReconcileMimirConfig(ctx context.Context, mc string) err logger := log.FromContext(ctx).WithValues("cluster", mc) logger.Info("ensuring mimir config") - err := ms.createOrUpdateIngressSecret(ctx, mc, logger) + err := ms.CreateOrUpdateIngressSecret(ctx, mc, logger) if err != nil { logger.Error(err, "failed to create or update mimir config") return errors.WithStack(err) @@ -32,7 +32,7 @@ func (ms *MimirService) ReconcileMimirConfig(ctx context.Context, mc string) err return nil } -func (ms *MimirService) createOrUpdateIngressSecret(ctx context.Context, mc string, logger logr.Logger) error { +func (ms *MimirService) CreateOrUpdateIngressSecret(ctx context.Context, mc string, logger logr.Logger) error { objectKey := client.ObjectKey{ Name: "mimir-gateway-ingress", Namespace: "mimir", @@ -44,12 +44,12 @@ func (ms *MimirService) createOrUpdateIngressSecret(ctx context.Context, mc stri // CREATE SECRET logger.Info("building ingress secret") - password, err := getMimirIngressPassword(ctx, mc) + password, err := GetMimirIngressPassword(ctx, mc) if err != nil { return errors.WithStack(err) } - secret, err := ms.buildIngressSecret(mc, password) + secret, err := ms.BuildIngressSecret(mc, password) if err != nil { return errors.WithStack(err) } diff --git a/pkg/monitoring/mimir/utils.go b/pkg/monitoring/mimir/utils.go index e49ed1ac..cc48b85d 100644 --- a/pkg/monitoring/mimir/utils.go +++ b/pkg/monitoring/mimir/utils.go @@ -13,7 +13,7 @@ import ( ) // Checks whether Mimir is enabled in the cluster by listing the pods in the Mimir namespace. -func isMimirEnabled(ctx context.Context) bool { +func IsMimirEnabled(ctx context.Context) bool { cfg, err := config.GetConfig() if err != nil { log.Fatal(err) @@ -35,7 +35,7 @@ func isMimirEnabled(ctx context.Context) bool { return len(mimirPods.Items) > 0 } -func getMimirIngressPassword(ctx context.Context, mc string) (string, error) { +func GetMimirIngressPassword(ctx context.Context, mc string) (string, error) { cfg, err := config.GetConfig() if err != nil { return "", err diff --git a/pkg/monitoring/prometheusagent/service.go b/pkg/monitoring/prometheusagent/service.go index 4d789562..d76178b5 100644 --- a/pkg/monitoring/prometheusagent/service.go +++ b/pkg/monitoring/prometheusagent/service.go @@ -103,7 +103,7 @@ func (pas PrometheusAgentService) createOrUpdateSecret(ctx context.Context, Name: getPrometheusAgentRemoteWriteSecretName(cluster), Namespace: cluster.GetNamespace(), } - mimirEnabled := isMimirEnabled(ctx) + mimirEnabled := IsMimirEnabled(ctx) current := &corev1.Secret{} // Get the current secret if it exists.