Skip to content

Commit

Permalink
feat: add k8sgpt image repositoty and tag to k8sgpt crd
Browse files Browse the repository at this point in the history
feat: add default value
Signed-off-by: JuHyung-Son <[email protected]>
  • Loading branch information
JuHyung-Son committed Nov 21, 2023
1 parent 7fedf7c commit 0898941
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 12 deletions.
8 changes: 7 additions & 1 deletion api/v1alpha1/k8sgpt_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand Down
23 changes: 14 additions & 9 deletions api/v1alpha1/k8sgpt_types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand All @@ -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,
},
}
Expand All @@ -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,
},
}
Expand Down
16 changes: 16 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.

10 changes: 8 additions & 2 deletions config/crd/bases/core.k8sgpt.ai_k8sgpts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -135,8 +143,6 @@ spec:
webhook:
type: string
type: object
version:
type: string
type: object
status:
description: K8sGPTStatus defines the observed state of K8sGPT
Expand Down

0 comments on commit 0898941

Please sign in to comment.