mirror of
https://github.com/k8sgpt-ai/k8sgpt.git
synced 2025-09-25 06:44:51 +00:00
fix: pdb panic error guard (#664)
Signed-off-by: Alex Jones <alexsimonjones@gmail.com> Co-authored-by: Aris Boutselis <aris.boutselis@senseon.io>
This commit is contained in:
@@ -58,6 +58,7 @@ func (PdbAnalyzer) Analyze(a common.Analyzer) ([]common.Result, error) {
|
||||
if pdb.Spec.MinAvailable != nil {
|
||||
doc = apiDoc.GetApiDocV2("spec.minAvailable")
|
||||
}
|
||||
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),
|
||||
@@ -75,6 +76,7 @@ func (PdbAnalyzer) Analyze(a common.Analyzer) ([]common.Result, error) {
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if len(failures) > 0 {
|
||||
preAnalysis[fmt.Sprintf("%s/%s", pdb.Namespace, pdb.Name)] = common.PreAnalysis{
|
||||
|
Reference in New Issue
Block a user