mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-28 21:55:48 +00:00
Clear alpha MountPropagation fields.
According to api_changes.md, alpha fields must be cleared when corresponding feature is disabled.
This commit is contained in:
@@ -243,4 +243,20 @@ func DropDisabledAlphaFields(podSpec *api.PodSpec) {
|
||||
}
|
||||
}
|
||||
}
|
||||
for i := range podSpec.Containers {
|
||||
DropDisabledVolumeMountsAlphaFields(podSpec.Containers[i].VolumeMounts)
|
||||
}
|
||||
for i := range podSpec.InitContainers {
|
||||
DropDisabledVolumeMountsAlphaFields(podSpec.InitContainers[i].VolumeMounts)
|
||||
}
|
||||
}
|
||||
|
||||
// DropDisabledVolumeMountsAlphaFields removes disabled fields from []VolumeMount.
|
||||
// This should be called from PrepareForCreate/PrepareForUpdate for all resources containing a VolumeMount
|
||||
func DropDisabledVolumeMountsAlphaFields(volumeMounts []api.VolumeMount) {
|
||||
if !utilfeature.DefaultFeatureGate.Enabled(features.MountPropagation) {
|
||||
for i := range volumeMounts {
|
||||
volumeMounts[i].MountPropagation = nil
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user