Implements Waiting for Deployments to Finish
This commit is contained in:
18
deploy.sh
18
deploy.sh
@@ -25,9 +25,17 @@ apply_template() {
|
|||||||
|
|
||||||
|
|
||||||
apply_deployment() {
|
apply_deployment() {
|
||||||
for file in $(find $1 -type f); do
|
deployment_name=$1
|
||||||
|
deployment_files=$2
|
||||||
|
|
||||||
|
for file in $(find $2 -type f); do
|
||||||
apply_template $file
|
apply_template $file
|
||||||
done
|
done
|
||||||
|
|
||||||
|
kubectl wait --for=condition=available \
|
||||||
|
--timeout=600s \
|
||||||
|
deployment.apps/${deployment_name} \
|
||||||
|
-n ${KUBE_NAMESPACE}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -118,13 +126,13 @@ deploy_kubernetes() {
|
|||||||
|
|
||||||
configure_postgres
|
configure_postgres
|
||||||
|
|
||||||
apply_deployment "./template/redis"
|
apply_deployment "redis-deployment" "./template/redis"
|
||||||
|
|
||||||
apply_deployment "./template/frontend"
|
apply_deployment "storage-deployment" "./template/storage"
|
||||||
|
|
||||||
apply_deployment "./template/storage"
|
apply_deployment "backend-deployment" "./template/backend"
|
||||||
|
|
||||||
apply_deployment "./template/backend"
|
apply_deployment "frontend-deployment" "./template/frontend"
|
||||||
|
|
||||||
configure_ingress
|
configure_ingress
|
||||||
|
|
||||||
|
|||||||
@@ -15,6 +15,18 @@ spec:
|
|||||||
spec:
|
spec:
|
||||||
nodeSelector:
|
nodeSelector:
|
||||||
${WORKER_NODE_LABEL}
|
${WORKER_NODE_LABEL}
|
||||||
|
initContainers:
|
||||||
|
- name: wait-storage-init
|
||||||
|
image: busybox:latest
|
||||||
|
args:
|
||||||
|
- /bin/sh
|
||||||
|
- -c
|
||||||
|
- >
|
||||||
|
set -x;
|
||||||
|
while [ $(curl -sw '%{http_code}' "storage-service:8070/health" -o /dev/null) -ne 200 ]; do
|
||||||
|
sleep 15;
|
||||||
|
done
|
||||||
|
|
||||||
containers:
|
containers:
|
||||||
- name: backend
|
- name: backend
|
||||||
image: yoshiunfriendly/backend-hideyoshi.com
|
image: yoshiunfriendly/backend-hideyoshi.com
|
||||||
@@ -32,7 +44,7 @@ spec:
|
|||||||
httpGet:
|
httpGet:
|
||||||
path: /health
|
path: /health
|
||||||
port: 8070
|
port: 8070
|
||||||
initialDelaySeconds: 120
|
initialDelaySeconds: 60
|
||||||
livenessProbe:
|
livenessProbe:
|
||||||
httpGet:
|
httpGet:
|
||||||
path: /health
|
path: /health
|
||||||
|
|||||||
@@ -17,6 +17,17 @@ spec:
|
|||||||
spec:
|
spec:
|
||||||
nodeSelector:
|
nodeSelector:
|
||||||
${WORKER_NODE_LABEL}
|
${WORKER_NODE_LABEL}
|
||||||
|
initContainers:
|
||||||
|
- name: wait-backend-init
|
||||||
|
image: busybox:latest
|
||||||
|
args:
|
||||||
|
- /bin/sh
|
||||||
|
- -c
|
||||||
|
- >
|
||||||
|
set -x;
|
||||||
|
while [ $(curl -sw '%{http_code}' "backend-service:8000/health" -o /dev/null) -ne 200 ]; do
|
||||||
|
sleep 15;
|
||||||
|
done
|
||||||
containers:
|
containers:
|
||||||
- name: frontend
|
- name: frontend
|
||||||
image: yoshiunfriendly/frontend-hideyoshi.com:latest
|
image: yoshiunfriendly/frontend-hideyoshi.com:latest
|
||||||
|
|||||||
Reference in New Issue
Block a user