k8sgpt-ai/k8sgpt-operator

[Bug]: Anonymized field does not work

Closed this issue · 2 comments

chnyda commented

Checklist

  • I've searched for similar issues and couldn't find anything matching
  • I've included steps to reproduce the behavior

Affected Components

  • K8sGPT (CLI)
  • K8sGPT Operator

K8sGPT Version

No response

Kubernetes Version

No response

Host OS and its Version

No response

Steps to reproduce

  1. Create a k8sgpt with anonymized set to False.
  spec:
    ai:
      anonymized: false
      backend: localai
     ...
  1. Wait for the controller to add a finalizer
  2. The k8sgpt is now like this
  spec:
    ai:
      anonymized: true
      backend: localai
     ...

Expected behaviour

The anonymized field should stay as it was during the creation of the object.

Actual behaviour

When the finalizer is added to the resource and the resource is updated, some fields are set to the default values, probably because of omitempty. One solution is to use pointers instead of pure booleans.

Additional Information

No response

hey @chnyda,

Could you please share the version of your operator and the version of k8sgpt's deployment ?

I found a reference for more context, as you rightly suggested probably switching to a pointer will resolve this, thanks for raising it :)