Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

20230510 appserve details #173

Merged
merged 4 commits into from
May 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 48 additions & 6 deletions app_serving/abort-java-app.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,16 @@ spec:
value: ""
- name: organization_id
value: "ose4j7p39"
- name: strategy
value: "blue-green"
# tks_info service URL
- name: tks_info_host
value: "http://tks-api.tks.svc:9110"

templates:
- name: exit-handler
steps:
- - name: notify-abort-failure
- - name: notify-bluegreen-abort-failure
templateRef:
name: update-tks-asa-status
template: updateTksAsaStatus
Expand All @@ -40,17 +42,35 @@ spec:
- name: asa_task_id
value: "{{workflow.parameters.asa_task_id}}"
- name: status
value: "ABORT_FAILED"
value: "BLUEGREEN_ABORT_FAILED"
- name: output
value: "{{workflow.outputs.parameters.abort_output_global}}"
when: "{{workflow.status}} != Succeeded"
when: "{{workflow.status}} != Succeeded && '{{workflow.parameters.strategy}}' == 'blue-green'"
- - name: notify-canary-abort-failure
templateRef:
name: update-tks-asa-status
template: updateTksAsaStatus
arguments:
parameters:
- name: organization_id
value: "{{workflow.parameters.organization_id}}"
- name: asa_id
value: "{{workflow.parameters.asa_id}}"
- name: asa_task_id
value: "{{workflow.parameters.asa_task_id}}"
- name: status
value: "CANARY_ABORT_FAILED"
- name: output
value: "{{workflow.outputs.parameters.abort_output_global}}"
when: "{{workflow.status}} != Succeeded && '{{workflow.parameters.strategy}}' == 'canary'"

- name: main
steps:
- - name: notify-abort-start
- - name: notify-bluegreen-abort-start
templateRef:
name: update-tks-asa-status
template: updateTksAsaStatus
when: "'{{workflow.parameters.strategy}}' == 'blue-green'"
arguments:
parameters:
- name: organization_id
Expand All @@ -60,7 +80,24 @@ spec:
- name: asa_task_id
value: "{{workflow.parameters.asa_task_id}}"
- name: status
value: "ABORTING"
value: "BLUEGREEN_ABORTING"
- name: output
value: ""
- - name: notify-canary-abort-start
templateRef:
name: update-tks-asa-status
template: updateTksAsaStatus
when: "'{{workflow.parameters.strategy}}' == canary"
arguments:
parameters:
- name: organization_id
value: "{{workflow.parameters.organization_id}}"
- name: asa_id
value: "{{workflow.parameters.asa_id}}"
- name: asa_task_id
value: "{{workflow.parameters.asa_task_id}}"
- name: status
value: "CANARY_ABORTING"
- name: output
value: ""
- - name: abort-app
Expand Down Expand Up @@ -132,6 +169,7 @@ spec:
ABORT_LOG='/mnt/out/abort_output.log'
app_name={{workflow.parameters.app_name}}
ns={{workflow.parameters.namespace}}
strategy={{workflow.parameters.strategy}}

# Prepare kubeconfig
echo "Preparing kubeconfig for target cluster..." | tee -a $ABORT_LOG
Expand Down Expand Up @@ -295,4 +333,8 @@ spec:
# write information
#==========================================================
# Write deployment status to file for next step
echo "ABORT_SUCCESS" > /mnt/out/abort_status
if [[ "$strategy" == "blue-green" ]]; then
echo "BLUEGREEN_ABORT_SUCCESS" > /mnt/out/abort_status
elif [[ "$strategy" == "canary" ]]; then
echo "CANARY_ABORT_SUCCESS" > /mnt/out/abort_status
fi
54 changes: 48 additions & 6 deletions app_serving/promote-java-app.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,16 @@ spec:
value: ""
- name: organization_id
value: "ose4j7p39"
- name: strategy
value: "blue-green"
# tks_info service URL
- name: tks_info_host
value: "http://tks-api.tks.svc:9110"

templates:
- name: exit-handler
steps:
- - name: notify-promote-failure
- - name: notify-bluegreen-promote-failure
templateRef:
name: update-tks-asa-status
template: updateTksAsaStatus
Expand All @@ -40,17 +42,35 @@ spec:
- name: asa_task_id
value: "{{workflow.parameters.asa_task_id}}"
- name: status
value: "PROMOTE_FAILED"
value: "BLUEGREEN_PROMOTE_FAILED"
- name: output
value: "{{workflow.outputs.parameters.promote_output_global}}"
when: "{{workflow.status}} != Succeeded"
when: "{{workflow.status}} != Succeeded && '{{workflow.parameters.strategy}}' == 'blue-green'"
- - name: notify-canary-promote-failure
templateRef:
name: update-tks-asa-status
template: updateTksAsaStatus
arguments:
parameters:
- name: organization_id
value: "{{workflow.parameters.organization_id}}"
- name: asa_id
value: "{{workflow.parameters.asa_id}}"
- name: asa_task_id
value: "{{workflow.parameters.asa_task_id}}"
- name: status
value: "CANARY_PROMOTE_FAILED"
- name: output
value: "{{workflow.outputs.parameters.promote_output_global}}"
when: "{{workflow.status}} != Succeeded && '{{workflow.parameters.strategy}}' == canary"

