@@ -677,6 +677,7 @@ func generateContainer(
677677 volumeMounts []v1.VolumeMount ,
678678 privilegedMode bool ,
679679 privilegeEscalationMode * bool ,
680+ readOnlyRootFilesystem * bool ,
680681 additionalPodCapabilities * v1.Capabilities ,
681682) * v1.Container {
682683 return & v1.Container {
@@ -703,7 +704,7 @@ func generateContainer(
703704 SecurityContext : & v1.SecurityContext {
704705 AllowPrivilegeEscalation : privilegeEscalationMode ,
705706 Privileged : & privilegedMode ,
706- ReadOnlyRootFilesystem : util . False () ,
707+ ReadOnlyRootFilesystem : readOnlyRootFilesystem ,
707708 Capabilities : additionalPodCapabilities ,
708709 },
709710 }
@@ -878,7 +879,7 @@ func (c *Cluster) generatePodTemplate(
878879 addEmptyDirVolume (& podSpec , "exporter-tmp" , "postgres-exporter" , "/tmp" )
879880 }
880881
881- if c .OpConfig .ReadOnlyRootFilesystem != nil {
882+ if c .OpConfig .ReadOnlyRootFilesystem != nil && * c . OpConfig . ReadOnlyRootFilesystem {
882883 addRunVolume (& podSpec , "postgres-run" , "postgres" , "/run" )
883884 addEmptyDirVolume (& podSpec , "postgres-tmp" , "postgres" , "/tmp" )
884885 }
@@ -998,6 +999,19 @@ func (c *Cluster) generateSpiloPodEnvVars(
998999 Name : "HUMAN_ROLE" ,
9991000 Value : c .OpConfig .PamRoleName ,
10001001 },
1002+ // NSS WRAPPER
1003+ {
1004+ Name : "LD_PRELOAD" ,
1005+ Value : "/usr/lib64/libnss_wrapper.so" ,
1006+ },
1007+ {
1008+ Name : "NSS_WRAPPER_PASSWD" ,
1009+ Value : "/tmp/nss_wrapper/passwd" ,
1010+ },
1011+ {
1012+ Name : "NSS_WRAPPER_GROUP" ,
1013+ Value : "/tmp/nss_wrapper/group" ,
1014+ },
10011015 }
10021016
10031017 if c .OpConfig .EnableSpiloWalPathCompat {
@@ -1484,6 +1498,7 @@ func (c *Cluster) generateStatefulSet(spec *cpov1.PostgresSpec) (*appsv1.Statefu
14841498 volumeMounts ,
14851499 c .OpConfig .Resources .SpiloPrivileged ,
14861500 c .OpConfig .Resources .SpiloAllowPrivilegeEscalation ,
1501+ c .OpConfig .Resources .ReadOnlyRootFilesystem ,
14871502 generateCapabilities (c .OpConfig .AdditionalPodCapabilities ),
14881503 )
14891504
@@ -1806,6 +1821,7 @@ func (c *Cluster) generateRepoHostStatefulSet(spec *cpov1.PostgresSpec) (*appsv1
18061821 volumeMounts ,
18071822 c .OpConfig .Resources .SpiloPrivileged ,
18081823 c .OpConfig .Resources .SpiloAllowPrivilegeEscalation ,
1824+ c .OpConfig .Resources .ReadOnlyRootFilesystem ,
18091825 generateCapabilities (c .OpConfig .AdditionalPodCapabilities ),
18101826 )
18111827
@@ -2818,6 +2834,7 @@ func (c *Cluster) generateLogicalBackupJob() (*batchv1.CronJob, error) {
28182834 []v1.VolumeMount {},
28192835 c .OpConfig .SpiloPrivileged , // use same value as for normal DB pods
28202836 c .OpConfig .SpiloAllowPrivilegeEscalation ,
2837+ util .False (),
28212838 nil ,
28222839 )
28232840
@@ -3344,6 +3361,7 @@ func (c *Cluster) generatePgbackrestJob(backup *cpov1.Pgbackrest, repo *cpov1.Re
33443361 []v1.VolumeMount {},
33453362 c .OpConfig .SpiloPrivileged , // use same value as for normal DB pods
33463363 c .OpConfig .SpiloAllowPrivilegeEscalation ,
3364+ c .OpConfig .Resources .ReadOnlyRootFilesystem ,
33473365 nil ,
33483366 )
33493367
0 commit comments