From 2d0713803e8101f798ceee417bdd46ebbc37f400 Mon Sep 17 00:00:00 2001 From: LiuLiqi <837397251@qq.com> Date: Mon, 23 Oct 2023 14:11:47 +0800 Subject: [PATCH 01/22] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=BC=A9=E5=AE=B9?= =?UTF-8?q?=E5=88=B00=E7=9A=84=E6=B5=8B=E8=AF=95=E7=94=A8=E4=BE=8Bworkflow?= =?UTF-8?q?=20file?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ..._build_deploy_then_scaledown_to_aliyun.yml | 164 ++++++++++++++++++ ...1_moduledeployment_provider_scaledown.yaml | 28 +++ 2 files changed, 192 insertions(+) create mode 100644 .github/workflows/module_controller_ci_build_deploy_then_scaledown_to_aliyun.yml create mode 100644 module-controller/config/samples/module-deployment_v1alpha1_moduledeployment_provider_scaledown.yaml diff --git a/.github/workflows/module_controller_ci_build_deploy_then_scaledown_to_aliyun.yml b/.github/workflows/module_controller_ci_build_deploy_then_scaledown_to_aliyun.yml new file mode 100644 index 000000000..d89349d71 --- /dev/null +++ b/.github/workflows/module_controller_ci_build_deploy_then_scaledown_to_aliyun.yml @@ -0,0 +1,164 @@ +name: Module Controller Integration Test +run-name: ${{ github.actor }} pushed module-controller code + +on: + push: + branches: + - master + paths: + - 'module-controller/**' + + pull_request: + branches: + - master + paths: + - 'module-controller/**' + + # enable manually running the workflow + workflow_dispatch: + +env: + CGO_ENABLED: 0 + GOOS: linux + WORK_DIR: module-controller + TAG: ci-test-master-latest + DOCKERHUB_REGISTRY: serverless-registry.cn-shanghai.cr.aliyuncs.com + MODULE_CONTROLLER_IMAGE_PATH: opensource/test/module-controller + INTEGRATION_TESTS_IMAGE_PATH: opensource/test/module-controller-integration-tests + POD_NAMESPACE: default + +defaults: + run: + working-directory: module-controller + +jobs: + unit-test: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Docker login + uses: docker/login-action@v2.2.0 + with: + registry: ${{ env.DOCKERHUB_REGISTRY }} + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_PASSWORD }} + logout: false + + - name: Set up Docker buildx + uses: docker/setup-buildx-action@v2 + + - name: Cache Docker layers + uses: actions/cache@v2 + with: + path: /tmp/.buildx-cache + key: ${{ runner.os }}-buildx-${{ hashFiles('${{ env.WORK_DIR }}/*Dockerfile') }} + + - name: Build and push module-controller Docker images + uses: docker/build-push-action@v4.1.1 + with: + context: ${{ env.WORK_DIR }} + cache-from: type=local,src=/tmp/.buildx-cache + cache-to: type=local,dest=/tmp/.buildx-cache + file: ${{ env.WORK_DIR }}/Dockerfile + platforms: linux/amd64 + push: true + tags: ${{ env.DOCKERHUB_REGISTRY }}/${{ env.MODULE_CONTROLLER_IMAGE_PATH }}:${{ env.TAG }} + + - run: sleep 30 + + - name: Set up Minikube + run: | + curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 + sudo install minikube-linux-amd64 /usr/local/bin/minikube + + - name: Start Minikube + run: minikube start + + - name: Prepare development env + run: | + kubectl apply -f config/crd/bases/serverless.alipay.com_moduledeployments.yaml + kubectl apply -f config/crd/bases/serverless.alipay.com_modulereplicasets.yaml + kubectl apply -f config/crd/bases/serverless.alipay.com_modules.yaml + kubectl apply -f config/crd/bases/serverless.alipay.com_moduletemplates.yaml + kubectl apply -f config/rbac/role.yaml + kubectl apply -f config/rbac/role_binding.yaml + kubectl apply -f config/rbac/service_account.yaml + kubectl apply -f config/samples/dynamic-stock-deployment.yaml + kubectl apply -f config/samples/module-deployment-controller.yaml + kubectl apply -f config/samples/dynamic-stock-service.yaml + + - run: sleep 60 + + - name: minikube logs + run: minikube logs + + - name: get pod + run: | + kubectl get pod + + - name: describe pod + run: | + kubectl describe pod + + - name: wait base pod available + run: | + kubectl wait --for=condition=available deployment/dynamic-stock-deployment --timeout=300s + + - name: get module controller pod available + run: | + kubectl wait --for=condition=available deployment/module-controller --timeout=300s + + - name: Apply moduledeployment + run: | + kubectl apply -f config/samples/module-deployment_v1alpha1_moduledeployment_provider.yaml + + - name: get moduledeployment + run: | + kubectl get moduledeployment + + - name: get modulereplicaset + run: | + kubectl get modulereplicaset + + - run: sleep 15 + + - name: get module + run: | + kubectl get module -oyaml + + - name: exist module + run: | + moduleCount=$(kubectl get module | wc -l) + if [[ $moduleCount -lt 1 ]]; then + echo "ERROR: 不存在module" + exit 1 + fi + + - name: check module + run: | + podname=$(kubectl get pod -l app=dynamic-stock -o name) + kubectl exec -it $podname -- sh -c 'ls -al' + kubectl exec -it $podname -- sh -c 'ls -al logs' + kubectl exec -it $podname -- sh -c 'ls -al logs/stock-mng' + kubectl exec -it $podname -- sh -c 'ls -al logs/stock-mng/sofa-ark' + kubectl exec -it $podname -- sh -c 'grep "dynamic-provider:1.0.0 started" logs/stock-mng/sofa-ark/*.log' + + - name: scaledown module + run: + kubectl apply -f config/samples/module-deployment_v1alpha1_moduledeployment_provider_scaledown.yaml + + - run: sleep 15 + + - name: get module + run: | + kubectl get module -oyaml + + - name: not exist module + run: | + moduleCount=$(kubectl get module | wc -l) + if [[ $moduleCount -gt 0 ]]; then + echo "ERROR: module依旧存在" + exit 1 + fi \ No newline at end of file diff --git a/module-controller/config/samples/module-deployment_v1alpha1_moduledeployment_provider_scaledown.yaml b/module-controller/config/samples/module-deployment_v1alpha1_moduledeployment_provider_scaledown.yaml new file mode 100644 index 000000000..634868de3 --- /dev/null +++ b/module-controller/config/samples/module-deployment_v1alpha1_moduledeployment_provider_scaledown.yaml @@ -0,0 +1,28 @@ +apiVersion: serverless.alipay.com/v1alpha1 +kind: ModuleDeployment +metadata: + labels: + app.kubernetes.io/name: moduledeployment + app.kubernetes.io/instance: moduledeployment-sample + app.kubernetes.io/part-of: module-controller + app.kubernetes.io/managed-by: kustomize + app.kubernetes.io/created-by: module-controller + name: moduledeployment-sample-provider +spec: + baseDeploymentName: dynamic-stock-deployment + template: + spec: + module: + name: dynamic-provider + version: '1.0.0' + url: http://serverless-opensource.oss-cn-shanghai.aliyuncs.com/module-packages/stable/dynamic-provider-1.0.0-ark-biz.jar + replicas: 0 + operationStrategy: + needConfirm: false + grayTimeBetweenBatchSeconds: 120 + useBeta: false + batchCount: 1 + upgradePolicy: install_then_uninstall + schedulingStrategy: + schedulingPolicy: scatter + From c245523e869dd5c0a3aff7e1497dccace8f89102 Mon Sep 17 00:00:00 2001 From: LiuLiqi <837397251@qq.com> Date: Mon, 23 Oct 2023 14:33:59 +0800 Subject: [PATCH 02/22] =?UTF-8?q?=E5=8E=9F=E5=A7=8Bci=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E7=BC=A9=E5=AE=B9=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ..._build_deploy_then_scaledown_to_aliyun.yml | 164 ------------------ ...e_controller_ci_build_deploy_to_aliyun.yml | 19 +- 2 files changed, 18 insertions(+), 165 deletions(-) delete mode 100644 .github/workflows/module_controller_ci_build_deploy_then_scaledown_to_aliyun.yml diff --git a/.github/workflows/module_controller_ci_build_deploy_then_scaledown_to_aliyun.yml b/.github/workflows/module_controller_ci_build_deploy_then_scaledown_to_aliyun.yml deleted file mode 100644 index d89349d71..000000000 --- a/.github/workflows/module_controller_ci_build_deploy_then_scaledown_to_aliyun.yml +++ /dev/null @@ -1,164 +0,0 @@ -name: Module Controller Integration Test -run-name: ${{ github.actor }} pushed module-controller code - -on: - push: - branches: - - master - paths: - - 'module-controller/**' - - pull_request: - branches: - - master - paths: - - 'module-controller/**' - - # enable manually running the workflow - workflow_dispatch: - -env: - CGO_ENABLED: 0 - GOOS: linux - WORK_DIR: module-controller - TAG: ci-test-master-latest - DOCKERHUB_REGISTRY: serverless-registry.cn-shanghai.cr.aliyuncs.com - MODULE_CONTROLLER_IMAGE_PATH: opensource/test/module-controller - INTEGRATION_TESTS_IMAGE_PATH: opensource/test/module-controller-integration-tests - POD_NAMESPACE: default - -defaults: - run: - working-directory: module-controller - -jobs: - unit-test: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Docker login - uses: docker/login-action@v2.2.0 - with: - registry: ${{ env.DOCKERHUB_REGISTRY }} - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_PASSWORD }} - logout: false - - - name: Set up Docker buildx - uses: docker/setup-buildx-action@v2 - - - name: Cache Docker layers - uses: actions/cache@v2 - with: - path: /tmp/.buildx-cache - key: ${{ runner.os }}-buildx-${{ hashFiles('${{ env.WORK_DIR }}/*Dockerfile') }} - - - name: Build and push module-controller Docker images - uses: docker/build-push-action@v4.1.1 - with: - context: ${{ env.WORK_DIR }} - cache-from: type=local,src=/tmp/.buildx-cache - cache-to: type=local,dest=/tmp/.buildx-cache - file: ${{ env.WORK_DIR }}/Dockerfile - platforms: linux/amd64 - push: true - tags: ${{ env.DOCKERHUB_REGISTRY }}/${{ env.MODULE_CONTROLLER_IMAGE_PATH }}:${{ env.TAG }} - - - run: sleep 30 - - - name: Set up Minikube - run: | - curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 - sudo install minikube-linux-amd64 /usr/local/bin/minikube - - - name: Start Minikube - run: minikube start - - - name: Prepare development env - run: | - kubectl apply -f config/crd/bases/serverless.alipay.com_moduledeployments.yaml - kubectl apply -f config/crd/bases/serverless.alipay.com_modulereplicasets.yaml - kubectl apply -f config/crd/bases/serverless.alipay.com_modules.yaml - kubectl apply -f config/crd/bases/serverless.alipay.com_moduletemplates.yaml - kubectl apply -f config/rbac/role.yaml - kubectl apply -f config/rbac/role_binding.yaml - kubectl apply -f config/rbac/service_account.yaml - kubectl apply -f config/samples/dynamic-stock-deployment.yaml - kubectl apply -f config/samples/module-deployment-controller.yaml - kubectl apply -f config/samples/dynamic-stock-service.yaml - - - run: sleep 60 - - - name: minikube logs - run: minikube logs - - - name: get pod - run: | - kubectl get pod - - - name: describe pod - run: | - kubectl describe pod - - - name: wait base pod available - run: | - kubectl wait --for=condition=available deployment/dynamic-stock-deployment --timeout=300s - - - name: get module controller pod available - run: | - kubectl wait --for=condition=available deployment/module-controller --timeout=300s - - - name: Apply moduledeployment - run: | - kubectl apply -f config/samples/module-deployment_v1alpha1_moduledeployment_provider.yaml - - - name: get moduledeployment - run: | - kubectl get moduledeployment - - - name: get modulereplicaset - run: | - kubectl get modulereplicaset - - - run: sleep 15 - - - name: get module - run: | - kubectl get module -oyaml - - - name: exist module - run: | - moduleCount=$(kubectl get module | wc -l) - if [[ $moduleCount -lt 1 ]]; then - echo "ERROR: 不存在module" - exit 1 - fi - - - name: check module - run: | - podname=$(kubectl get pod -l app=dynamic-stock -o name) - kubectl exec -it $podname -- sh -c 'ls -al' - kubectl exec -it $podname -- sh -c 'ls -al logs' - kubectl exec -it $podname -- sh -c 'ls -al logs/stock-mng' - kubectl exec -it $podname -- sh -c 'ls -al logs/stock-mng/sofa-ark' - kubectl exec -it $podname -- sh -c 'grep "dynamic-provider:1.0.0 started" logs/stock-mng/sofa-ark/*.log' - - - name: scaledown module - run: - kubectl apply -f config/samples/module-deployment_v1alpha1_moduledeployment_provider_scaledown.yaml - - - run: sleep 15 - - - name: get module - run: | - kubectl get module -oyaml - - - name: not exist module - run: | - moduleCount=$(kubectl get module | wc -l) - if [[ $moduleCount -gt 0 ]]; then - echo "ERROR: module依旧存在" - exit 1 - fi \ No newline at end of file diff --git a/.github/workflows/module_controller_ci_build_deploy_to_aliyun.yml b/.github/workflows/module_controller_ci_build_deploy_to_aliyun.yml index 277ff94b6..d89349d71 100644 --- a/.github/workflows/module_controller_ci_build_deploy_to_aliyun.yml +++ b/.github/workflows/module_controller_ci_build_deploy_to_aliyun.yml @@ -144,4 +144,21 @@ jobs: kubectl exec -it $podname -- sh -c 'ls -al logs/stock-mng' kubectl exec -it $podname -- sh -c 'ls -al logs/stock-mng/sofa-ark' kubectl exec -it $podname -- sh -c 'grep "dynamic-provider:1.0.0 started" logs/stock-mng/sofa-ark/*.log' - \ No newline at end of file + + - name: scaledown module + run: + kubectl apply -f config/samples/module-deployment_v1alpha1_moduledeployment_provider_scaledown.yaml + + - run: sleep 15 + + - name: get module + run: | + kubectl get module -oyaml + + - name: not exist module + run: | + moduleCount=$(kubectl get module | wc -l) + if [[ $moduleCount -gt 0 ]]; then + echo "ERROR: module依旧存在" + exit 1 + fi \ No newline at end of file From 3b2a931f270ddb2c0ad0cdc6967dc6ed0e30c818 Mon Sep 17 00:00:00 2001 From: LiuLiqi <837397251@qq.com> Date: Mon, 23 Oct 2023 14:41:43 +0800 Subject: [PATCH 03/22] =?UTF-8?q?=E5=8E=9F=E5=A7=8Bci=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E6=89=A9=E5=AE=B9=E9=80=BB=E8=BE=91=E5=92=8C=E7=9B=B4=E6=8E=A5?= =?UTF-8?q?=E5=88=A0=E9=99=A4pod=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...e_controller_ci_build_deploy_to_aliyun.yml | 55 +++++++++++++++++-- 1 file changed, 51 insertions(+), 4 deletions(-) diff --git a/.github/workflows/module_controller_ci_build_deploy_to_aliyun.yml b/.github/workflows/module_controller_ci_build_deploy_to_aliyun.yml index d89349d71..66e297e52 100644 --- a/.github/workflows/module_controller_ci_build_deploy_to_aliyun.yml +++ b/.github/workflows/module_controller_ci_build_deploy_to_aliyun.yml @@ -151,14 +151,61 @@ jobs: - run: sleep 15 + - name: not exist module + run: | + moduleCount=$(kubectl get module | wc -l) + if [[ $moduleCount -gt 0 ]]; then + echo "ERROR: module依旧存在" + exit 1 + fi + + - name: Apply moduledeployment scaleup module + run: | + kubectl apply -f config/samples/module-deployment_v1alpha1_moduledeployment_provider.yaml + + - name: get moduledeployment + run: | + kubectl get moduledeployment + + - name: get modulereplicaset + run: | + kubectl get modulereplicaset + + - run: sleep 15 + - name: get module run: | kubectl get module -oyaml - - name: not exist module + - name: exist module run: | moduleCount=$(kubectl get module | wc -l) - if [[ $moduleCount -gt 0 ]]; then - echo "ERROR: module依旧存在" + if [[ $moduleCount -lt 1 ]]; then + echo "ERROR: 不存在module" exit 1 - fi \ No newline at end of file + fi + + - name: scaleup then check module + run: | + podname=$(kubectl get pod -l app=dynamic-stock -o name) + kubectl exec -it $podname -- sh -c 'ls -al' + kubectl exec -it $podname -- sh -c 'ls -al logs' + kubectl exec -it $podname -- sh -c 'ls -al logs/stock-mng' + kubectl exec -it $podname -- sh -c 'ls -al logs/stock-mng/sofa-ark' + kubectl exec -it $podname -- sh -c 'grep "dynamic-provider:1.0.0 started" logs/stock-mng/sofa-ark/*.log' + + - name: delete pod + run: | + podname=$(kubectl get pod -l app=dynamic-stock -o name) + kubectl delete pod $podname + + - run: sleep 30 + + - name: check module + run: | + podname=$(kubectl get pod -l app=dynamic-stock -o name) + kubectl exec -it $podname -- sh -c 'ls -al' + kubectl exec -it $podname -- sh -c 'ls -al logs' + kubectl exec -it $podname -- sh -c 'ls -al logs/stock-mng' + kubectl exec -it $podname -- sh -c 'ls -al logs/stock-mng/sofa-ark' + kubectl exec -it $podname -- sh -c 'grep "dynamic-provider:1.0.0 started" logs/stock-mng/sofa-ark/*.log' From 5b10a58804a7e5c594600665e7d21c2a877d521d Mon Sep 17 00:00:00 2001 From: LiuLiqi <837397251@qq.com> Date: Mon, 23 Oct 2023 14:52:25 +0800 Subject: [PATCH 04/22] =?UTF-8?q?=E5=8E=9F=E5=A7=8Bci=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E6=89=A9=E5=AE=B9=E9=80=BB=E8=BE=91=E5=92=8C=E7=9B=B4=E6=8E=A5?= =?UTF-8?q?=E5=88=A0=E9=99=A4pod=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../workflows/module_controller_ci_build_deploy_to_aliyun.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/module_controller_ci_build_deploy_to_aliyun.yml b/.github/workflows/module_controller_ci_build_deploy_to_aliyun.yml index 66e297e52..d74103e18 100644 --- a/.github/workflows/module_controller_ci_build_deploy_to_aliyun.yml +++ b/.github/workflows/module_controller_ci_build_deploy_to_aliyun.yml @@ -197,7 +197,7 @@ jobs: - name: delete pod run: | podname=$(kubectl get pod -l app=dynamic-stock -o name) - kubectl delete pod $podname + kubectl delete -n default pod $podname - run: sleep 30 From 888a3c344aea16a9e2a5f185f9d888b846dd0fd5 Mon Sep 17 00:00:00 2001 From: LiuLiqi <837397251@qq.com> Date: Mon, 23 Oct 2023 15:03:14 +0800 Subject: [PATCH 05/22] =?UTF-8?q?shell=E8=84=9A=E6=9C=ACfix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...e_controller_ci_build_deploy_to_aliyun.yml | 28 ++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/.github/workflows/module_controller_ci_build_deploy_to_aliyun.yml b/.github/workflows/module_controller_ci_build_deploy_to_aliyun.yml index d74103e18..414394000 100644 --- a/.github/workflows/module_controller_ci_build_deploy_to_aliyun.yml +++ b/.github/workflows/module_controller_ci_build_deploy_to_aliyun.yml @@ -196,7 +196,7 @@ jobs: - name: delete pod run: | - podname=$(kubectl get pod -l app=dynamic-stock -o name) + podname=$(kubectl get pod -l app=dynamic-stock -o name | cut -d/ -f2) kubectl delete -n default pod $podname - run: sleep 30 @@ -209,3 +209,29 @@ jobs: kubectl exec -it $podname -- sh -c 'ls -al logs/stock-mng' kubectl exec -it $podname -- sh -c 'ls -al logs/stock-mng/sofa-ark' kubectl exec -it $podname -- sh -c 'grep "dynamic-provider:1.0.0 started" logs/stock-mng/sofa-ark/*.log' + + - name: delete module + run: | + moduleName=$(kubectl get module -o name | cut -d/ -f2) + kubectl delete -n default module $moduleName + + - run: sleep 30 + + - name: delete module then check module is existed + run: | + moduleCount=$(kubectl get module | wc -l) + if [[ $moduleCount -lt 1 ]]; then + echo "ERROR: 不存在module" + exit 1 + fi + + - run: sleep 15 + + - name: delete module then check module + run: | + podname=$(kubectl get pod -l app=dynamic-stock -o name) + kubectl exec -it $podname -- sh -c 'ls -al' + kubectl exec -it $podname -- sh -c 'ls -al logs' + kubectl exec -it $podname -- sh -c 'ls -al logs/stock-mng' + kubectl exec -it $podname -- sh -c 'ls -al logs/stock-mng/sofa-ark' + kubectl exec -it $podname -- sh -c 'grep "dynamic-provider:1.0.0 started" logs/stock-mng/sofa-ark/*.log' From fb083fa521b3c34c39ea15a9afe2ec497947a588 Mon Sep 17 00:00:00 2001 From: LiuLiqi <837397251@qq.com> Date: Mon, 23 Oct 2023 15:27:30 +0800 Subject: [PATCH 06/22] =?UTF-8?q?shell=E8=84=9A=E6=9C=ACfix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...dule_controller_ci_build_deploy_to_aliyun.yml | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/.github/workflows/module_controller_ci_build_deploy_to_aliyun.yml b/.github/workflows/module_controller_ci_build_deploy_to_aliyun.yml index 414394000..0a5738d33 100644 --- a/.github/workflows/module_controller_ci_build_deploy_to_aliyun.yml +++ b/.github/workflows/module_controller_ci_build_deploy_to_aliyun.yml @@ -199,9 +199,21 @@ jobs: podname=$(kubectl get pod -l app=dynamic-stock -o name | cut -d/ -f2) kubectl delete -n default pod $podname - - run: sleep 30 + - run: sleep 15 - - name: check module + - name: get pod + run: | + kubectl get pod + + - name: describe pod + run: | + kubectl describe pod + + - name: wait base pod available + run: | + kubectl wait --for=condition=available deployment/dynamic-stock-deployment --timeout=300s + + - name: delete pod then check module run: | podname=$(kubectl get pod -l app=dynamic-stock -o name) kubectl exec -it $podname -- sh -c 'ls -al' From 98b346d491bc603978ecffb984152222c8ea8996 Mon Sep 17 00:00:00 2001 From: LiuLiqi <837397251@qq.com> Date: Mon, 23 Oct 2023 15:36:29 +0800 Subject: [PATCH 07/22] =?UTF-8?q?shell=E8=84=9A=E6=9C=ACfix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...e_controller_ci_build_deploy_to_aliyun.yml | 52 ++++++++++--------- 1 file changed, 27 insertions(+), 25 deletions(-) diff --git a/.github/workflows/module_controller_ci_build_deploy_to_aliyun.yml b/.github/workflows/module_controller_ci_build_deploy_to_aliyun.yml index 0a5738d33..da03c70db 100644 --- a/.github/workflows/module_controller_ci_build_deploy_to_aliyun.yml +++ b/.github/workflows/module_controller_ci_build_deploy_to_aliyun.yml @@ -194,6 +194,32 @@ jobs: kubectl exec -it $podname -- sh -c 'ls -al logs/stock-mng/sofa-ark' kubectl exec -it $podname -- sh -c 'grep "dynamic-provider:1.0.0 started" logs/stock-mng/sofa-ark/*.log' + - name: delete module + run: | + moduleName=$(kubectl get module -o name | cut -d/ -f2) + kubectl delete -n default module $moduleName + + - run: sleep 30 + + - name: delete module then check module is existed + run: | + moduleCount=$(kubectl get module | wc -l) + if [[ $moduleCount -lt 1 ]]; then + echo "ERROR: 不存在module" + exit 1 + fi + + - run: sleep 30 + + - name: delete module then check module + run: | + podname=$(kubectl get pod -l app=dynamic-stock -o name) + kubectl exec -it $podname -- sh -c 'ls -al' + kubectl exec -it $podname -- sh -c 'ls -al logs' + kubectl exec -it $podname -- sh -c 'ls -al logs/stock-mng' + kubectl exec -it $podname -- sh -c 'ls -al logs/stock-mng/sofa-ark' + kubectl exec -it $podname -- sh -c 'grep "dynamic-provider:1.0.0 started" logs/stock-mng/sofa-ark/*.log' + - name: delete pod run: | podname=$(kubectl get pod -l app=dynamic-stock -o name | cut -d/ -f2) @@ -213,33 +239,9 @@ jobs: run: | kubectl wait --for=condition=available deployment/dynamic-stock-deployment --timeout=300s - - name: delete pod then check module - run: | - podname=$(kubectl get pod -l app=dynamic-stock -o name) - kubectl exec -it $podname -- sh -c 'ls -al' - kubectl exec -it $podname -- sh -c 'ls -al logs' - kubectl exec -it $podname -- sh -c 'ls -al logs/stock-mng' - kubectl exec -it $podname -- sh -c 'ls -al logs/stock-mng/sofa-ark' - kubectl exec -it $podname -- sh -c 'grep "dynamic-provider:1.0.0 started" logs/stock-mng/sofa-ark/*.log' - - - name: delete module - run: | - moduleName=$(kubectl get module -o name | cut -d/ -f2) - kubectl delete -n default module $moduleName - - run: sleep 30 - - name: delete module then check module is existed - run: | - moduleCount=$(kubectl get module | wc -l) - if [[ $moduleCount -lt 1 ]]; then - echo "ERROR: 不存在module" - exit 1 - fi - - - run: sleep 15 - - - name: delete module then check module + - name: delete pod then check module run: | podname=$(kubectl get pod -l app=dynamic-stock -o name) kubectl exec -it $podname -- sh -c 'ls -al' From 504885352953ac9f8d4dc9f85a8fe500a02ecae2 Mon Sep 17 00:00:00 2001 From: LiuLiqi <837397251@qq.com> Date: Wed, 1 Nov 2023 15:46:34 +0800 Subject: [PATCH 08/22] add wait module available --- ...e_controller_ci_build_deploy_to_aliyun.yml | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/.github/workflows/module_controller_ci_build_deploy_to_aliyun.yml b/.github/workflows/module_controller_ci_build_deploy_to_aliyun.yml index da03c70db..27cbeeb62 100644 --- a/.github/workflows/module_controller_ci_build_deploy_to_aliyun.yml +++ b/.github/workflows/module_controller_ci_build_deploy_to_aliyun.yml @@ -136,6 +136,37 @@ jobs: exit 1 fi + - name: wait module available + run: | + # 定义要等待的资源名称和字段值 + modulename=$(kubectl get module -o name) + desired_field_value="Available" + + # 定义等待的超时时间(以秒为单位) + timeout_seconds=300 + + start_time=$(date +%s) + end_time=$((start_time + timeout_seconds)) + + while true; do + current_time=$(date +%s) + if [ $current_time -gt $end_time ]; then + echo "等待超时" + exit 1 + fi + + # 使用 kubectl get 命令获取资源对象的详细信息,并提取自定义字段的值 + field_value=$(kubectl get $modulename -o jsonpath='{.status.Status}') + + if [ "$field_value" == "$desired_field_value" ]; then + echo "字段值已满足条件" + exit 0 + else + echo "等待字段值满足条件..." + sleep 5 # 等待一段时间后再次检查 + fi + done + - name: check module run: | podname=$(kubectl get pod -l app=dynamic-stock -o name) From bb61e37f5ee622ca778db3169cae34f19d51d219 Mon Sep 17 00:00:00 2001 From: LiuLiqi <837397251@qq.com> Date: Wed, 1 Nov 2023 15:49:58 +0800 Subject: [PATCH 09/22] =?UTF-8?q?=E6=A0=BC=E5=BC=8F=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...e_controller_ci_build_deploy_to_aliyun.yml | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/.github/workflows/module_controller_ci_build_deploy_to_aliyun.yml b/.github/workflows/module_controller_ci_build_deploy_to_aliyun.yml index 27cbeeb62..e23a73608 100644 --- a/.github/workflows/module_controller_ci_build_deploy_to_aliyun.yml +++ b/.github/workflows/module_controller_ci_build_deploy_to_aliyun.yml @@ -149,22 +149,22 @@ jobs: end_time=$((start_time + timeout_seconds)) while true; do - current_time=$(date +%s) - if [ $current_time -gt $end_time ]; then - echo "等待超时" - exit 1 - fi - - # 使用 kubectl get 命令获取资源对象的详细信息,并提取自定义字段的值 - field_value=$(kubectl get $modulename -o jsonpath='{.status.Status}') - - if [ "$field_value" == "$desired_field_value" ]; then - echo "字段值已满足条件" - exit 0 - else - echo "等待字段值满足条件..." - sleep 5 # 等待一段时间后再次检查 - fi + current_time=$(date +%s) + if [ $current_time -gt $end_time ]; then + echo "等待超时" + exit 1 + fi + + # 使用 kubectl get 命令获取资源对象的详细信息,并提取自定义字段的值 + field_value=$(kubectl get $modulename -o jsonpath='{.status.Status}') + + if [ "$field_value" == "$desired_field_value" ]; then + echo "字段值已满足条件" + exit 0 + else + echo "等待字段值满足条件..." + sleep 5 # 等待一段时间后再次检查 + fi done - name: check module From 7a5f1d9ee839fd7101dbee3870632f391ea8a7a5 Mon Sep 17 00:00:00 2001 From: LiuLiqi <837397251@qq.com> Date: Wed, 1 Nov 2023 15:59:29 +0800 Subject: [PATCH 10/22] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=91=BD=E4=BB=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../workflows/module_controller_ci_build_deploy_to_aliyun.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/module_controller_ci_build_deploy_to_aliyun.yml b/.github/workflows/module_controller_ci_build_deploy_to_aliyun.yml index e23a73608..cc57b01f1 100644 --- a/.github/workflows/module_controller_ci_build_deploy_to_aliyun.yml +++ b/.github/workflows/module_controller_ci_build_deploy_to_aliyun.yml @@ -156,7 +156,7 @@ jobs: fi # 使用 kubectl get 命令获取资源对象的详细信息,并提取自定义字段的值 - field_value=$(kubectl get $modulename -o jsonpath='{.status.Status}') + field_value=$(kubectl get $modulename -o custom-columns=STATUS:.status.status) if [ "$field_value" == "$desired_field_value" ]; then echo "字段值已满足条件" From 60b4b8fdb6cb24aba0d806f2f2e4df7ab1e0c07d Mon Sep 17 00:00:00 2001 From: LiuLiqi <837397251@qq.com> Date: Wed, 1 Nov 2023 16:01:13 +0800 Subject: [PATCH 11/22] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=91=BD=E4=BB=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../workflows/module_controller_ci_build_deploy_to_aliyun.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/module_controller_ci_build_deploy_to_aliyun.yml b/.github/workflows/module_controller_ci_build_deploy_to_aliyun.yml index cc57b01f1..3aa89b715 100644 --- a/.github/workflows/module_controller_ci_build_deploy_to_aliyun.yml +++ b/.github/workflows/module_controller_ci_build_deploy_to_aliyun.yml @@ -156,7 +156,7 @@ jobs: fi # 使用 kubectl get 命令获取资源对象的详细信息,并提取自定义字段的值 - field_value=$(kubectl get $modulename -o custom-columns=STATUS:.status.status) + field_value=$(kubectl get $modulename -o custom-columns=STATUS:.status.status --no-headers) if [ "$field_value" == "$desired_field_value" ]; then echo "字段值已满足条件" From b0fef301141a5c4d48c27586a7b5d0c9e7c1b85f Mon Sep 17 00:00:00 2001 From: LiuLiqi <837397251@qq.com> Date: Wed, 1 Nov 2023 16:41:21 +0800 Subject: [PATCH 12/22] =?UTF-8?q?=E6=B7=BB=E5=8A=A0Deployment=E8=B5=84?= =?UTF-8?q?=E6=BA=90=E5=88=A0=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...e_controller_ci_build_deploy_to_aliyun.yml | 136 +++++++++++++++++- 1 file changed, 134 insertions(+), 2 deletions(-) diff --git a/.github/workflows/module_controller_ci_build_deploy_to_aliyun.yml b/.github/workflows/module_controller_ci_build_deploy_to_aliyun.yml index 3aa89b715..68ed94468 100644 --- a/.github/workflows/module_controller_ci_build_deploy_to_aliyun.yml +++ b/.github/workflows/module_controller_ci_build_deploy_to_aliyun.yml @@ -216,6 +216,37 @@ jobs: exit 1 fi + - name: scaleup then wait module available + run: | + # 定义要等待的资源名称和字段值 + modulename=$(kubectl get module -o name) + desired_field_value="Available" + + # 定义等待的超时时间(以秒为单位) + timeout_seconds=300 + + start_time=$(date +%s) + end_time=$((start_time + timeout_seconds)) + + while true; do + current_time=$(date +%s) + if [ $current_time -gt $end_time ]; then + echo "等待超时" + exit 1 + fi + + # 使用 kubectl get 命令获取资源对象的详细信息,并提取自定义字段的值 + field_value=$(kubectl get $modulename -o custom-columns=STATUS:.status.status --no-headers) + + if [ "$field_value" == "$desired_field_value" ]; then + echo "字段值已满足条件" + exit 0 + else + echo "等待字段值满足条件..." + sleep 5 # 等待一段时间后再次检查 + fi + done + - name: scaleup then check module run: | podname=$(kubectl get pod -l app=dynamic-stock -o name) @@ -240,7 +271,36 @@ jobs: exit 1 fi - - run: sleep 30 + - name: delete then wait module available + run: | + # 定义要等待的资源名称和字段值 + modulename=$(kubectl get module -o name) + desired_field_value="Available" + + # 定义等待的超时时间(以秒为单位) + timeout_seconds=300 + + start_time=$(date +%s) + end_time=$((start_time + timeout_seconds)) + + while true; do + current_time=$(date +%s) + if [ $current_time -gt $end_time ]; then + echo "等待超时" + exit 1 + fi + + # 使用 kubectl get 命令获取资源对象的详细信息,并提取自定义字段的值 + field_value=$(kubectl get $modulename -o custom-columns=STATUS:.status.status --no-headers) + + if [ "$field_value" == "$desired_field_value" ]; then + echo "字段值已满足条件" + exit 0 + else + echo "等待字段值满足条件..." + sleep 5 # 等待一段时间后再次检查 + fi + done - name: delete module then check module run: | @@ -270,7 +330,36 @@ jobs: run: | kubectl wait --for=condition=available deployment/dynamic-stock-deployment --timeout=300s - - run: sleep 30 + - name: delete pod then wait module available + run: | + # 定义要等待的资源名称和字段值 + modulename=$(kubectl get module -o name) + desired_field_value="Available" + + # 定义等待的超时时间(以秒为单位) + timeout_seconds=300 + + start_time=$(date +%s) + end_time=$((start_time + timeout_seconds)) + + while true; do + current_time=$(date +%s) + if [ $current_time -gt $end_time ]; then + echo "等待超时" + exit 1 + fi + + # 使用 kubectl get 命令获取资源对象的详细信息,并提取自定义字段的值 + field_value=$(kubectl get $modulename -o custom-columns=STATUS:.status.status --no-headers) + + if [ "$field_value" == "$desired_field_value" ]; then + echo "字段值已满足条件" + exit 0 + else + echo "等待字段值满足条件..." + sleep 5 # 等待一段时间后再次检查 + fi + done - name: delete pod then check module run: | @@ -280,3 +369,46 @@ jobs: kubectl exec -it $podname -- sh -c 'ls -al logs/stock-mng' kubectl exec -it $podname -- sh -c 'ls -al logs/stock-mng/sofa-ark' kubectl exec -it $podname -- sh -c 'grep "dynamic-provider:1.0.0 started" logs/stock-mng/sofa-ark/*.log' + + - name: delete deployment + run: | + deploymentname=$(kubectl get deployment -o name | cut -d/ -f2) + kubectl delete -n default deployment $deploymentname + + - name: delete deployment then wait source clean + run: | + timeout_seconds=300 + start_time=$(date +%s) + end_time=$((start_time + timeout_seconds)) + + while true; do + current_time=$(date +%s) + if [ $current_time -gt $end_time ]; then + echo "等待超时" + exit 1 + fi + + moduleCount=$(kubectl get module | wc -l) + moduleReplicaSetCount=$(kubectl get moduleReplicaSet | wc -l) + moduleDeploymentCount=$(kubectl get moduleDeployment | wc -l) + deploymentCount=$(kubectl get deployment | wc -l) + + if [[ $deploymentCount -lt 1 && $moduleCount -lt 1 && $moduleReplicaSetCount -lt 1 && $moduleDeploymentCount -lt 1 ]]; then + echo "所有资源已删除" + exit 0 + else + if [[ $moduleCount -ge 1 ]]; then + echo "等待module删除..." + fi + if [[ $moduleReplicaSetCount -ge 1 ]]; then + echo "等待moduleReplicaSet删除..." + fi + if [[ $moduleDeploymentCount -ge 1 ]]; then + echo "等待moduleDeployment删除..." + fi + if [[ $deploymentCount -ge 1 ]]; then + echo "等待deployment删除..." + fi + sleep 5 + fi + done \ No newline at end of file From 93852d79ac2544da4a3fe3d647e2e31e41024dee Mon Sep 17 00:00:00 2001 From: LiuLiqi <837397251@qq.com> Date: Thu, 2 Nov 2023 09:12:11 +0800 Subject: [PATCH 13/22] =?UTF-8?q?=E6=B7=BB=E5=8A=A0sleep=E7=AD=89=E5=BE=85?= =?UTF-8?q?=E8=B5=84=E6=BA=90=E8=B0=83=E5=92=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../workflows/module_controller_ci_build_deploy_to_aliyun.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/module_controller_ci_build_deploy_to_aliyun.yml b/.github/workflows/module_controller_ci_build_deploy_to_aliyun.yml index 68ed94468..57d8420d7 100644 --- a/.github/workflows/module_controller_ci_build_deploy_to_aliyun.yml +++ b/.github/workflows/module_controller_ci_build_deploy_to_aliyun.yml @@ -330,6 +330,8 @@ jobs: run: | kubectl wait --for=condition=available deployment/dynamic-stock-deployment --timeout=300s + - run: sleep 15 + - name: delete pod then wait module available run: | # 定义要等待的资源名称和字段值 @@ -375,6 +377,8 @@ jobs: deploymentname=$(kubectl get deployment -o name | cut -d/ -f2) kubectl delete -n default deployment $deploymentname + - run: sleep 10 + - name: delete deployment then wait source clean run: | timeout_seconds=300 From 00613f8840dd1871c6b05baa41379ecda3f5aa1e Mon Sep 17 00:00:00 2001 From: LiuLiqi <837397251@qq.com> Date: Thu, 2 Nov 2023 09:26:58 +0800 Subject: [PATCH 14/22] =?UTF-8?q?fix=E5=88=A0=E9=99=A4module-controller?= =?UTF-8?q?=E7=9A=84Deployment?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../module_controller_ci_build_deploy_to_aliyun.yml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/.github/workflows/module_controller_ci_build_deploy_to_aliyun.yml b/.github/workflows/module_controller_ci_build_deploy_to_aliyun.yml index 57d8420d7..904849fa3 100644 --- a/.github/workflows/module_controller_ci_build_deploy_to_aliyun.yml +++ b/.github/workflows/module_controller_ci_build_deploy_to_aliyun.yml @@ -374,8 +374,7 @@ jobs: - name: delete deployment run: | - deploymentname=$(kubectl get deployment -o name | cut -d/ -f2) - kubectl delete -n default deployment $deploymentname + kubectl delete -n default deployment dynamic-stock-deployment - run: sleep 10 @@ -392,10 +391,10 @@ jobs: exit 1 fi - moduleCount=$(kubectl get module | wc -l) - moduleReplicaSetCount=$(kubectl get moduleReplicaSet | wc -l) - moduleDeploymentCount=$(kubectl get moduleDeployment | wc -l) - deploymentCount=$(kubectl get deployment | wc -l) + moduleCount=$(kubectl get -n default module | wc -l) + moduleReplicaSetCount=$(kubectl get -n default moduleReplicaSet | wc -l) + moduleDeploymentCount=$(kubectl get -n default moduleDeployment | wc -l) + deploymentCount=$(kubectl get -n default deployment dynamic-stock-deployment | wc -l) if [[ $deploymentCount -lt 1 && $moduleCount -lt 1 && $moduleReplicaSetCount -lt 1 && $moduleDeploymentCount -lt 1 ]]; then echo "所有资源已删除" From dbb441e6742d2ae4fc6c1d01b0afc522766c85cb Mon Sep 17 00:00:00 2001 From: LiuLiqi <837397251@qq.com> Date: Thu, 2 Nov 2023 09:45:11 +0800 Subject: [PATCH 15/22] add log --- .../module_controller_ci_build_deploy_to_aliyun.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.github/workflows/module_controller_ci_build_deploy_to_aliyun.yml b/.github/workflows/module_controller_ci_build_deploy_to_aliyun.yml index 904849fa3..c4ae6bf50 100644 --- a/.github/workflows/module_controller_ci_build_deploy_to_aliyun.yml +++ b/.github/workflows/module_controller_ci_build_deploy_to_aliyun.yml @@ -378,6 +378,12 @@ jobs: - run: sleep 10 + - name: get source + run: | + kubectl get -n default module + kubectl get -n default moduleReplicaSet + kubectl get -n default moduleDeployment + - name: delete deployment then wait source clean run: | timeout_seconds=300 @@ -396,6 +402,11 @@ jobs: moduleDeploymentCount=$(kubectl get -n default moduleDeployment | wc -l) deploymentCount=$(kubectl get -n default deployment dynamic-stock-deployment | wc -l) + echo deploymentCount is $deploymentCount + echo moduleDeploymentCount is $moduleDeploymentCount + echo moduleReplicaSetCount is $moduleReplicaSetCount + echo moduleCount is $moduleCount + if [[ $deploymentCount -lt 1 && $moduleCount -lt 1 && $moduleReplicaSetCount -lt 1 && $moduleDeploymentCount -lt 1 ]]; then echo "所有资源已删除" exit 0 From 2e6e89baa85eaf7d70e53bff5fad2355aa450e21 Mon Sep 17 00:00:00 2001 From: LiuLiqi <837397251@qq.com> Date: Thu, 2 Nov 2023 09:58:57 +0800 Subject: [PATCH 16/22] add log --- .../workflows/module_controller_ci_build_deploy_to_aliyun.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/module_controller_ci_build_deploy_to_aliyun.yml b/.github/workflows/module_controller_ci_build_deploy_to_aliyun.yml index c4ae6bf50..70efc0fa7 100644 --- a/.github/workflows/module_controller_ci_build_deploy_to_aliyun.yml +++ b/.github/workflows/module_controller_ci_build_deploy_to_aliyun.yml @@ -384,6 +384,10 @@ jobs: kubectl get -n default moduleReplicaSet kubectl get -n default moduleDeployment + - name: get source + run: | + kubectl logs module-controller + - name: delete deployment then wait source clean run: | timeout_seconds=300 From a07bd67fb23f851d26301484a34060474957f871 Mon Sep 17 00:00:00 2001 From: LiuLiqi <837397251@qq.com> Date: Thu, 2 Nov 2023 10:17:34 +0800 Subject: [PATCH 17/22] fix log pod --- .../module_controller_ci_build_deploy_to_aliyun.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/module_controller_ci_build_deploy_to_aliyun.yml b/.github/workflows/module_controller_ci_build_deploy_to_aliyun.yml index 70efc0fa7..3e0515731 100644 --- a/.github/workflows/module_controller_ci_build_deploy_to_aliyun.yml +++ b/.github/workflows/module_controller_ci_build_deploy_to_aliyun.yml @@ -261,7 +261,7 @@ jobs: moduleName=$(kubectl get module -o name | cut -d/ -f2) kubectl delete -n default module $moduleName - - run: sleep 30 + - run: sleep 10 - name: delete module then check module is existed run: | @@ -384,9 +384,10 @@ jobs: kubectl get -n default moduleReplicaSet kubectl get -n default moduleDeployment - - name: get source + - name: log module-controller run: | - kubectl logs module-controller + podname=&(kubectl get po -l app=module-controller -o name) + kubectl logs &podname - name: delete deployment then wait source clean run: | From 055ddb06de95e9e59eeabd12e8aaae3fe7576a24 Mon Sep 17 00:00:00 2001 From: LiuLiqi <837397251@qq.com> Date: Thu, 2 Nov 2023 10:49:53 +0800 Subject: [PATCH 18/22] fix log pod --- .../workflows/module_controller_ci_build_deploy_to_aliyun.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/module_controller_ci_build_deploy_to_aliyun.yml b/.github/workflows/module_controller_ci_build_deploy_to_aliyun.yml index 3e0515731..6e7747465 100644 --- a/.github/workflows/module_controller_ci_build_deploy_to_aliyun.yml +++ b/.github/workflows/module_controller_ci_build_deploy_to_aliyun.yml @@ -386,7 +386,7 @@ jobs: - name: log module-controller run: | - podname=&(kubectl get po -l app=module-controller -o name) + podname=&(kubectl get po -l app=module-controller -o name | cut -d/ -f2) kubectl logs &podname - name: delete deployment then wait source clean From f10d4a74448d1597c2f12ca9ae72fec89f0917fb Mon Sep 17 00:00:00 2001 From: LiuLiqi <837397251@qq.com> Date: Thu, 2 Nov 2023 11:19:00 +0800 Subject: [PATCH 19/22] bug fix & to $ --- .../workflows/module_controller_ci_build_deploy_to_aliyun.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/module_controller_ci_build_deploy_to_aliyun.yml b/.github/workflows/module_controller_ci_build_deploy_to_aliyun.yml index 6e7747465..3c8d5d243 100644 --- a/.github/workflows/module_controller_ci_build_deploy_to_aliyun.yml +++ b/.github/workflows/module_controller_ci_build_deploy_to_aliyun.yml @@ -386,8 +386,8 @@ jobs: - name: log module-controller run: | - podname=&(kubectl get po -l app=module-controller -o name | cut -d/ -f2) - kubectl logs &podname + podname=$(kubectl get po -l app=module-controller -o name) + kubectl logs $podname - name: delete deployment then wait source clean run: | From 74c4505f633c80ccc5cbe5491e5d4b14544f3501 Mon Sep 17 00:00:00 2001 From: LiuLiqi <837397251@qq.com> Date: Thu, 2 Nov 2023 11:34:57 +0800 Subject: [PATCH 20/22] =?UTF-8?q?=E6=9C=80=E5=90=8E=E5=85=88=E7=BC=A9?= =?UTF-8?q?=E5=AE=B9=E5=86=8D=E5=88=A0=E9=99=A4Deployment?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...e_controller_ci_build_deploy_to_aliyun.yml | 35 +++++++++++++++---- 1 file changed, 29 insertions(+), 6 deletions(-) diff --git a/.github/workflows/module_controller_ci_build_deploy_to_aliyun.yml b/.github/workflows/module_controller_ci_build_deploy_to_aliyun.yml index 3c8d5d243..cfd7dcacd 100644 --- a/.github/workflows/module_controller_ci_build_deploy_to_aliyun.yml +++ b/.github/workflows/module_controller_ci_build_deploy_to_aliyun.yml @@ -372,18 +372,41 @@ jobs: kubectl exec -it $podname -- sh -c 'ls -al logs/stock-mng/sofa-ark' kubectl exec -it $podname -- sh -c 'grep "dynamic-provider:1.0.0 started" logs/stock-mng/sofa-ark/*.log' + - name: scaledown module then delete deployment + run: + kubectl apply -f config/samples/module-deployment_v1alpha1_moduledeployment_provider_scaledown.yaml + + - name: wait module delete + run: | + moduleCount=$(kubectl get module | wc -l) + + timeout_seconds=300 + + start_time=$(date +%s) + end_time=$((start_time + timeout_seconds)) + + while true; do + current_time=$(date +%s) + if [ $current_time -gt $end_time ]; then + echo "等待超时" + exit 1 + fi + + if [[ $moduleCount -lt 1 ]]; then + echo "module已缩容" + exit 0 + else + echo "等待module删除" + sleep 5 + fi + done + - name: delete deployment run: | kubectl delete -n default deployment dynamic-stock-deployment - run: sleep 10 - - name: get source - run: | - kubectl get -n default module - kubectl get -n default moduleReplicaSet - kubectl get -n default moduleDeployment - - name: log module-controller run: | podname=$(kubectl get po -l app=module-controller -o name) From 6a0473a113f8537e3bc9c0c6f94c9d5e14629899 Mon Sep 17 00:00:00 2001 From: LiuLiqi <837397251@qq.com> Date: Thu, 2 Nov 2023 11:54:25 +0800 Subject: [PATCH 21/22] =?UTF-8?q?=E6=9C=80=E5=90=8E=E5=85=88=E7=BC=A9?= =?UTF-8?q?=E5=AE=B9=E5=86=8D=E5=88=A0=E9=99=A4Deployment?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...e_controller_ci_build_deploy_to_aliyun.yml | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/.github/workflows/module_controller_ci_build_deploy_to_aliyun.yml b/.github/workflows/module_controller_ci_build_deploy_to_aliyun.yml index cfd7dcacd..fa16169e3 100644 --- a/.github/workflows/module_controller_ci_build_deploy_to_aliyun.yml +++ b/.github/workflows/module_controller_ci_build_deploy_to_aliyun.yml @@ -378,7 +378,6 @@ jobs: - name: wait module delete run: | - moduleCount=$(kubectl get module | wc -l) timeout_seconds=300 @@ -386,19 +385,20 @@ jobs: end_time=$((start_time + timeout_seconds)) while true; do - current_time=$(date +%s) - if [ $current_time -gt $end_time ]; then - echo "等待超时" - exit 1 - fi - - if [[ $moduleCount -lt 1 ]]; then - echo "module已缩容" - exit 0 - else - echo "等待module删除" - sleep 5 - fi + moduleCount=$(kubectl get module | wc -l) + current_time=$(date +%s) + if [ $current_time -gt $end_time ]; then + echo "等待超时" + exit 1 + fi + + if [[ $moduleCount -lt 1 ]]; then + echo "module已缩容" + exit 0 + else + echo "等待module删除" + sleep 5 + fi done - name: delete deployment From 3e14ba2073e9ae8813c431166ac28d33a6bbd03c Mon Sep 17 00:00:00 2001 From: LiuLiqi <837397251@qq.com> Date: Thu, 2 Nov 2023 12:50:23 +0800 Subject: [PATCH 22/22] move file to ci dir --- .../workflows/module_controller_ci_build_deploy_to_aliyun.yml | 4 ++-- ...ployment_v1alpha1_moduledeployment_provider_scaledown.yaml | 0 2 files changed, 2 insertions(+), 2 deletions(-) rename module-controller/config/samples/{ => ci}/module-deployment_v1alpha1_moduledeployment_provider_scaledown.yaml (100%) diff --git a/.github/workflows/module_controller_ci_build_deploy_to_aliyun.yml b/.github/workflows/module_controller_ci_build_deploy_to_aliyun.yml index c750bcd25..5125a9ac1 100644 --- a/.github/workflows/module_controller_ci_build_deploy_to_aliyun.yml +++ b/.github/workflows/module_controller_ci_build_deploy_to_aliyun.yml @@ -178,7 +178,7 @@ jobs: - name: scaledown module run: - kubectl apply -f config/samples/module-deployment_v1alpha1_moduledeployment_provider_scaledown.yaml + kubectl apply -f config/samples/ci/module-deployment_v1alpha1_moduledeployment_provider_scaledown.yaml - run: sleep 15 @@ -374,7 +374,7 @@ jobs: - name: scaledown module then delete deployment run: - kubectl apply -f config/samples/module-deployment_v1alpha1_moduledeployment_provider_scaledown.yaml + kubectl apply -f config/samples/ci/module-deployment_v1alpha1_moduledeployment_provider_scaledown.yaml - name: wait module delete run: | diff --git a/module-controller/config/samples/module-deployment_v1alpha1_moduledeployment_provider_scaledown.yaml b/module-controller/config/samples/ci/module-deployment_v1alpha1_moduledeployment_provider_scaledown.yaml similarity index 100% rename from module-controller/config/samples/module-deployment_v1alpha1_moduledeployment_provider_scaledown.yaml rename to module-controller/config/samples/ci/module-deployment_v1alpha1_moduledeployment_provider_scaledown.yaml