- name: main
steps:
- - name: notify-promote-start
- - name: notify-bluegreen-promote-start
templateRef:
name: update-tks-asa-status
template: updateTksAsaStatus
when: "'{{workflow.parameters.strategy}}' == 'blue-green'"
arguments:
parameters:
- name: organization_id
Expand All @@ -60,7 +80,24 @@ spec:
- name: asa_task_id
value: "{{workflow.parameters.asa_task_id}}"
- name: status
value: "PROMOTING"
value: "BLUEGREEN_PROMOTING"
- name: output
value: ""
- - name: notify-canary-promote-start
templateRef:
name: update-tks-asa-status
template: updateTksAsaStatus
when: "'{{workflow.parameters.strategy}}' == canary"
arguments:
parameters:
- name: organization_id
value: "{{workflow.parameters.organization_id}}"
- name: asa_id
value: "{{workflow.parameters.asa_id}}"
- name: asa_task_id
value: "{{workflow.parameters.asa_task_id}}"
- name: status
value: "CANARY_PROMOTING"
- name: output
value: ""
- - name: promote-app
Expand Down Expand Up @@ -134,6 +171,7 @@ spec:
- |
PROMOTE_LOG='/mnt/out/promote_output.log'
app_name={{workflow.parameters.app_name}}
strategy={{workflow.parameters.strategy}}

# Prepare kubeconfig
echo "Preparing kubeconfig for target cluster..." | tee -a $PROMOTE_LOG
Expand Down Expand Up @@ -273,4 +311,8 @@ spec:
# write information
#==========================================================
# Write deployment status to file for next step
echo "PROMOTE_SUCCESS" > /mnt/out/promote_status
if [[ "$strategy" == "blue-green" ]]; then
echo "BLUEGREEN_PROMOTE_SUCCESS" > /mnt/out/promote_status
elif [[ "$strategy" == "canary" ]]; then
echo "CANARY_PROMOTE_SUCCESS" > /mnt/out/promote_status
fi
50 changes: 46 additions & 4 deletions app_serving/serve-java-app.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ spec:
- name: asa_task_id
value: "{{workflow.parameters.asa_task_id}}"
- name: status
value: "BLUEGREEN_FAILED"
value: "BLUEGREEN_DEPLOY_FAILED"
- name: output
value: "{{workflow.outputs.parameters.deploy_output_global}}"
when: "{{workflow.status}} != Succeeded && '{{steps.parse-failed-step.outputs.parameters.step_name}}' == 'deploy-app' && '{{workflow.parameters.strategy}}' == 'blue-green'"
Expand Down Expand Up @@ -190,7 +190,8 @@ spec:
- name: output
value: "{{steps.build-image.outputs.parameters.build_output}}"
- - name: notify-deploy-start
when: "{{workflow.parameters.type}} != 'build'"
when: >-
( {{workflow.parameters.type}} != 'build' && '{{workflow.parameters.strategy}}' == 'rolling-update' )
templateRef:
name: update-tks-asa-status
template: updateTksAsaStatus
Expand All @@ -206,6 +207,42 @@ spec:
value: "DEPLOYING"
- name: output
value: ""
- - name: notify-bluegreen-deploy-start
when: >-
( {{workflow.parameters.type}} != 'build' && '{{workflow.parameters.strategy}}' == 'blue-green' )
templateRef:
name: update-tks-asa-status
template: updateTksAsaStatus
arguments:
parameters:
- name: organization_id
value: "{{workflow.parameters.organization_id}}"
- name: asa_id
value: "{{workflow.parameters.asa_id}}"
- name: asa_task_id
value: "{{workflow.parameters.asa_task_id}}"
- name: status
value: "BLUEGREEN_DEPLOYING"
- name: output
value: ""
- - name: notify-canary-deploy-start
when: >-
( {{workflow.parameters.type}} != 'build' && '{{workflow.parameters.strategy}}' == 'canary' )
templateRef:
name: update-tks-asa-status
template: updateTksAsaStatus
arguments:
parameters:
- name: organization_id
value: "{{workflow.parameters.organization_id}}"
- name: asa_id
value: "{{workflow.parameters.asa_id}}"
- name: asa_task_id
value: "{{workflow.parameters.asa_task_id}}"
- name: status
value: "CANARY_DEPLOYING"
- name: output
value: ""
- - name: deploy-app
when: "{{workflow.parameters.type}} != 'build'"
template: deploy-app
Expand Down Expand Up @@ -470,7 +507,7 @@ spec:

if [ "$ready" = false ]; then
echo "Timed out waiting for deployment to be done.." | tee -a $DEPLOY_LOG
#echo "BLUEGREEN_FAILED" > /mnt/out/deploy_status
#echo "BLUEGREEN_DEPLOY_FAILED" > /mnt/out/deploy_status
exit 1
fi
}
Expand Down Expand Up @@ -652,6 +689,8 @@ spec:
check_rollout_replicas
elif [[ "$strategy" == "blue-green" ]]; then
check_rollout_phase "Paused" "Paused"
elif [[ "$strategy" == "canary" ]]; then
check_rollout_phase "Paused" "Paused"
fi


Expand All @@ -673,7 +712,10 @@ spec:
echo "DEPLOY_SUCCESS" > /mnt/out/deploy_status
elif [[ "$strategy" == "blue-green" ]]; then
# Write deployment status to file for next step
echo "WAIT_FOR_PROMOTE" > /mnt/out/deploy_status
echo "BLUEGREEN_WAIT" > /mnt/out/deploy_status
elif [[ "$strategy" == "canary" ]]; then
# Write deployment status to file for next step
echo "CANARY_WAIT" > /mnt/out/deploy_status
fi


Expand Down