diff --git a/api/v1alpha1/k8sgpt_types.go b/api/v1alpha1/k8sgpt_types.go index d20c0924..95cef8a0 100644 --- a/api/v1alpha1/k8sgpt_types.go +++ b/api/v1alpha1/k8sgpt_types.go @@ -94,9 +94,15 @@ type Integrations struct { Trivy *Trivy `json:"trivy,omitempty"` } +type Image struct { + // +kubebuilder:default:=ghcr.io/k8sgpt-ai/k8gpt + Repository string `json:"repository,omitempty"` + Tag string `json:"tag,omitempty"` +} + // K8sGPTSpec defines the desired state of K8sGPT type K8sGPTSpec struct { - Version string `json:"version,omitempty"` + Image Image `json:"image,omitempty"` NoCache bool `json:"noCache,omitempty"` Filters []string `json:"filters,omitempty"` ExtraOptions *ExtraOptionsRef `json:"extraOptions,omitempty"` diff --git a/api/v1alpha1/k8sgpt_types_test.go b/api/v1alpha1/k8sgpt_types_test.go index 837a4196..323e6960 100644 --- a/api/v1alpha1/k8sgpt_types_test.go +++ b/api/v1alpha1/k8sgpt_types_test.go @@ -34,11 +34,12 @@ var _ = Describe("The test cases for the K8sGPT CRDs", func() { Key: "k8s-gpt", } - kind = "K8sGPT" - baseUrl = "https://api.k8s-gpt.localhost" - model = "345M" - version = "v1alpha1" - language = "english" + kind = "K8sGPT" + baseUrl = "https://api.k8s-gpt.localhost" + model = "345M" + repository = "ghcr.io/k8sgpt-ai/k8sgpt" + tag = "v1alpha1" + language = "english" Namespace = "k8sGPT" @@ -60,8 +61,10 @@ var _ = Describe("The test cases for the K8sGPT CRDs", func() { Anonymize: true, Language: language, }, - Version: version, - + Image: Image{ + Repository: repository, + Tag: tag, + }, NoCache: true, }, } @@ -84,8 +87,10 @@ var _ = Describe("The test cases for the K8sGPT CRDs", func() { Anonymize: false, Language: language, }, - Version: version, - + Image: Image{ + Repository: repository, + Tag: tag, + }, NoCache: false, }, } diff --git a/api/v1alpha1/zz_generated.deepcopy.go b/api/v1alpha1/zz_generated.deepcopy.go index f145463d..82c7c694 100644 --- a/api/v1alpha1/zz_generated.deepcopy.go +++ b/api/v1alpha1/zz_generated.deepcopy.go @@ -145,6 +145,21 @@ func (in *GCSBackend) DeepCopy() *GCSBackend { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Image) DeepCopyInto(out *Image) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Image. +func (in *Image) DeepCopy() *Image { + if in == nil { + return nil + } + out := new(Image) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Integrations) DeepCopyInto(out *Integrations) { *out = *in @@ -227,6 +242,7 @@ func (in *K8sGPTList) DeepCopyObject() runtime.Object { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *K8sGPTSpec) DeepCopyInto(out *K8sGPTSpec) { *out = *in + out.Image = in.Image if in.Filters != nil { in, out := &in.Filters, &out.Filters *out = make([]string, len(*in)) diff --git a/config/crd/bases/core.k8sgpt.ai_k8sgpts.yaml b/config/crd/bases/core.k8sgpt.ai_k8sgpts.yaml index 70517509..8d2366a5 100644 --- a/config/crd/bases/core.k8sgpt.ai_k8sgpts.yaml +++ b/config/crd/bases/core.k8sgpt.ai_k8sgpts.yaml @@ -81,6 +81,14 @@ spec: items: type: string type: array + image: + properties: + repository: + default: ghcr.io/k8sgpt-ai/k8gpt + type: string + tag: + type: string + type: object integrations: properties: trivy: @@ -135,8 +143,6 @@ spec: webhook: type: string type: object - version: - type: string type: object status: description: K8sGPTStatus defines the observed state of K8sGPT