From d4bf6eb5dd2861857e1ba1f5c2e56480c375289d Mon Sep 17 00:00:00 2001 From: Alex Jones Date: Sun, 23 Apr 2023 19:35:40 +0100 Subject: [PATCH] chore: updated nocache Signed-off-by: Alex Jones --- api/v1alpha1/k8sgpt_types.go | 1 + config/crd/bases/core.k8sgpt.ai_k8sgpts.yaml | 2 ++ config/samples/core_v1alpha1_k8sgpt.yaml | 7 +------ pkg/client/client.go | 4 ++++ 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/api/v1alpha1/k8sgpt_types.go b/api/v1alpha1/k8sgpt_types.go index 75d688fd..a3c65cdd 100644 --- a/api/v1alpha1/k8sgpt_types.go +++ b/api/v1alpha1/k8sgpt_types.go @@ -36,6 +36,7 @@ type K8sGPTSpec struct { Namespace string `json:"namespace,omitempty"` Version string `json:"version,omitempty"` EnableAI bool `json:"enableAI,omitempty"` + NoCache bool `json:"noCache,omitempty"` } // K8sGPTStatus defines the observed state of K8sGPT diff --git a/config/crd/bases/core.k8sgpt.ai_k8sgpts.yaml b/config/crd/bases/core.k8sgpt.ai_k8sgpts.yaml index 8cac2c6d..de12b6a5 100644 --- a/config/crd/bases/core.k8sgpt.ai_k8sgpts.yaml +++ b/config/crd/bases/core.k8sgpt.ai_k8sgpts.yaml @@ -43,6 +43,8 @@ spec: type: string namespace: type: string + noCache: + type: boolean secret: properties: key: diff --git a/config/samples/core_v1alpha1_k8sgpt.yaml b/config/samples/core_v1alpha1_k8sgpt.yaml index 255bcb3d..40b6d7f5 100644 --- a/config/samples/core_v1alpha1_k8sgpt.yaml +++ b/config/samples/core_v1alpha1_k8sgpt.yaml @@ -1,17 +1,12 @@ apiVersion: core.k8sgpt.ai/v1alpha1 kind: K8sGPT metadata: - labels: - app.kubernetes.io/name: k8sgpt - app.kubernetes.io/instance: k8sgpt-sample - app.kubernetes.io/part-of: k8sgpt-operator - app.kubernetes.io/managed-by: kustomize - app.kubernetes.io/created-by: k8sgpt-operator name: k8sgpt-sample spec: namespace: default model: gpt-3.5-turbo backend: openai + noCache: false version: v0.2.4 enableAI: true secret: diff --git a/pkg/client/client.go b/pkg/client/client.go index 6767cf66..821a9e20 100644 --- a/pkg/client/client.go +++ b/pkg/client/client.go @@ -51,6 +51,10 @@ func (c *Client) ProcessAnalysis(deployment v1.Deployment, config *v1alpha1.K8sG url = url + "?explain=true" } + if config.Spec.NoCache { + url = url + "?nocache=true" + } + r, err := c.httpClient.Get(url) if err != nil { return nil, err