@@ -566,7 +566,7 @@ func needSyncConnectionPoolerSpecs(oldSpec, newSpec *acidv1.ConnectionPooler, lo
566566
567567// Check if we need to synchronize connection pooler deployment due to new
568568// defaults, that are different from what we see in the DeploymentSpec
569- func needSyncConnectionPoolerDefaults (Config * Config , spec * acidv1.ConnectionPooler , deployment * appsv1.Deployment ) (sync bool , reasons []string ) {
569+ func ( c * Cluster ) needSyncConnectionPoolerDefaults (Config * Config , spec * acidv1.ConnectionPooler , deployment * appsv1.Deployment ) (sync bool , reasons []string ) {
570570
571571 reasons = []string {}
572572 sync = false
@@ -619,14 +619,14 @@ func needSyncConnectionPoolerDefaults(Config *Config, spec *acidv1.ConnectionPoo
619619 ref := env .ValueFrom .SecretKeyRef .LocalObjectReference
620620 secretName := Config .OpConfig .SecretNameTemplate .Format (
621621 "username" , strings .Replace (config .User , "_" , "-" , - 1 ),
622- "cluster" , deployment . ClusterName ,
622+ "cluster" , c . Name ,
623623 "tprkind" , acidv1 .PostgresCRDResourceKind ,
624624 "tprgroup" , acidzalando .GroupName )
625625
626626 if ref .Name != secretName {
627627 sync = true
628- msg := fmt .Sprintf ("pooler user is different (having %s, required %s)" ,
629- ref .Name , config . User )
628+ msg := fmt .Sprintf ("pooler user and secret are different (having %s, required %s)" ,
629+ ref .Name , secretName )
630630 reasons = append (reasons , msg )
631631 }
632632 }
@@ -747,7 +747,7 @@ func (c *Cluster) syncConnectionPooler(oldSpec, newSpec *acidv1.Postgresql, Look
747747 Deployment : nil ,
748748 Service : nil ,
749749 Name : c .connectionPoolerName (role ),
750- ClusterName : c .ClusterName ,
750+ ClusterName : c .Name ,
751751 Namespace : c .Namespace ,
752752 LookupFunction : false ,
753753 Role : role ,
@@ -878,7 +878,7 @@ func (c *Cluster) syncConnectionPoolerWorker(oldSpec, newSpec *acidv1.Postgresql
878878 specSync , specReason = needSyncConnectionPoolerSpecs (oldConnectionPooler , newConnectionPooler , c .logger )
879879 }
880880
881- defaultsSync , defaultsReason := needSyncConnectionPoolerDefaults (& c .Config , newConnectionPooler , deployment )
881+ defaultsSync , defaultsReason := c . needSyncConnectionPoolerDefaults (& c .Config , newConnectionPooler , deployment )
882882 reason := append (specReason , defaultsReason ... )
883883
884884 if specSync || defaultsSync {
0 commit comments