Skip to content

Commit 64215b0

Browse files
committed
Skip creation of OwnerReference if user is in a different namespace
Instead of doing a string compare on the username, check the actual namespace of the user to determine if an owner reference can be created.
1 parent ccb52c0 commit 64215b0

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pkg/cluster/k8sres.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1928,7 +1928,7 @@ func (c *Cluster) generateSingleUserSecret(pgUser spec.PgUser) *v1.Secret {
19281928

19291929
// if secret lives in another namespace we cannot set ownerReferences
19301930
var ownerReferences []metav1.OwnerReference
1931-
if c.Config.OpConfig.EnableCrossNamespaceSecret && strings.Contains(username, ".") {
1931+
if c.Config.OpConfig.EnableCrossNamespaceSecret && c.Postgresql.ObjectMeta.Namespace != pgUser.Namespace {
19321932
ownerReferences = nil
19331933
} else {
19341934
ownerReferences = c.ownerReferences()

0 commit comments

Comments
 (0)