From 5e2f90eeb92bb9a4325d46fd00662df15092e74d Mon Sep 17 00:00:00 2001 From: Erik Merkle Date: Mon, 4 Mar 2024 12:36:34 -0600 Subject: [PATCH] return "default" if operator namespace not found in environment --- controllers/k8ssandra/medusa_reconciler.go | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/controllers/k8ssandra/medusa_reconciler.go b/controllers/k8ssandra/medusa_reconciler.go index fef24751e..6894a0526 100644 --- a/controllers/k8ssandra/medusa_reconciler.go +++ b/controllers/k8ssandra/medusa_reconciler.go @@ -135,11 +135,7 @@ func (r *K8ssandraClusterReconciler) reconcileMedusa( return result.RequeueSoon(r.DefaultDelay) } // Create a cron job to purge Medusa backups - operatorNamespace, err := r.getOperatorNamespace() - if err != nil { - logger.Info("Failed to get Operator namespace", "error", err) - return result.Error(err) - } + operatorNamespace := r.getOperatorNamespace() purgeCronJob, err := medusa.PurgeCronJob(dcConfig, kc.SanitizedName(), operatorNamespace, logger) if err != nil { logger.Info("Failed to create Medusa purge backups cronjob", "error", err) @@ -331,10 +327,10 @@ func (r *K8ssandraClusterReconciler) reconcileBucketSecrets( return nil } -func (r *K8ssandraClusterReconciler) getOperatorNamespace() (string, error) { +func (r *K8ssandraClusterReconciler) getOperatorNamespace() string { operatorNamespace, found := os.LookupEnv(operatorNamespaceEnvVar) if !found { - return "", fmt.Errorf("environment variable %s not set", operatorNamespaceEnvVar) + return "default" } - return string(operatorNamespace), nil + return operatorNamespace }