mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 11:50:44 +00:00
Fix controller crash because of nil volume spec
For volumes that don't support bulk volume verifiction, a nil volume spec can cause crash of controller.
This commit is contained in:
parent
3bae345a95
commit
0b1d61db00
@ -115,6 +115,10 @@ func (og *operationGenerator) GenerateVolumesAreAttachedFunc(
|
|||||||
volumeSpecMap := make(map[*volume.Spec]v1.UniqueVolumeName)
|
volumeSpecMap := make(map[*volume.Spec]v1.UniqueVolumeName)
|
||||||
// Iterate each volume spec and put them into a map index by the pluginName
|
// Iterate each volume spec and put them into a map index by the pluginName
|
||||||
for _, volumeAttached := range attachedVolumes {
|
for _, volumeAttached := range attachedVolumes {
|
||||||
|
if volumeAttached.VolumeSpec == nil {
|
||||||
|
glog.Errorf("VerifyVolumesAreAttached.GenerateVolumesAreAttachedFunc: nil spec for volume %s", volumeAttached.VolumeName)
|
||||||
|
continue
|
||||||
|
}
|
||||||
volumePlugin, err :=
|
volumePlugin, err :=
|
||||||
og.volumePluginMgr.FindPluginBySpec(volumeAttached.VolumeSpec)
|
og.volumePluginMgr.FindPluginBySpec(volumeAttached.VolumeSpec)
|
||||||
if err != nil || volumePlugin == nil {
|
if err != nil || volumePlugin == nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user