MCPcopy Create free account
hub / github.com/cloudnative-pg/cloudnative-pg / normalizeVolumeMountName

Function normalizeVolumeMountName

pkg/specs/podspec_diff.go:166–179  ·  view source on GitHub ↗

normalizeVolumeMountName is the VolumeMount counterpart of normalizeVolumeName, using mount paths to detect the volume type. TODO: delete this function after minor version 1.28 is discontinued

(mount corev1.VolumeMount)

Source from the content-addressed store, hash-verified

164//
165// TODO: delete this function after minor version 1.28 is discontinued
166func normalizeVolumeMountName(mount corev1.VolumeMount) string {
167 name := mount.Name
168
169 extensionPathPrefix := postgres.ExtensionsBaseDirectory + "/"
170 if strings.HasPrefix(mount.MountPath, extensionPathPrefix) && !strings.HasPrefix(name, "ext-") {
171 return SanitizeExtensionNameForVolume(name)
172 }
173
174 if strings.HasPrefix(mount.MountPath, PgTablespaceVolumePath+"/") && !strings.HasPrefix(name, "tbs-") {
175 return "tbs-" + name
176 }
177
178 return name
179}
180
181func compareVolumes(currentVolumes, targetVolumes []corev1.Volume) (bool, string) {
182 current := make(map[string]corev1.Volume)

Callers 2

compareVolumeMountsFunction · 0.85

Calls 1

Tested by

no test coverage detected