Skip creation of OwnerReference if user is in a different namespace (#2912)
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.
This commit is contained in:
parent
fa4bc21538
commit
ad7e590916
|
|
@ -1928,7 +1928,7 @@ func (c *Cluster) generateSingleUserSecret(pgUser spec.PgUser) *v1.Secret {
|
||||||
|
|
||||||
// if secret lives in another namespace we cannot set ownerReferences
|
// if secret lives in another namespace we cannot set ownerReferences
|
||||||
var ownerReferences []metav1.OwnerReference
|
var ownerReferences []metav1.OwnerReference
|
||||||
if c.Config.OpConfig.EnableCrossNamespaceSecret && strings.Contains(username, ".") {
|
if c.Config.OpConfig.EnableCrossNamespaceSecret && c.Postgresql.ObjectMeta.Namespace != pgUser.Namespace {
|
||||||
ownerReferences = nil
|
ownerReferences = nil
|
||||||
} else {
|
} else {
|
||||||
ownerReferences = c.ownerReferences()
|
ownerReferences = c.ownerReferences()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue