From e24d2916b487544b416604dd03c1e806ed34ded1 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 | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/internal/controller/standalone_pgadmin/secret.go b/internal/controller/standalone_pgadmin/secret.go index 34ddc318db..8fc5ceeb65 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,11 @@ func secret(pgadmin *v1beta1.PGAdmin, existing *corev1.Secret) (*corev1.Secret, }) intent.Data = make(map[string][]byte) + intent.StringData = make(map[string]string) + + // The username is hardcoded, but append 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 {