From 7588db44e88ae412c7d341ac0ab92e04e68fb961 Mon Sep 17 00:00:00 2001 From: Peefy Date: Thu, 7 Nov 2024 10:14:43 +0800 Subject: [PATCH 1/2] test: add more krm-kcl resource test Signed-off-by: Peefy --- scripts/deploy_test.sh | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/scripts/deploy_test.sh b/scripts/deploy_test.sh index 6922908..da62219 100755 --- a/scripts/deploy_test.sh +++ b/scripts/deploy_test.sh @@ -72,4 +72,29 @@ EOF else echo -e "${RED}The annotation 'managed-by: kcl-operator' is not added to the pod.${NC}" fi + kubectl apply -f- << EOF +apiVersion: krm.kcl.dev/v1alpha1 +kind: KCLRun +metadata: + name: web-service + annotations: + krm.kcl.dev/version: 0.0.1 + krm.kcl.dev/type: abstraction + documentation: >- + Web service application abstraction +spec: + params: + name: app + containers: + nginx: + image: nginx + ports: + - containerPort: 80 + service: + ports: + - port: 80 + labels: + name: app + source: ./examples/abstraction/web-service/main.k +EOF fi From d0356410548459ccd962dd0b968ce996ecc2e305 Mon Sep 17 00:00:00 2001 From: Peefy Date: Thu, 7 Nov 2024 10:57:38 +0800 Subject: [PATCH 2/2] fix: run spec params definition Signed-off-by: Peefy --- api/kclrun/v1alpha1/kclrun_types.go | 2 +- api/kclrun/v1alpha1/zz_generated.deepcopy.go | 7 ------- config/crd/bases/krm.kcl.dev_kclruns.yaml | 4 +--- 3 files changed, 2 insertions(+), 11 deletions(-) diff --git a/api/kclrun/v1alpha1/kclrun_types.go b/api/kclrun/v1alpha1/kclrun_types.go index 8932b21..6fc80ef 100644 --- a/api/kclrun/v1alpha1/kclrun_types.go +++ b/api/kclrun/v1alpha1/kclrun_types.go @@ -32,7 +32,7 @@ type KCLRunSpec struct { // Source is a required field for providing a KCL script inline. Source string `json:"source" yaml:"source"` // Params are the parameters in key-value pairs format. - Params map[string]runtime.RawExtension `json:"params,omitempty" yaml:"params,omitempty"` + Params runtime.RawExtension `json:"params,omitempty" yaml:"params,omitempty"` } // KCLRunStatus defines the observed state of KCLRun diff --git a/api/kclrun/v1alpha1/zz_generated.deepcopy.go b/api/kclrun/v1alpha1/zz_generated.deepcopy.go index c8096f0..6729955 100644 --- a/api/kclrun/v1alpha1/zz_generated.deepcopy.go +++ b/api/kclrun/v1alpha1/zz_generated.deepcopy.go @@ -86,13 +86,6 @@ func (in *KCLRunList) DeepCopyObject() runtime.Object { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *KCLRunSpec) DeepCopyInto(out *KCLRunSpec) { *out = *in - if in.Params != nil { - in, out := &in.Params, &out.Params - *out = make(map[string]runtime.RawExtension, len(*in)) - for key, val := range *in { - (*out)[key] = *val.DeepCopy() - } - } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KCLRunSpec. diff --git a/config/crd/bases/krm.kcl.dev_kclruns.yaml b/config/crd/bases/krm.kcl.dev_kclruns.yaml index 5c9fcae..c721e30 100644 --- a/config/crd/bases/krm.kcl.dev_kclruns.yaml +++ b/config/crd/bases/krm.kcl.dev_kclruns.yaml @@ -40,11 +40,9 @@ spec: description: KCLRunSpec defines the desired state of KCLRun properties: params: - additionalProperties: - type: object - x-kubernetes-preserve-unknown-fields: true description: Params are the parameters in key-value pairs format. type: object + x-kubernetes-preserve-unknown-fields: true source: description: Source is a required field for providing a KCL script inline.