@@ -584,6 +584,7 @@ func (c *Cluster) generatePodTemplate(
584584 spiloContainer * v1.Container ,
585585 initContainers []v1.Container ,
586586 sidecarContainers []v1.Container ,
587+ sharePGSocketWithSidecars * bool ,
587588 tolerationsSpec * []v1.Toleration ,
588589 spiloRunAsUser * int64 ,
589590 spiloRunAsGroup * int64 ,
@@ -646,6 +647,10 @@ func (c *Cluster) generatePodTemplate(
646647 podSpec .PriorityClassName = priorityClassName
647648 }
648649
650+ if sharePGSocketWithSidecars != nil && * sharePGSocketWithSidecars {
651+ addVarRunVolume (& podSpec )
652+ }
653+
649654 if additionalSecretMount != "" {
650655 addSecretVolume (& podSpec , additionalSecretMount , additionalSecretMountPath )
651656 }
@@ -1256,6 +1261,7 @@ func (c *Cluster) generateStatefulSet(spec *acidv1.PostgresSpec) (*appsv1.Statef
12561261 spiloContainer ,
12571262 initContainers ,
12581263 sidecarContainers ,
1264+ c .OpConfig .SharePGSocketWithSidecars ,
12591265 & tolerationSpec ,
12601266 effectiveRunAsUser ,
12611267 effectiveRunAsGroup ,
@@ -1440,6 +1446,28 @@ func addShmVolume(podSpec *v1.PodSpec) {
14401446 podSpec .Volumes = volumes
14411447}
14421448
1449+ func addVarRunVolume (podSpec * v1.PodSpec ) {
1450+ volumes := append (podSpec .Volumes , v1.Volume {
1451+ Name : "postgresql-run" ,
1452+ VolumeSource : v1.VolumeSource {
1453+ EmptyDir : & v1.EmptyDirVolumeSource {
1454+ Medium : "Memory" ,
1455+ },
1456+ },
1457+ })
1458+
1459+ for i := range podSpec .Containers {
1460+ mounts := append (podSpec .Containers [i ].VolumeMounts ,
1461+ v1.VolumeMount {
1462+ Name : "postgresql-run" ,
1463+ MountPath : "/var/run/postgresql" ,
1464+ })
1465+ podSpec .Containers [i ].VolumeMounts = mounts
1466+ }
1467+
1468+ podSpec .Volumes = volumes
1469+ }
1470+
14431471func addSecretVolume (podSpec * v1.PodSpec , additionalSecretMount string , additionalSecretMountPath string ) {
14441472 volumes := append (podSpec .Volumes , v1.Volume {
14451473 Name : additionalSecretMount ,
@@ -2006,6 +2034,7 @@ func (c *Cluster) generateLogicalBackupJob() (*batchv1beta1.CronJob, error) {
20062034 logicalBackupContainer ,
20072035 []v1.Container {},
20082036 []v1.Container {},
2037+ util .False (),
20092038 & []v1.Toleration {},
20102039 nil ,
20112040 nil ,
0 commit comments