Skip to content

Commit

Permalink
applying suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
QuantumEnigmaa committed May 21, 2024
1 parent 6b94f5d commit 9302fa5
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 12 deletions.
3 changes: 1 addition & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions internal/controller/cluster_monitoring_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -127,9 +127,9 @@ func (r *ClusterMonitoringReconciler) reconcile(ctx context.Context, cluster *cl
return ctrl.Result{RequeueAfter: 5 * time.Minute}, errors.WithStack(err)
}

err = r.MimirService.ReconcileMimirConfig(ctx, r.ManagementCluster.Name)
err = r.MimirService.ConfigureMimir(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)
}

Expand All @@ -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)
}

Expand Down
7 changes: 1 addition & 6 deletions pkg/monitoring/mimir/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,7 @@ type MimirService struct {
client.Client
}

const (
ingressSecretName = "mimir-gateway-ingress"
ingressSecretNamespace = "mimir"
)

func (ms *MimirService) ReconcileMimirConfig(ctx context.Context, mc string) error {
func (ms *MimirService) ConfigureMimir(ctx context.Context, mc string) error {
logger := log.FromContext(ctx).WithValues("cluster", mc)
logger.Info("ensuring mimir config")

Expand Down
5 changes: 5 additions & 0 deletions pkg/monitoring/mimir/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 9302fa5

Please sign in to comment.