Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
2 tasks done
naveenthangaraj03 opened this issue Jun 17, 2024 · 3 comments
Closed
2 tasks done

Comments

@naveenthangaraj03
Copy link
Contributor

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

@JuHyung-Son
Copy link
Contributor

good. Can you give us pr?

@naveenthangaraj03
Copy link
Contributor Author

@JuHyung-Son
Below I mentioned the PR
#1164

@naveenthangaraj03
Copy link
Contributor Author

The PR #1164 is merged successfully

@github-project-automation github-project-automation bot moved this from Proposed to Done in Backlog Jul 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

No branches or pull requests

2 participants