From 6653169c1388dfde6e422dc5f1fae2db70648172 Mon Sep 17 00:00:00 2001 From: QuantumEnigmaa Date: Tue, 21 May 2024 11:25:29 +0200 Subject: [PATCH] applying suggestions --- Dockerfile | 3 +-- internal/controller/cluster_monitoring_controller.go | 6 +++--- pkg/monitoring/mimir/service.go | 5 ----- pkg/monitoring/mimir/utils.go | 5 +++++ 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/Dockerfile b/Dockerfile index ff38b994..b104f48f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -23,8 +23,7 @@ COPY internal/controller/ internal/controller/ # by leaving it empty we can ensure that the container and binary shipped on it will have the same platform. RUN CGO_ENABLED=0 GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH} go build -a -o manager main.go -# Use distroless as minimal base image to package the manager binary -# Refer to https://github.com/GoogleContainerTools/distroless for more details +# Use alpine to have the smallest image possible while being able to use a required package for the code FROM alpine:3.19.1 RUN apk add --no-cache ca-certificates RUN apk add apache2-utils diff --git a/internal/controller/cluster_monitoring_controller.go b/internal/controller/cluster_monitoring_controller.go index ab8b9826..3e28c85b 100644 --- a/internal/controller/cluster_monitoring_controller.go +++ b/internal/controller/cluster_monitoring_controller.go @@ -45,7 +45,7 @@ type ClusterMonitoringReconciler struct { prometheusagent.PrometheusAgentService // HeartbeatRepository is the repository for managing heartbeats. heartbeat.HeartbeatRepository - // MimirService is the repository for managing mimir config. + // MimirService is the service for managing mimir configuration. mimir.MimirService // MonitoringEnabled defines whether monitoring is enabled at the installation level. MonitoringEnabled bool @@ -129,7 +129,7 @@ func (r *ClusterMonitoringReconciler) reconcile(ctx context.Context, cluster *cl err = r.MimirService.ReconcileMimirConfig(ctx, r.ManagementCluster.Name) if err != nil { - logger.Error(err, "failed to create or updatemimir config") + logger.Error(err, "failed to configure mimir") return ctrl.Result{RequeueAfter: 5 * time.Minute}, errors.WithStack(err) } @@ -156,7 +156,7 @@ func (r *ClusterMonitoringReconciler) reconcileDelete(ctx context.Context, clust err = r.MimirService.DeleteIngressSecret(ctx) if err != nil { - logger.Error(err, "failed to delete prometheus agent remote write config") + logger.Error(err, "failed to delete mimir ingress secret") return ctrl.Result{RequeueAfter: 5 * time.Minute}, errors.WithStack(err) } diff --git a/pkg/monitoring/mimir/service.go b/pkg/monitoring/mimir/service.go index c603afdd..ba6cad2a 100644 --- a/pkg/monitoring/mimir/service.go +++ b/pkg/monitoring/mimir/service.go @@ -19,11 +19,6 @@ type MimirService struct { client.Client } -const ( - ingressSecretName = "mimir-gateway-ingress" - ingressSecretNamespace = "mimir" -) - func (ms *MimirService) ReconcileMimirConfig(ctx context.Context, mc string) error { logger := log.FromContext(ctx).WithValues("cluster", mc) logger.Info("ensuring mimir config") diff --git a/pkg/monitoring/mimir/utils.go b/pkg/monitoring/mimir/utils.go index 09ccc804..bbb8f0e4 100644 --- a/pkg/monitoring/mimir/utils.go +++ b/pkg/monitoring/mimir/utils.go @@ -11,6 +11,11 @@ import ( "github.com/giantswarm/observability-operator/pkg/monitoring/prometheusagent" ) +const ( + ingressSecretName = "mimir-gateway-ingress" + ingressSecretNamespace = "mimir" +) + func GetMimirIngressPassword(ctx context.Context, mc string) (string, error) { cfg, err := config.GetConfig() if err != nil {