k8sgpt icon indicating copy to clipboard operation
k8sgpt copied to clipboard

fix: use original resource kind as result.spec.kind

Open jkleinlercher opened this issue 1 year ago • 4 comments

Closes k8sgpt-ai/k8sgpt-operator#240

📑 Description

this is one approach to fix k8sgpt-ai/k8sgpt-operator#240 by using the original analyzed resource kind for the result.spec.kind attribute.

✅ Checks

  • [ ] My pull request adheres to the code style of this project
  • [ ] My code requires changes to the documentation
  • [ ] I have updated the documentation as required
  • [ ] All the tests have passed

ℹ Additional Information

jkleinlercher avatar Sep 21 '23 08:09 jkleinlercher

unfortunately with this change the prompt for ConfigAuditReport and VulnerabilityReport is again default since the Kind is used to set another prompt ... https://github.com/k8sgpt-ai/k8sgpt/blob/1da4b7c8f0eee877d5b76a7dd9abda7631d922f3/pkg/analysis/analysis.go#L266

Instead of referencing to the original resource (e.g. replicaset) I can again reference to the ConfigAuditReport. However, from my point of view the better approach would be to point to the original resource since this is also the case for the other analyzers and pointing to different prompts for different analyses should be set somehow different? Maybe there should be an explicit attribut "prompt" in the analyses struct which could then be set here https://github.com/k8sgpt-ai/k8sgpt/blob/1da4b7c8f0eee877d5b76a7dd9abda7631d922f3/pkg/integration/trivy/analyzer.go#L77

Any ideas?

jkleinlercher avatar Sep 21 '23 13:09 jkleinlercher

@AlexsJones, @matthisholleville: Is this one ok to merge?

thschue avatar Dec 21 '23 12:12 thschue

@thschue unfortunatly not because of https://github.com/k8sgpt-ai/k8sgpt/pull/678#issuecomment-1729566846

jkleinlercher avatar Dec 21 '23 19:12 jkleinlercher

I need to create a new PR where the kind is still „ConfigAuditReport“ and the name is the name of the ConfigAuditReport

jkleinlercher avatar Dec 21 '23 19:12 jkleinlercher

close this one because https://github.com/k8sgpt-ai/k8sgpt/pull/869 is a better approach

jkleinlercher avatar Jan 15 '24 17:01 jkleinlercher