Skip to content

Commit

Permalink
pod_killer: fix nil pointer dereference for non-csi volumes
Browse files Browse the repository at this point in the history
In case a PV does not have `spec.CSI` defined (e.g. a hostpath volume),
it should just be ignored and not cause a nil pointer dereference.

fixes: quobyte/quobyte-csi-driver#36
  • Loading branch information
Moritz Röhrich committed May 7, 2021
1 parent 83678e3 commit 5a8bd7e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pod_killer.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func (podKiller *PodKiller) Run(monitoringInterval *time.Duration) {
func (podKiller *PodKiller) filterProvisionerPVs(pvs *v1.PersistentVolumeList) map[string]v1.PersistentVolume {
provisionerPVs := make(map[string]v1.PersistentVolume)
for _, pv := range pvs.Items {
if pv.Spec.CSI.Driver == podKiller.CSIProvisionerName {
if pv.Spec.CSI != nil && pv.Spec.CSI.Driver == podKiller.CSIProvisionerName {
provisionerPVs[pv.Name] = pv
}
}
Expand Down

0 comments on commit 5a8bd7e

Please sign in to comment.