diff --git a/api/v1alpha1/k8sgpt_types.go b/api/v1alpha1/k8sgpt_types.go index d3194d7d..a969dbfd 100644 --- a/api/v1alpha1/k8sgpt_types.go +++ b/api/v1alpha1/k8sgpt_types.go @@ -92,7 +92,7 @@ type AISpec struct { Secret *SecretRef `json:"secret,omitempty"` Enabled bool `json:"enabled,omitempty"` // +kubebuilder:default:=true - Anonymize bool `json:"anonymized,omitempty"` + Anonymize *bool `json:"anonymized,omitempty"` // +kubebuilder:default:=english Language string `json:"language,omitempty"` } diff --git a/api/v1alpha1/k8sgpt_types_test.go b/api/v1alpha1/k8sgpt_types_test.go index 5e11292d..cbca1edc 100644 --- a/api/v1alpha1/k8sgpt_types_test.go +++ b/api/v1alpha1/k8sgpt_types_test.go @@ -43,6 +43,7 @@ var _ = Describe("The test cases for the K8sGPT CRDs", func() { repository = "ghcr.io/k8sgpt-ai/k8sgpt" version = "v1alpha1" language = "english" + anonymize = true Namespace = "k8sGPT" @@ -62,7 +63,7 @@ var _ = Describe("The test cases for the K8sGPT CRDs", func() { Model: model, Enabled: true, Secret: &secretRef, - Anonymize: true, + Anonymize: &anonymize, Language: language, }, Version: version, @@ -74,7 +75,8 @@ var _ = Describe("The test cases for the K8sGPT CRDs", func() { }, } - k8sGPT2 = K8sGPT{ + dontAnonymize = false + k8sGPT2 = K8sGPT{ TypeMeta: metav1.TypeMeta{ Kind: kind, }, @@ -90,7 +92,7 @@ var _ = Describe("The test cases for the K8sGPT CRDs", func() { Model: model, Secret: &secretRef, Enabled: false, - Anonymize: false, + Anonymize: &dontAnonymize, Language: language, }, Repository: repository, diff --git a/api/v1alpha1/zz_generated.deepcopy.go b/api/v1alpha1/zz_generated.deepcopy.go index 972b8e30..23c5675c 100644 --- a/api/v1alpha1/zz_generated.deepcopy.go +++ b/api/v1alpha1/zz_generated.deepcopy.go @@ -38,6 +38,11 @@ func (in *AISpec) DeepCopyInto(out *AISpec) { *out = new(SecretRef) **out = **in } + if in.Anonymize != nil { + in, out := &in.Anonymize, &out.Anonymize + *out = new(bool) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AISpec. diff --git a/pkg/client/analysis.go b/pkg/client/analysis.go index 92469e5b..01816fb3 100644 --- a/pkg/client/analysis.go +++ b/pkg/client/analysis.go @@ -21,7 +21,7 @@ func (c *Client) ProcessAnalysis(deployment v1.Deployment, config *v1alpha1.K8sG Backend: config.Spec.AI.Backend, Namespace: config.Spec.TargetNamespace, Filters: config.Spec.Filters, - Anonymize: config.Spec.AI.Anonymize, + Anonymize: *config.Spec.AI.Anonymize, Language: config.Spec.AI.Language, }