From cc2ca1d833d415d00354150d0123deadd63d515d Mon Sep 17 00:00:00 2001 From: Ben Blattberg Date: Thu, 19 Oct 2023 14:52:05 -0500 Subject: [PATCH] add username to pgadmin secret --- internal/controller/standalone_pgadmin/secret.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/internal/controller/standalone_pgadmin/secret.go b/internal/controller/standalone_pgadmin/secret.go index 34ddc318db..04b7979ac3 100644 --- a/internal/controller/standalone_pgadmin/secret.go +++ b/internal/controller/standalone_pgadmin/secret.go @@ -16,6 +16,7 @@ package standalone_pgadmin import ( "context" + "fmt" "github.com/pkg/errors" corev1 "k8s.io/api/core/v1" @@ -71,6 +72,12 @@ func secret(pgadmin *v1beta1.PGAdmin, existing *corev1.Secret) (*corev1.Secret, }) intent.Data = make(map[string][]byte) + intent.StringData = make(map[string]string) + + // The username format is hardcoded, + // but append the full username to the secret for visibility + intent.StringData["username"] = fmt.Sprintf("admin@%s.%s.svc", + pgadmin.Name, pgadmin.Namespace) // Copy existing password into the intent if existing.Data != nil {