Skip to content

Commit

Permalink
fix: pdb panic error guard (#664)
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Jones <alexsimonjones@gmail.com>
Co-authored-by: Aris Boutselis <aris.boutselis@senseon.io>
  • Loading branch information
AlexsJones and Aris Boutselis committed Sep 17, 2023
1 parent f607360 commit 3277b2a
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions pkg/analyzer/pdb.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,21 +58,23 @@ func (PdbAnalyzer) Analyze(a common.Analyzer) ([]common.Result, error) {
if pdb.Spec.MinAvailable != nil {
doc = apiDoc.GetApiDocV2("spec.minAvailable")
}
for k, v := range pdb.Spec.Selector.MatchLabels {
failures = append(failures, common.Failure{
Text: fmt.Sprintf("%s, expected pdb pod label %s=%s", pdb.Status.Conditions[0].Reason, k, v),
KubernetesDoc: doc,
Sensitive: []common.Sensitive{
{
Unmasked: k,
Masked: util.MaskString(k),
if pdb.Spec.Selector != nil && pdb.Spec.Selector.MatchLabels != nil {
for k, v := range pdb.Spec.Selector.MatchLabels {
failures = append(failures, common.Failure{
Text: fmt.Sprintf("%s, expected pdb pod label %s=%s", pdb.Status.Conditions[0].Reason, k, v),
KubernetesDoc: doc,
Sensitive: []common.Sensitive{
{
Unmasked: k,
Masked: util.MaskString(k),
},
{
Unmasked: v,
Masked: util.MaskString(v),
},
},
{
Unmasked: v,
Masked: util.MaskString(v),
},
},
})
})
}
}
}

Expand Down

0 comments on commit 3277b2a

Please sign in to comment.