From 6d858519b907de579e5a6fa03a7b9161b52a5bbb Mon Sep 17 00:00:00 2001 From: cmoulliard Date: Fri, 8 Nov 2024 14:51:22 +0100 Subject: [PATCH] Pass the proper object containing devMode to the function populating a new password. #441 Signed-off-by: cmoulliard --- pkg/build/build.go | 3 ++- pkg/controllers/localbuild/gitea.go | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/pkg/build/build.go b/pkg/build/build.go index 79d09aee..f30a82db 100644 --- a/pkg/build/build.go +++ b/pkg/build/build.go @@ -279,5 +279,6 @@ func isBuildCustomizationSpecEqual(s1, s2 v1alpha1.BuildCustomizationSpec) bool s1.IngressHost == s2.IngressHost && s1.Port == s2.Port && s1.UsePathRouting == s2.UsePathRouting && - s1.SelfSignedCert == s2.SelfSignedCert + s1.SelfSignedCert == s2.SelfSignedCert && + s1.DevMode == s2.DevMode } diff --git a/pkg/controllers/localbuild/gitea.go b/pkg/controllers/localbuild/gitea.go index 7901a419..0afbd19a 100644 --- a/pkg/controllers/localbuild/gitea.go +++ b/pkg/controllers/localbuild/gitea.go @@ -58,7 +58,7 @@ func giteaAdminSecretObject() corev1.Secret { } func newGiteaAdminSecret(devMode bool) (corev1.Secret, error) { - // Reuse the same password when dev mode is enabled + // Use a default password when dev mode is enabled to avoid to recreate a new one each time pass := giteaDevModePassword if !devMode { var err error @@ -100,7 +100,7 @@ func (r *LocalbuildReconciler) ReconcileGitea(ctx context.Context, req ctrl.Requ if err != nil { if k8serrors.IsNotFound(err) { - giteaCreds, err := newGiteaAdminSecret(resource.Spec.BuildCustomization.DevMode) + giteaCreds, err := newGiteaAdminSecret(r.Config.DevMode) if err != nil { return ctrl.Result{}, fmt.Errorf("generating gitea admin secret: %w", err) }