@@ -816,9 +816,6 @@ func (c *Cluster) generatePodTemplate(
816816 sidecarContainers []v1.Container ,
817817 sharePgSocketWithSidecars * bool ,
818818 tolerationsSpec * []v1.Toleration ,
819- spiloRunAsUser * int64 ,
820- spiloRunAsGroup * int64 ,
821- spiloFSGroup * int64 ,
822819 nodeAffinity * v1.Affinity ,
823820 schedulerName * string ,
824821 terminateGracePeriod int64 ,
@@ -837,18 +834,22 @@ func (c *Cluster) generatePodTemplate(
837834 terminateGracePeriodSeconds := terminateGracePeriod
838835 containers := []v1.Container {* spiloContainer }
839836 containers = append (containers , sidecarContainers ... )
840- securityContext := v1.PodSecurityContext {}
837+ securityContext := v1.PodSecurityContext {
838+ RunAsUser : c .OpConfig .Resources .SpiloRunAsUser ,
839+ RunAsGroup : c .OpConfig .Resources .SpiloRunAsGroup ,
840+ FSGroup : c .OpConfig .Resources .SpiloFSGroup ,
841+ }
841842
842- if spiloRunAsUser != nil {
843- securityContext .RunAsUser = spiloRunAsUser
843+ if c . Spec . SpiloRunAsUser != nil {
844+ securityContext .RunAsUser = c . Spec . SpiloRunAsUser
844845 }
845846
846- if spiloRunAsGroup != nil {
847- securityContext .RunAsGroup = spiloRunAsGroup
847+ if c . Spec . SpiloRunAsGroup != nil {
848+ securityContext .RunAsGroup = c . Spec . SpiloRunAsGroup
848849 }
849850
850- if spiloFSGroup != nil {
851- securityContext .FSGroup = spiloFSGroup
851+ if c . Spec . SpiloFSGroup != nil {
852+ securityContext .FSGroup = c . Spec . SpiloFSGroup
852853 }
853854
854855 podSpec := v1.PodSpec {
@@ -1343,22 +1344,6 @@ func (c *Cluster) generateStatefulSet(spec *acidv1.PostgresSpec) (*appsv1.Statef
13431344 // pickup the docker image for the spilo container
13441345 effectiveDockerImage := util .Coalesce (spec .DockerImage , c .OpConfig .DockerImage )
13451346
1346- // determine the User, Group and FSGroup for the spilo pod
1347- effectiveRunAsUser := c .OpConfig .Resources .SpiloRunAsUser
1348- if spec .SpiloRunAsUser != nil {
1349- effectiveRunAsUser = spec .SpiloRunAsUser
1350- }
1351-
1352- effectiveRunAsGroup := c .OpConfig .Resources .SpiloRunAsGroup
1353- if spec .SpiloRunAsGroup != nil {
1354- effectiveRunAsGroup = spec .SpiloRunAsGroup
1355- }
1356-
1357- effectiveFSGroup := c .OpConfig .Resources .SpiloFSGroup
1358- if spec .SpiloFSGroup != nil {
1359- effectiveFSGroup = spec .SpiloFSGroup
1360- }
1361-
13621347 volumeMounts := generateVolumeMounts (spec .Volume )
13631348
13641349 // configure TLS with a custom secret volume
@@ -1472,9 +1457,6 @@ func (c *Cluster) generateStatefulSet(spec *acidv1.PostgresSpec) (*appsv1.Statef
14721457 sidecarContainers ,
14731458 c .OpConfig .SharePgSocketWithSidecars ,
14741459 & tolerationSpec ,
1475- effectiveRunAsUser ,
1476- effectiveRunAsGroup ,
1477- effectiveFSGroup ,
14781460 c .nodeAffinity (c .OpConfig .NodeReadinessLabel , spec .NodeAffinity ),
14791461 spec .SchedulerName ,
14801462 int64 (c .OpConfig .PodTerminateGracePeriod .Seconds ()),
@@ -2319,9 +2301,6 @@ func (c *Cluster) generateLogicalBackupJob() (*batchv1.CronJob, error) {
23192301 []v1.Container {},
23202302 util .False (),
23212303 & tolerationsSpec ,
2322- nil ,
2323- nil ,
2324- nil ,
23252304 c .nodeAffinity (c .OpConfig .NodeReadinessLabel , nil ),
23262305 nil ,
23272306 int64 (c .OpConfig .PodTerminateGracePeriod .Seconds ()),
0 commit comments