@@ -43,6 +43,21 @@ func sidecarContainerV2(pgc *v2.PerconaPGCluster) corev1.Container {
4343
4444 pmmSpec := pgc .Spec .PMM
4545
46+ volumeMounts := []corev1.VolumeMount {
47+ {
48+ Name : "cert-volume" ,
49+ MountPath : "/pgconf/tls" ,
50+ ReadOnly : true ,
51+ },
52+ }
53+ if pgc .CompareVersion ("2.7.0" ) >= 0 {
54+ volumeMounts = append (volumeMounts , corev1.VolumeMount {
55+ Name : postgres .DataVolumeMount ().Name ,
56+ MountPath : postgres .DataVolumeMount ().MountPath ,
57+ ReadOnly : true ,
58+ })
59+ }
60+
4661 container := corev1.Container {
4762 Name : "pmm-client" ,
4863 Image : pmmSpec .Image ,
@@ -75,18 +90,7 @@ func sidecarContainerV2(pgc *v2.PerconaPGCluster) corev1.Container {
7590 },
7691 },
7792 },
78- VolumeMounts : []corev1.VolumeMount {
79- {
80- Name : "cert-volume" ,
81- MountPath : "/pgconf/tls" ,
82- ReadOnly : true ,
83- },
84- {
85- Name : postgres .DataVolumeMount ().Name ,
86- MountPath : postgres .DataVolumeMount ().MountPath ,
87- ReadOnly : true ,
88- },
89- },
93+ VolumeMounts : volumeMounts ,
9094 Env : []corev1.EnvVar {
9195 {
9296 Name : "POD_NAME" ,
@@ -273,6 +277,20 @@ func sidecarContainerV3(pgc *v2.PerconaPGCluster) corev1.Container {
273277 if pgc .Spec .PMM .CustomClusterName != "" {
274278 clusterName = pgc .Spec .PMM .CustomClusterName
275279 }
280+ volumeMounts := []corev1.VolumeMount {
281+ {
282+ Name : "cert-volume" ,
283+ MountPath : "/pgconf/tls" ,
284+ ReadOnly : true ,
285+ },
286+ }
287+ if pgc .CompareVersion ("2.7.0" ) >= 0 {
288+ volumeMounts = append (volumeMounts , corev1.VolumeMount {
289+ Name : postgres .DataVolumeMount ().Name ,
290+ MountPath : postgres .DataVolumeMount ().MountPath ,
291+ ReadOnly : true ,
292+ })
293+ }
276294
277295 container := corev1.Container {
278296 Name : "pmm-client" ,
@@ -306,18 +324,7 @@ func sidecarContainerV3(pgc *v2.PerconaPGCluster) corev1.Container {
306324 },
307325 },
308326 },
309- VolumeMounts : []corev1.VolumeMount {
310- {
311- Name : "cert-volume" ,
312- MountPath : "/pgconf/tls" ,
313- ReadOnly : true ,
314- },
315- {
316- Name : postgres .DataVolumeMount ().Name ,
317- MountPath : postgres .DataVolumeMount ().MountPath ,
318- ReadOnly : true ,
319- },
320- },
327+ VolumeMounts : volumeMounts ,
321328 Env : []corev1.EnvVar {
322329 {
323330 Name : "POD_NAME" ,
0 commit comments