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

Function addConfigVolumeAndMounts

internal/pgbackrest/reconcile.go:265–296  ·  view source on GitHub ↗

addConfigVolumeAndMounts adds the config projections to pod as the configuration volume. It mounts that volume to the database container and all pgBackRest containers in pod.

(
	pod *corev1.PodSpec, config []corev1.VolumeProjection,
)

Source from the content-addressed store, hash-verified

263// configuration volume. It mounts that volume to the database container and
264// all pgBackRest containers in pod.
265func addConfigVolumeAndMounts(
266 pod *corev1.PodSpec, config []corev1.VolumeProjection,
267) {
268 configVolumeMount := corev1.VolumeMount{
269 Name: "pgbackrest-config",
270 MountPath: configDirectory,
271 ReadOnly: true,
272 }
273
274 configVolume := corev1.Volume{
275 Name: configVolumeMount.Name,
276 VolumeSource: corev1.VolumeSource{
277 Projected: &corev1.ProjectedVolumeSource{Sources: config},
278 },
279 }
280
281 for i := range pod.Containers {
282 container := &pod.Containers[i]
283
284 switch container.Name {
285 case
286 naming.ContainerDatabase,
287 naming.ContainerPGBackRestConfig,
288 naming.PGBackRestRepoContainerName,
289 naming.PGBackRestRestoreContainerName:
290
291 container.VolumeMounts = append(container.VolumeMounts, configVolumeMount)
292 }
293 }
294
295 pod.Volumes = append(pod.Volumes, configVolume)
296}
297
298// addServerContainerAndVolume adds the TLS server container and certificate
299// projections to pod. Any PostgreSQL data and WAL volumes in pod are also mounted.

Callers 4

AddConfigToInstancePodFunction · 0.85
AddConfigToRepoPodFunction · 0.85
AddConfigToRestorePodFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected