-
Notifications
You must be signed in to change notification settings - Fork 80
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
[BUG]: Kind/Name of result not existing for k8sgpt-operator #240
Comments
I will create a PR where the spec.kind will contain the kind of the original resource instead of ConfigurationAuditReport or VulnerabilityReport, but I am open for any discussion if another approach is better. |
I'm trying to get my head around this one, is there something simple I can do to repro without needing backstage? |
@AlexsJones sorry for not responding. You don't need backstage for this. You can install trivy and then configure K8sGPT like in "Steps to reproduce" in #240 (comment) . So the kind is ConfigAuditReport but the name is the name of a replicaset the ConfigAuditReport was referencing. In k8sgpt-ai/k8sgpt#678 I tried to set the kind to the original kind (which in that case would be a replicaset), but then the AI prompt would not be set for the ConfigAuditReport. So my suggestions would be the keep the kind to "ConfigAuditReport" but then set the correct name of the ConfigAuditReport in https://github.com/k8sgpt-ai/k8sgpt/blob/main/pkg/integration/trivy/analyzer.go#L119-L120 |
@AlexsJones I now created the new PR k8sgpt-ai/k8sgpt#869 which should fix this issue. If you or @matthisholleville have time I would love to get a review |
Checklist
Affected Components
K8sGPT Version
v0.3.16
Kubernetes Version
v1.26.0
Host OS and its Version
No response
Steps to reproduce
You will get an error in the reconciliation loop of the operator because when "backstage.enabled: true" the operator wants to retrieve a label from the original object of the result. For ConfigAuditReport and VulnerabilityReport the name of the result is a combination of two labels which represent the original namespace and original name of the analyzed resource by trivy.
Unfortunately the trivy ConfigAuditReport and VulnerabilityReport resource names are not the same as the original resource. So actually currently the kind is ConfigAuditReport or VulnerabilityReport but the resource name is the name of the original analyzed resource (e.g. Service or DaemonSet).
Example:
Analyzed resource by trivy:
the ConfigAuditReport is this
the K8sGPT Result is this:
Now the problem is that there is no kind "ConfigAuditReport" in Namespace "kube-system" with name "kube-dns".
Either we set in the K8sGPT result the spec.kind "Service" (which would be in the label trivy-operator.resource.kind of the ConfigAuditReport) and the name "kube-dns" or we set the spec.kind "ConfigAuditReport" with the name of the ConfigAuditReport resource.
Expected behaviour
Either we set in the K8sGPT result the spec.kind "Service" (which would be in the label trivy-operator.resource.kind of the ConfigAuditReport) and the name "kube-dns" or we set the spec.kind "ConfigAuditReport" with the name of the ConfigAuditReport resource.
I think the key question is if we want to reference the original resource where the problem happens or in the case if the trivy integration the resource of the trivy report.
Actual behaviour
The operator reconciliation loop fails with
Additional Information
No response
The text was updated successfully, but these errors were encountered: