Merge pull request #126323 from saschagrunert/image-volume-runtime-panic

Fix runtime panic in imagevolume `CanSupport` method
This commit is contained in:
Kubernetes Prow Robot 2024-07-24 04:57:06 -07:00 committed by GitHub
commit ceb58a4dbc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -49,7 +49,7 @@ func (o *imagePlugin) GetPluginName() string { return
func (o *imagePlugin) GetVolumeName(spec *volume.Spec) (string, error) { return o.spec.Name(), nil }
func (o *imagePlugin) CanSupport(spec *volume.Spec) bool {
return spec.Volume.Image != nil
return spec != nil && spec.Volume != nil && spec.Volume.Image != nil
}
func (o *imagePlugin) NewMounter(spec *volume.Spec, podRef *v1.Pod) (volume.Mounter, error) {