Skip to content
This repository has been archived by the owner on Feb 18, 2024. It is now read-only.

Commit

Permalink
添加测试分组发布
Browse files Browse the repository at this point in the history
  • Loading branch information
liu-657667 committed Nov 9, 2023
1 parent de8c91e commit 91aae3e
Show file tree
Hide file tree
Showing 3 changed files with 153 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,6 @@ jobs:
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
Expand All @@ -110,6 +106,101 @@ jobs:
run: |
kubectl wait --for=condition=available deployment/module-controller --timeout=300s
- name: get pod
- name: apply moduledeployment batch release
run: |
kubectl apply -f config/samples/ci/module-deployment_v1alpha1_moduledeployment_batch_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: 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: check moduledeployment pause
run: |
# 定义要等待的资源名称和字段值
moduledeploymentname=$(kubectl get moduledeployment -o name)
desired_field_value=true
# 定义等待的超时时间(以秒为单位)
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 $moduledeploymentname -o custom-columns=PAUSE:.spec.pause --no-headers)
if [ "$field_value" == "$desired_field_value" ]; then
echo "字段值已满足条件,执行分组确认"
kubectl patch $moduledeploymentname -p '{"spec":{"pause":false}}' --type=merge
exit 0
else
echo "等待字段值满足条件..."
sleep 5 # 等待一段时间后再次检查
fi
done
- run: sleep 15

- name: exist module
run: |
kubectl get pod
moduleCount=$(kubectl get module | wc -l)
if [[ $moduleCount -lt 2 ]]; then
echo "ERROR: 不存在module"
exit 1
fi
Original file line number Diff line number Diff line change
@@ -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: 3
operationStrategy:
needConfirm: true
grayTimeBetweenBatchSeconds: 120
useBeta: false
batchCount: 3
upgradePolicy: install_then_uninstall
schedulingStrategy:
schedulingPolicy: scatter

Original file line number Diff line number Diff line change
@@ -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: true
grayTimeBetweenBatchSeconds: 120
useBeta: false
batchCount: 3
upgradePolicy: install_then_uninstall
schedulingStrategy:
schedulingPolicy: scatter

0 comments on commit 91aae3e

Please sign in to comment.