Skip to content

Commit

Permalink
fix: respect the anonymize value from CR during initialisaiton (#332)
Browse files Browse the repository at this point in the history
Signed-off-by: Aris Boutselis <arisboutselis08@gmail.com>
Co-authored-by: Aris Boutselis <aris.boutselis@senseon.io>
Co-authored-by: Alex Jones <alexsimonjones@gmail.com>
  • Loading branch information
3 people committed Mar 14, 2024
1 parent 2199d7f commit f604212
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion api/v1alpha1/k8sgpt_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
}
Expand Down
8 changes: 5 additions & 3 deletions api/v1alpha1/k8sgpt_types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand All @@ -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,
Expand All @@ -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,
},
Expand All @@ -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,
Expand Down
5 changes: 5 additions & 0 deletions api/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pkg/client/analysis.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}

Expand Down

0 comments on commit f604212

Please sign in to comment.