normalizeVolumeName maps old unprefixed volume names to the new prefixed scheme (ext- for extensions, tbs- for tablespaces) to avoid spurious pod restarts on upgrade. Names already starting with the correct prefix are left unchanged, which causes one spurious restart for extensions named "ext_*" or
(vol corev1.Volume)
| 144 | // |
| 145 | // TODO: delete this function after minor version 1.28 is discontinued |
| 146 | func normalizeVolumeName(vol corev1.Volume) string { |
| 147 | name := vol.Name |
| 148 | |
| 149 | if vol.Image != nil && !strings.HasPrefix(name, "ext-") { |
| 150 | return SanitizeExtensionNameForVolume(name) |
| 151 | } |
| 152 | |
| 153 | if vol.PersistentVolumeClaim != nil && |
| 154 | strings.Contains(vol.PersistentVolumeClaim.ClaimName, apiv1.TablespaceVolumeInfix) && |
| 155 | !strings.HasPrefix(name, "tbs-") { |
| 156 | return "tbs-" + name |
| 157 | } |
| 158 | |
| 159 | return name |
| 160 | } |
| 161 | |
| 162 | // normalizeVolumeMountName is the VolumeMount counterpart of |
| 163 | // normalizeVolumeName, using mount paths to detect the volume type. |
no test coverage detected