From d36c6ffc34f78edb37c49d51a3b15e88c54146ef Mon Sep 17 00:00:00 2001 From: "jinle.xjl" Date: Tue, 5 Sep 2023 11:41:34 +0800 Subject: [PATCH] module controller 0.3 bugfix and unit test fix --- module-controller/Dockerfile | 2 +- .../crd/bases/serverless.alipay.com_moduledeployments.yaml | 4 ++-- .../samples/module-deployment_v1alpha1_moduledeployment.yaml | 2 +- module-controller/internal/controller/module_controller.go | 2 +- .../controller/moduledeployment_controller_suit_test.go | 4 ++-- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/module-controller/Dockerfile b/module-controller/Dockerfile index c389c0981..cab2a5b98 100644 --- a/module-controller/Dockerfile +++ b/module-controller/Dockerfile @@ -14,7 +14,7 @@ RUN go mod download # Copy the go source COPY cmd/main.go cmd/main.go COPY api/ api/ -COPY internal/controller/ internal/controller/ +COPY internal/ internal/ # Build # the GOARCH has not a default value to allow the binary be built according to the host where the command diff --git a/module-controller/config/crd/bases/serverless.alipay.com_moduledeployments.yaml b/module-controller/config/crd/bases/serverless.alipay.com_moduledeployments.yaml index 5b846483c..0d0370671 100644 --- a/module-controller/config/crd/bases/serverless.alipay.com_moduledeployments.yaml +++ b/module-controller/config/crd/bases/serverless.alipay.com_moduledeployments.yaml @@ -34,7 +34,7 @@ spec: spec: description: ModuleDeploymentSpec defines the desired state of ModuleDeployment properties: - BaseDeploymentName: + baseDeploymentName: description: 'INSERT ADDITIONAL SPEC FIELDS - desired state of cluster Important: Run "make" to regenerate code after modifying this file' type: string @@ -158,7 +158,7 @@ spec: type: object type: object required: - - BaseDeploymentName + - baseDeploymentName - deployType type: object status: diff --git a/module-controller/config/samples/module-deployment_v1alpha1_moduledeployment.yaml b/module-controller/config/samples/module-deployment_v1alpha1_moduledeployment.yaml index d65e78d73..c0a12791f 100644 --- a/module-controller/config/samples/module-deployment_v1alpha1_moduledeployment.yaml +++ b/module-controller/config/samples/module-deployment_v1alpha1_moduledeployment.yaml @@ -9,7 +9,7 @@ metadata: app.kubernetes.io/created-by: module-controller name: moduledeployment-sample spec: - baseAppName: dynamic-stock-deployment + baseDeploymentName: dynamic-stock-deployment template: spec: module: diff --git a/module-controller/internal/controller/module_controller.go b/module-controller/internal/controller/module_controller.go index 8e2c8f8ac..7fdb2e50a 100644 --- a/module-controller/internal/controller/module_controller.go +++ b/module-controller/internal/controller/module_controller.go @@ -146,7 +146,7 @@ func (r *ModuleReconciler) handleTerminatingModuleInstance(ctx context.Context, } // uninstall module - _, err = arklet.Client().UninstallBiz(ip, module.Spec.Module.Name, module.Name) + _, err = arklet.Client().UninstallBiz(ip, module.Spec.Module.Name, module.Spec.Module.Version) if err != nil { log.Log.Error(err, "Failed post module", "moduleName", module.Spec.Module.Name) return ctrl.Result{}, err diff --git a/module-controller/internal/controller/moduledeployment_controller_suit_test.go b/module-controller/internal/controller/moduledeployment_controller_suit_test.go index b624e9dad..168c791e4 100644 --- a/module-controller/internal/controller/moduledeployment_controller_suit_test.go +++ b/module-controller/internal/controller/moduledeployment_controller_suit_test.go @@ -92,11 +92,11 @@ var _ = Describe("ModuleDeployment Controller", func() { }) func prepareModuleDeployment(namespace, moduleDeploymentName string) v1alpha1.ModuleDeployment { - baseAppName := "dynamic-stock-deployment" + baseDeploymentName := "dynamic-stock-deployment" moduleDeployment := v1alpha1.ModuleDeployment{ Spec: v1alpha1.ModuleDeploymentSpec{ - BaseDeploymentName: baseAppName, + BaseDeploymentName: baseDeploymentName, Template: v1alpha1.ModuleTemplateSpec{ Spec: v1alpha1.ModuleSpec{ Module: v1alpha1.ModuleInfo{