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

Function AddTMPEmptyDir

internal/pgbackrest/util.go:128–154  ·  view source on GitHub ↗

AddTMPEmptyDir adds a "tmp" EmptyDir volume to the provided Pod template, while then also adding a volume mount at /tmp for all containers defined within the Pod template The '/tmp' directory is currently utilized for the following: - As the pgBackRest lock directory (this is the default lock locati

(template *corev1.PodTemplateSpec)

Source from the content-addressed store, hash-verified

126//
127// This function was copied from the postgrescluster package.
128func AddTMPEmptyDir(template *corev1.PodTemplateSpec) {
129
130 template.Spec.Volumes = append(template.Spec.Volumes, corev1.Volume{
131 Name: "tmp",
132 VolumeSource: corev1.VolumeSource{
133 EmptyDir: &corev1.EmptyDirVolumeSource{
134 SizeLimit: &tmpDirSizeLimit,
135 },
136 },
137 })
138
139 for i := range template.Spec.Containers {
140 template.Spec.Containers[i].VolumeMounts = append(template.Spec.Containers[i].VolumeMounts,
141 corev1.VolumeMount{
142 Name: "tmp",
143 MountPath: "/tmp",
144 })
145 }
146
147 for i := range template.Spec.InitContainers {
148 template.Spec.InitContainers[i].VolumeMounts = append(template.Spec.InitContainers[i].VolumeMounts,
149 corev1.VolumeMount{
150 Name: "tmp",
151 MountPath: "/tmp",
152 })
153 }
154}

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected