k8sgpt-ai / k8sgpt-operator

Automatic SRE Superpowers within your Kubernetes cluster
https://k8sgpt.ai
Apache License 2.0
301 stars 85 forks source link

[Question]: Is there a way to remove a filter? #393

Closed rwlove closed 5 months ago

rwlove commented 6 months ago

Checklist

Affected Components

K8sGPT Version

No response

Kubernetes Version

No response

Host OS and its Version

No response

Steps to reproduce

---
apiVersion: core.k8sgpt.ai/v1alpha1
kind: K8sGPT
metadata:
  name: k8sgpt-local-ai
  namespace: ai
spec:
  ai:
    backend: localai
    baseUrl: http://localai-local-ai.ai.svc.cluster.local:80/v1
    #model: gpt-3.5-turbo                                                                                                                                                     
    model: ggml-gpt4all-j
    secret:
      name: localai-api-key-secret
      key: localai-api-key
  noCache: false
  version: v0.3.29
  filters:
    - Ingress

This only adds the ingress filter, but how can I remove processing of ingresses?

Expected behaviour

remove a filter

Actual behaviour

add a filter

Additional Information

No response

arbreezy commented 6 months ago

Hey @rwlove, I guess you already tried to remove the filter from your k8sGPT CR ? In theory in each analysis k8sgpt -operator just reads the current filter list so by removing the

...
filters:
  - Ingress
...   

it should be OK

rwlove commented 5 months ago

The question is, "How do I tell k8sGPT to analyse the cluster with all of the filters EXCLUDING Ingress using the CR?"

arbreezy commented 5 months ago

@rwlove, K8sGPT's filters at the moment is a whitelist so there is no clever way to exclude an analyzer, you have to have a list of all the analysers you want to run against your clusters.

If we want to dive into the current implementation there are two conditions re: filters here and here whereby in your scenario you will have to put all the desired analysers in your filter's CR list.

K8sGPT cli can be more intuitive cause it can interact with the config file i.e by using the k8sgpt add/remove filter commands which write to the K8sGPT's config file so there is no need to specify on runtime filters during your analysis k8sgpt analyze --filter X,Z

Hope that answers your question

rwlove commented 5 months ago

Thanks, @arbreezy. I came to the conclusion that it would probably be wiser to just fix the error instead of exclude the analyzer, which I think is caused by a false positive described here: https://github.com/k8sgpt-ai/k8sgpt/issues/1075. Thanks for your comments.