mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-27 21:47:07 +00:00
kubelet: better error when generic ephemeral volume is disabled
Silently ignoring the unsupported volume type leads to: Warning FailedMount 8s kubelet Unable to attach or mount volumes: unmounted volumes=[my-csi-volume default-token-bsnbz], unattached volumes=[my-csi-volume default-token-bsnbz]: failed to get Plugin from volumeSpec for volume "my-csi-volume" err=no volume plugin matched The new message is easier to understand: Warning FailedMount 6s (x5 over 49s) kubelet Unable to attach or mount volumes: unmounted volumes=[my-csi-volume], unattached volumes=[my-csi-volume default-token-rwlpp]: volume my-csi-volume is a generic ephemeral volume, but that feature is disabled in kubelet
This commit is contained in:
parent
d64165c803
commit
edb9a8584c
@ -512,8 +512,18 @@ func (dswp *desiredStateOfWorldPopulator) createVolumeSpec(
|
|||||||
pvcSource := podVolume.VolumeSource.PersistentVolumeClaim
|
pvcSource := podVolume.VolumeSource.PersistentVolumeClaim
|
||||||
ephemeral := false
|
ephemeral := false
|
||||||
if pvcSource == nil &&
|
if pvcSource == nil &&
|
||||||
podVolume.VolumeSource.Ephemeral != nil &&
|
podVolume.VolumeSource.Ephemeral != nil {
|
||||||
utilfeature.DefaultFeatureGate.Enabled(features.GenericEphemeralVolume) {
|
if !utilfeature.DefaultFeatureGate.Enabled(features.GenericEphemeralVolume) {
|
||||||
|
// Provide an unambiguous error message that
|
||||||
|
// explains why the volume cannot be
|
||||||
|
// processed. If we just ignore the volume
|
||||||
|
// source, the error is just a vague "unknown
|
||||||
|
// volume source".
|
||||||
|
return nil, nil, "", fmt.Errorf(
|
||||||
|
"volume %s is a generic ephemeral volume, but that feature is disabled in kubelet",
|
||||||
|
podVolume.Name,
|
||||||
|
)
|
||||||
|
}
|
||||||
// Generic ephemeral inline volumes are handled the
|
// Generic ephemeral inline volumes are handled the
|
||||||
// same way as a PVC reference. The only additional
|
// same way as a PVC reference. The only additional
|
||||||
// constraint (checked below) is that the PVC must be
|
// constraint (checked below) is that the PVC must be
|
||||||
|
Loading…
Reference in New Issue
Block a user