MCPcopy Create free account
hub / github.com/CrunchyData/postgres-operator / AddConfigToCloudBackupJob

Function AddConfigToCloudBackupJob

internal/pgbackrest/reconcile.go:162–185  ·  view source on GitHub ↗

AddConfigToCloudBackupJob adds and mounts the pgBackRest configuration volumes to the backup job for creating a backup to a cloud repo.

(
	cluster *v1beta1.PostgresCluster, podTemplateSpec *corev1.PodTemplateSpec,
)

Source from the content-addressed store, hash-verified

160// AddConfigToCloudBackupJob adds and mounts the pgBackRest configuration volumes
161// to the backup job for creating a backup to a cloud repo.
162func AddConfigToCloudBackupJob(
163 cluster *v1beta1.PostgresCluster, podTemplateSpec *corev1.PodTemplateSpec,
164) {
165 configmap := corev1.VolumeProjection{ConfigMap: &corev1.ConfigMapProjection{}}
166 configmap.ConfigMap.Name = naming.PGBackRestConfig(cluster).Name
167 configmap.ConfigMap.Items = []corev1.KeyToPath{
168 {Key: CMCloudRepoKey, Path: CMCloudRepoKey},
169 }
170
171 secret := corev1.VolumeProjection{Secret: &corev1.SecretProjection{}}
172 secret.Secret.Name = naming.PGBackRestSecret(cluster).Name
173 secret.Secret.Items = append(secret.Secret.Items, clientCertificates()...)
174
175 // Start with a copy of projections specified in the cluster. Items later in
176 // the list take precedence over earlier items (that is, last write wins).
177 // - https://kubernetes.io/docs/concepts/storage/volumes/#projected
178 sources := append([]corev1.VolumeProjection{},
179 cluster.Spec.Backups.PGBackRest.Configuration...)
180
181 addConfigVolumeAndMounts(&podTemplateSpec.Spec, append(sources, configmap, secret))
182
183 // Add tmp directory for pgbackrest lock files
184 AddTMPEmptyDir(podTemplateSpec)
185}
186
187// AddConfigToRestorePod adds and mounts the pgBackRest configuration volume
188// for the restore job of cluster to pod. The pgBackRest containers must

Callers 2

Calls 5

PGBackRestConfigFunction · 0.92
PGBackRestSecretFunction · 0.92
clientCertificatesFunction · 0.85
addConfigVolumeAndMountsFunction · 0.85
AddTMPEmptyDirFunction · 0.70

Tested by 1