From 1675d32c3fbfca2e2b0ca1436f685e4da9720ce5 Mon Sep 17 00:00:00 2001 From: Diogo Recharte Date: Wed, 7 Feb 2024 10:18:40 +0000 Subject: [PATCH] EVEREST-633 update namespaces env var name --- pkg/install/install.go | 2 +- pkg/kubernetes/kubernetes.go | 11 ++++++----- pkg/upgrade/upgrade.go | 2 +- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/pkg/install/install.go b/pkg/install/install.go index 00f9cb4f..e9b51c69 100644 --- a/pkg/install/install.go +++ b/pkg/install/install.go @@ -483,7 +483,7 @@ func (o *Install) installOperator(ctx context.Context, channel, operatorName, na params.SubscriptionConfig = &v1alpha1.SubscriptionConfig{ Env: []corev1.EnvVar{ { - Name: kubernetes.EverestWatchNamespacesEnvVar, + Name: kubernetes.EverestDBNamespacesEnvVar, Value: strings.Join(o.config.Namespaces, ","), }, }, diff --git a/pkg/kubernetes/kubernetes.go b/pkg/kubernetes/kubernetes.go index c1ab9740..2fcfc7cb 100644 --- a/pkg/kubernetes/kubernetes.go +++ b/pkg/kubernetes/kubernetes.go @@ -73,8 +73,9 @@ const ( // EverestOperatorDeploymentName is the name of the deployment for everest operator. EverestOperatorDeploymentName = "everest-operator-controller-manager" - // EverestWatchNamespacesEnvVar is the name of the environment variable. - EverestWatchNamespacesEnvVar = "WATCH_NAMESPACES" + // EverestDBNamespacesEnvVar is the name of the environment variable that + // contains the list of monitored namespaces. + EverestDBNamespacesEnvVar = "DB_NAMESPACES" pxcDeploymentName = "percona-xtradb-cluster-operator" psmdbDeploymentName = "percona-server-mongodb-operator" @@ -998,8 +999,8 @@ func (k *Kubernetes) DeleteEverest(ctx context.Context, namespace string) error return nil } -// GetWatchedNamespaces returns list of watched namespaces. -func (k *Kubernetes) GetWatchedNamespaces(ctx context.Context, namespace string) ([]string, error) { +// GetDBNamespaces returns a list of namespaces that are monitored by the Everest operator. +func (k *Kubernetes) GetDBNamespaces(ctx context.Context, namespace string) ([]string, error) { deployment, err := k.GetDeployment(ctx, EverestOperatorDeploymentName, namespace) if err != nil { return nil, err @@ -1010,7 +1011,7 @@ func (k *Kubernetes) GetWatchedNamespaces(ctx context.Context, namespace string) continue } for _, envVar := range container.Env { - if envVar.Name != EverestWatchNamespacesEnvVar { + if envVar.Name != EverestDBNamespacesEnvVar { continue } return strings.Split(envVar.Value, ","), nil diff --git a/pkg/upgrade/upgrade.go b/pkg/upgrade/upgrade.go index bbd9cebf..2c94f6f6 100644 --- a/pkg/upgrade/upgrade.go +++ b/pkg/upgrade/upgrade.go @@ -105,7 +105,7 @@ func (u *Upgrade) Run(ctx context.Context) error { func (u *Upgrade) runEverestWizard(ctx context.Context) error { if !u.config.SkipWizard { - namespaces, err := u.kubeClient.GetWatchedNamespaces(ctx, install.SystemNamespace) + namespaces, err := u.kubeClient.GetDBNamespaces(ctx, install.SystemNamespace) if err != nil { return err }