mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 11:50:44 +00:00
Fix volumeMode retrieval when BlockVolume feature is off
API served does not need to default volumeMode to Filesystem.
This commit is contained in:
parent
acf129443c
commit
c9fc26d85e
@ -505,11 +505,14 @@ func (dswp *desiredStateOfWorldPopulator) createVolumeSpec(
|
||||
pvcSource.ClaimName,
|
||||
pvcUID)
|
||||
|
||||
// TODO: remove features.BlockVolume checks / comments after no longer needed
|
||||
volumeMode, err := util.GetVolumeMode(volumeSpec)
|
||||
if err != nil {
|
||||
return nil, nil, "", err
|
||||
// TODO: replace this with util.GetVolumeMode() when features.BlockVolume is removed.
|
||||
// The function will return the right value then.
|
||||
volumeMode := v1.PersistentVolumeFilesystem
|
||||
if volumeSpec.PersistentVolume != nil && volumeSpec.PersistentVolume.Spec.VolumeMode != nil {
|
||||
volumeMode = *volumeSpec.PersistentVolume.Spec.VolumeMode
|
||||
}
|
||||
|
||||
// TODO: remove features.BlockVolume checks / comments after no longer needed
|
||||
// Error if a container has volumeMounts but the volumeMode of PVC isn't Filesystem.
|
||||
// Do not check feature gate here to make sure even when the feature is disabled in kubelet,
|
||||
// because controller-manager / API server can already contain block PVs / PVCs.
|
||||
|
Loading…
Reference in New Issue
Block a user