File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -549,10 +549,6 @@ func (c *Cluster) generateSpiloPodEnvVars(uid types.UID, spiloConfiguration stri
549549 Name : "KUBERNETES_ROLE_LABEL" ,
550550 Value : c .OpConfig .PodRoleLabel ,
551551 },
552- {
553- Name : "KUBERNETES_LABELS" ,
554- Value : labels .Set (c .OpConfig .ClusterLabels ).String (),
555- },
556552 {
557553 Name : "PGPASSWORD_SUPERUSER" ,
558554 ValueFrom : & v1.EnvVarSource {
@@ -588,6 +584,12 @@ func (c *Cluster) generateSpiloPodEnvVars(uid types.UID, spiloConfiguration stri
588584 Value : c .OpConfig .PamRoleName ,
589585 },
590586 }
587+ // Spilo expects cluster labels as JSON
588+ if clusterLabels , err := json .Marshal (labels .Set (c .OpConfig .ClusterLabels )); err != nil {
589+ envVars = append (envVars , v1.EnvVar {Name : "KUBERNETES_LABELS" , Value : labels .Set (c .OpConfig .ClusterLabels ).String ()})
590+ } else {
591+ envVars = append (envVars , v1.EnvVar {Name : "KUBERNETES_LABELS" , Value : string (clusterLabels )})
592+ }
591593 if spiloConfiguration != "" {
592594 envVars = append (envVars , v1.EnvVar {Name : "SPILO_CONFIGURATION" , Value : spiloConfiguration })
593595 }
You can’t perform that action at this time.
0 commit comments