From 76c7f2ba3a830a1d7dc888a1aec140197f93c488 Mon Sep 17 00:00:00 2001 From: Michal Kralik Date: Wed, 27 Nov 2024 16:25:30 +0100 Subject: [PATCH] EVEREST-1700: create secret if it does not exist - PXC properly fills the missing fields --- controllers/providers/pxc/applier.go | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/controllers/providers/pxc/applier.go b/controllers/providers/pxc/applier.go index caeb412a..642cd2ce 100644 --- a/controllers/providers/pxc/applier.go +++ b/controllers/providers/pxc/applier.go @@ -24,7 +24,6 @@ import ( "github.com/AlekSi/pointer" pxcv1 "github.com/percona/percona-xtradb-cluster-operator/pkg/apis/pxc/v1" corev1 "k8s.io/api/core/v1" - k8serrors "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/api/resource" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" @@ -480,14 +479,10 @@ func (p *applier) applyPMMCfg(monitoring *everestv1alpha1.MonitoringConfig) erro return err } - err = common.UpdateSecretData(p.ctx, p.C, p.DB, pxc.Spec.SecretsName, map[string][]byte{ + err = common.CreateOrUpdateSecretData(p.ctx, p.C, p.DB, pxc.Spec.SecretsName, map[string][]byte{ "pmmserverkey": []byte(apiKey), }) - // If the secret does not exist, we need to wait for the PXC - // operator to create it. If the secret already exists when the - // cluster is initialized the PXC operator doesn't generate the - // missing fields. - if err != nil && !k8serrors.IsNotFound(err) { + if err != nil { return err } return nil