mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-05 23:47:50 +00:00
Add VolumeType api to PV and PVC
This commit is contained in:
@@ -243,12 +243,15 @@ 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)
|
||||
}
|
||||
|
||||
DropDisabledVolumeDevicesAlphaFields(podSpec)
|
||||
}
|
||||
|
||||
// DropDisabledVolumeMountsAlphaFields removes disabled fields from []VolumeMount.
|
||||
@@ -260,3 +263,16 @@ func DropDisabledVolumeMountsAlphaFields(volumeMounts []api.VolumeMount) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// DropDisabledVolumeDevicesAlphaFields removes disabled fields from []VolumeDevice.
|
||||
// This should be called from PrepareForCreate/PrepareForUpdate for all resources containing a VolumeDevice
|
||||
func DropDisabledVolumeDevicesAlphaFields(podSpec *api.PodSpec) {
|
||||
if !utilfeature.DefaultFeatureGate.Enabled(features.BlockVolume) {
|
||||
for i := range podSpec.Containers {
|
||||
podSpec.Containers[i].VolumeDevices = nil
|
||||
}
|
||||
for i := range podSpec.InitContainers {
|
||||
podSpec.InitContainers[i].VolumeDevices = nil
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user