Skip to content

Commit b564264

Browse files
authored
feat: renamed to similarity requirement for scoring (#609)
Signed-off-by: AlexsJones <alexsimonjones@gmail.com>
1 parent 00fa047 commit b564264

File tree

6 files changed

+12
-11
lines changed

6 files changed

+12
-11
lines changed

AUTO_REMEDIATION.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ spec:
3535
3636
`enabled`: A boolean value. If true, enables automatic remediation.
3737
38-
`riskThreshold`: A string representing the risk threshold (e.g., "90").
39-
Issues with a risk score above this threshold will be automatically remediated.
38+
`similarityRequirement`: A string representing the required similarity with the original manifest (e.g., "90").
39+
New proposed manifests with a requirement above this threshold will be automatically remediated.
4040
4141
`resources`: A list of Kubernetes resource types to consider for automatic remediation (e.g., Pod, Service, Deployment, Ingress).
4242

api/v1alpha1/k8sgpt_types.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ type AutoRemediation struct {
101101
Enabled bool `json:"enabled"`
102102
// Defaults to 10%
103103
// +kubebuilder:default="10"
104-
RiskThreshold string `json:"riskThreshold"`
104+
SimilarityRequirement string `json:"similarityRequirement"`
105105
// Support Pod, Deployment, Service and Ingress
106106
// +kubebuilder:default:={"Pod","Deployment","Service","Ingress"}
107107
Resources []string `json:"resources"`
@@ -115,7 +115,7 @@ type AISpec struct {
115115
BackOff *BackOff `json:"backOff,omitempty"`
116116
BaseUrl string `json:"baseUrl,omitempty"`
117117
Region string `json:"region,omitempty"`
118-
// +kubebuilder:default:=gpt-3.5-turbo
118+
// +kubebuilder:default:=gpt-4o-mini
119119
Model string `json:"model,omitempty"`
120120
Engine string `json:"engine,omitempty"`
121121
Secret *SecretRef `json:"secret,omitempty"`

chart/operator/templates/mutation-crd.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1+
---
12
apiVersion: apiextensions.k8s.io/v1
23
kind: CustomResourceDefinition
34
metadata:
4-
name: mutations.core.k8sgpt.ai
55
annotations:
66
controller-gen.kubebuilder.io/version: v0.14.0
77
labels:
88
{{- include "chart.labels" . | nindent 4 }}
9+
name: mutations.core.k8sgpt.ai
910
spec:
1011
group: core.k8sgpt.ai
1112
names:

config/crd/bases/core.k8sgpt.ai_k8sgpts.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,14 @@ spec:
5959
items:
6060
type: string
6161
type: array
62-
riskThreshold:
62+
similarityRequirement:
6363
default: "10"
6464
description: Defaults to 10%
6565
type: string
6666
required:
6767
- enabled
6868
- resources
69-
- riskThreshold
69+
- similarityRequirement
7070
type: object
7171
backOff:
7272
properties:
@@ -106,7 +106,7 @@ spec:
106106
default: "2048"
107107
type: string
108108
model:
109-
default: gpt-3.5-turbo
109+
default: gpt-4o-mini
110110
type: string
111111
providerId:
112112
type: string

config/samples/autoremediation/valid_k8sgpt_remediation_sample.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ spec:
77
ai:
88
autoRemediation:
99
enabled: true
10-
riskThreshold: "90"
10+
similarityRequirement: "90"
1111
resources:
1212
- Pod
1313
- Service

internal/controller/mutation/mutation_controller.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,13 +166,13 @@ func (r *MutationReconciler) Reconcile(ctx context.Context, req ctrl.Request) (c
166166
return ctrl.Result{RequeueAfter: util.ErrorRequeueTime}, nil
167167
}
168168
if r.K8sGPT != nil {
169-
if r.K8sGPT.Spec.AI.AutoRemediation.RiskThreshold != "" {
169+
if r.K8sGPT.Spec.AI.AutoRemediation.SimilarityRequirement != "" {
170170
// If the current Similarity score is less than the riskThreshold, we should not apply the mutation
171171
ss, err := strconv.ParseFloat(strings.TrimSpace(mutation.Spec.SimilarityScore), 64)
172172
if err != nil {
173173
mutationControllerLog.Error(err, "unable to parse similarity score", "mutation", mutation.Name)
174174
} else {
175-
rt, err := strconv.ParseFloat(r.K8sGPT.Spec.AI.AutoRemediation.RiskThreshold, 64)
175+
rt, err := strconv.ParseFloat(r.K8sGPT.Spec.AI.AutoRemediation.SimilarityRequirement, 64)
176176
if err != nil {
177177
mutationControllerLog.Error(err, "unable to parse risk threshold", "mutation", mutation.Name)
178178
} else {

0 commit comments

Comments
 (0)