Skip to content

Commit

Permalink
Fix previous fix of clone volume generation
Browse files Browse the repository at this point in the history
  • Loading branch information
ants committed Dec 11, 2024
1 parent 5c9432a commit be4b072
Showing 1 changed file with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions pkg/cluster/k8sres.go
Original file line number Diff line number Diff line change
Expand Up @@ -1960,25 +1960,32 @@ func (c *Cluster) generatePgbackrestConfigVolume(backrestSpec *cpov1.Pgbackrest,
func (c *Cluster) generatePgbackrestCloneConfigVolumes(description *cpov1.CloneDescription) []cpov1.AdditionalVolume {
defaultMode := int32(0640)

projections := []v1.VolumeProjection{{
ConfigMap: &v1.ConfigMapProjection{
LocalObjectReference: v1.LocalObjectReference{Name: c.getPgbackrestCloneConfigmapName()},
},
}}

if description.Pgbackrest.Configuration.Secret != "" {
projections = append(projections, v1.VolumeProjection{
Secret: &v1.SecretProjection{
LocalObjectReference: v1.LocalObjectReference{Name: description.Pgbackrest.Configuration.Secret},
},
})
}

volumes := []cpov1.AdditionalVolume{
{
Name: "pgbackrest-clone",
MountPath: "/etc/pgbackrest/clone-conf.d",
VolumeSource: v1.VolumeSource{
ConfigMap: &v1.ConfigMapVolumeSource{
LocalObjectReference: v1.LocalObjectReference{
Name: c.getPgbackrestCloneConfigmapName(),
},
Projected: &v1.ProjectedVolumeSource{
DefaultMode: &defaultMode,
Sources: projections,
},
},
},
}
if description.Pgbackrest.Configuration.Secret != "" {
volumes[0].VolumeSource.Secret = &v1.SecretVolumeSource{
SecretName: description.Pgbackrest.Configuration.Secret,
DefaultMode: &defaultMode,
}
}

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

0 comments on commit be4b072

Please sign in to comment.