k8sgpt-ai/k8sgpt

[Feature]: Getting the error from Status field for HPA Analyzer

Closed this issue · 3 comments

Checklist

  • I've searched for similar issues and couldn't find anything matching
  • I've discussed this feature request in the K8sGPT Slack and got positive feedback

Is this feature request related to a problem?

Yes

Problem Description

In HPA analyzer, still now its getting the errors from the spec field particularly in the "Spec.ScaleTargetRef" field for HPA objects. That will not get all the errors list and also not getting the clear errors for some scenario.

Solution Description

Instead of getting the errors only from the spec field, we can also get the errors from the status field for HPA analyzer.

Benefits

If we get the error from both the field, then it will help to get the clear error list for the HPA analyzer.

Potential Drawbacks

No response

Additional Information

I added the some set of code to get the error from Status field also for HPA analyzer.

conditions := hpa.Status.Conditions
                for _, condition := range conditions {
                        if condition.Status != "True" {
                                doc := apiDoc.GetApiDocV2("status.conditions")
                                failures = append(failures, common.Failure{
                                        Text:          condition.Message,
                                        KubernetesDoc: doc,
                                        Sensitive: []common.Sensitive{
                                                {
                                                        Unmasked: scaleTargetRef.Name,
                                                        Masked:   util.MaskString(scaleTargetRef.Name),
                                                },
                                        },
                                })
                        }
                }

In the below Image the HPA analyzer get the errors from the status field also:

Screenshot 2024-06-12 120514

good. Can you give us pr?

@JuHyung-Son
Below I mentioned the PR
#1164

The PR #1164 is merged successfully