Skip to content

Commit be4b072

Browse files
committed
Fix previous fix of clone volume generation
1 parent 5c9432a commit be4b072

File tree

1 file changed

+17
-10
lines changed

1 file changed

+17
-10
lines changed

pkg/cluster/k8sres.go

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1960,25 +1960,32 @@ func (c *Cluster) generatePgbackrestConfigVolume(backrestSpec *cpov1.Pgbackrest,
19601960
func (c *Cluster) generatePgbackrestCloneConfigVolumes(description *cpov1.CloneDescription) []cpov1.AdditionalVolume {
19611961
defaultMode := int32(0640)
19621962

1963+
projections := []v1.VolumeProjection{{
1964+
ConfigMap: &v1.ConfigMapProjection{
1965+
LocalObjectReference: v1.LocalObjectReference{Name: c.getPgbackrestCloneConfigmapName()},
1966+
},
1967+
}}
1968+
1969+
if description.Pgbackrest.Configuration.Secret != "" {
1970+
projections = append(projections, v1.VolumeProjection{
1971+
Secret: &v1.SecretProjection{
1972+
LocalObjectReference: v1.LocalObjectReference{Name: description.Pgbackrest.Configuration.Secret},
1973+
},
1974+
})
1975+
}
1976+
19631977
volumes := []cpov1.AdditionalVolume{
19641978
{
19651979
Name: "pgbackrest-clone",
19661980
MountPath: "/etc/pgbackrest/clone-conf.d",
19671981
VolumeSource: v1.VolumeSource{
1968-
ConfigMap: &v1.ConfigMapVolumeSource{
1969-
LocalObjectReference: v1.LocalObjectReference{
1970-
Name: c.getPgbackrestCloneConfigmapName(),
1971-
},
1982+
Projected: &v1.ProjectedVolumeSource{
1983+
DefaultMode: &defaultMode,
1984+
Sources: projections,
19721985
},
19731986
},
19741987
},
19751988
}
1976-
if description.Pgbackrest.Configuration.Secret != "" {
1977-
volumes[0].VolumeSource.Secret = &v1.SecretVolumeSource{
1978-
SecretName: description.Pgbackrest.Configuration.Secret,
1979-
DefaultMode: &defaultMode,
1980-
}
1981-
}
19821989

19831990
if description.Pgbackrest.Repo.Storage == "pvc" && description.ClusterName != "" {
19841991
// Cloning from another cluster, mount that clusters certs

0 commit comments

Comments
 (0)