Skip to content
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

fix: respect the anonymize value from CR during initialization #332

Merged
merged 5 commits into from
Mar 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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