From 20b2fb46420afb5ff10e66b725da4c878b0bd98b Mon Sep 17 00:00:00 2001 From: Dmitrii Dolgov <9erthalion6@gmail.com> Date: Thu, 19 Mar 2020 11:28:39 +0100 Subject: [PATCH] Defaults for user/schema fix Verify the defaul values only if the schema doesn't override them. --- pkg/cluster/cluster.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/cluster/cluster.go b/pkg/cluster/cluster.go index 50cf5392d..dba67c142 100644 --- a/pkg/cluster/cluster.go +++ b/pkg/cluster/cluster.go @@ -1316,7 +1316,7 @@ func (c *Cluster) needSyncConnPoolDefaults( } for _, env := range poolContainer.Env { - if env.Name == "PGUSER" { + if spec.User == "" && env.Name == "PGUSER" { ref := env.ValueFrom.SecretKeyRef.LocalObjectReference if ref.Name != c.credentialSecretName(config.User) { @@ -1327,7 +1327,7 @@ func (c *Cluster) needSyncConnPoolDefaults( } } - if env.Name == "PGSCHEMA" && env.Value != config.Schema { + if spec.Schema == "" && env.Name == "PGSCHEMA" && env.Value != config.Schema { sync = true msg := fmt.Sprintf("Pool schema is different (having %s, required %s)", env.Value, config.Schema)