Skip to content

Commit

Permalink
fix(pdb): fix nil pointer in pdb when selector.matchLabels is nil (#297)
Browse files Browse the repository at this point in the history
Co-authored-by: Phil Brocker <phil.brocker@gmail.com>
  • Loading branch information
pbr0ck3r and Phil Brocker committed Jun 6, 2024
1 parent 16152a6 commit 2fdeab2
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/kor/pdbs.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ func processNamespacePdbs(clientset kubernetes.Interface, namespace string, filt
}

selector := pdb.Spec.Selector
if selector == nil {
unusedPdbs = append(unusedPdbs, pdb.Name)
continue
}
if len(selector.MatchLabels) == 0 {
unusedPdbs = append(unusedPdbs, pdb.Name)
continue
Expand Down

0 comments on commit 2fdeab2

Please sign in to comment.