diff --git a/README.md b/README.md index 868804a7..6f66a911 100644 --- a/README.md +++ b/README.md @@ -48,6 +48,8 @@ JOBS=() # List of files ending in '.blockingjob.yml' in the kube directory BLOCKING_JOBS=() + + ``` ### Generating a config diff --git a/bin/docker-push b/bin/docker-push index 05a46b70..e9c33f48 100755 --- a/bin/docker-push +++ b/bin/docker-push @@ -49,4 +49,4 @@ if [ $? -ne 0 ] then echo "Unable to push docker image, aborting." exit 1 -fi +fi \ No newline at end of file diff --git a/bin/k8s-deploy b/bin/k8s-deploy index 1fed2a90..1a302af6 100755 --- a/bin/k8s-deploy +++ b/bin/k8s-deploy @@ -40,7 +40,7 @@ echo "" echo "Deploying Services" for index in "${!SERVICE_FILES[@]}" do - SERVICE=${SERVICES[$index]} + SERVICE=${SERVICES[$index]##*/} SERVICE_FILE=${SERVICE_FILES[$index]} kubectl get service ${SERVICE} --namespace=$NAMESPACE &>/dev/null if [ $? -ne 0 ] @@ -161,7 +161,7 @@ echo "" echo "Deploying Deployments" for index in "${!DEPLOYMENT_FILES[@]}" do - DEPLOYMENT=${DEPLOYMENTS[$index]} + DEPLOYMENT=${DEPLOYMENTS[$index]##*/} DEPLOYMENT_FILE=${DEPLOYMENT_FILES[$index]} kubectl get deployment ${DEPLOYMENT} --namespace=$NAMESPACE &>/dev/null if [ $? -ne 0 ] @@ -195,8 +195,8 @@ echo "" echo "Verifying successful deployments" for index in "${!DEPLOYMENTS[@]}" do - DEPLOYMENT=${DEPLOYMENTS[$index]} - echo "Checking deployment for $i" + DEPLOYMENT=${DEPLOYMENTS[$index]##*/} + echo "Checking deployment for $DEPLOYMENT" timeout.sh -t ${DEPLOY_TIMEOUT} verify-deployment $DEPLOYMENT $NAMESPACE result=$? if [ "$result" == "143" ] ; then diff --git a/bin/run-blocking-job b/bin/run-blocking-job index 8621fc83..1cf0aaa7 100755 --- a/bin/run-blocking-job +++ b/bin/run-blocking-job @@ -2,7 +2,7 @@ # Runs a Kubernetes Job once. Designed for a single, non-parallel job, typically db migrations # http://kubernetes.io/docs/user-guide/jobs/#parallel-jobs -# The job needs to be located in KUBERNETES_CONFIG_PATH, named ${JOB_NAME}.job.yml, +# The job needs to be located in $BASEDIR/deploy, named ${JOB_NAME}.job.yml, # and JOB_NAME should match the job's metadata.name attribute # Usage: ./script/run-migrations.sh JOB_NAME @@ -17,6 +17,7 @@ POLL_TRIES=${POLL_TRIES:-30} POLL_WAIT=${POLL_WAIT:-10} ACTIVE=$(kubectl get job -o json $JOB_NAME --namespace=${2:=default} |jq .status.active) + if [ "$ACTIVE" != 1 ] then echo "Blocking job $JOB_NAME hasn't started, something is wrong" diff --git a/bin/verify-deployment b/bin/verify-deployment index 6299d997..c0cb1131 100755 --- a/bin/verify-deployment +++ b/bin/verify-deployment @@ -10,8 +10,8 @@ OBS_GEN=-1 CURRENT_GEN=0 until [ $OBS_GEN -ge $CURRENT_GEN ]; do sleep 1 - CURRENT_GEN=$(kubectl get deployment ${1} --namespace=${2:=default} -o yaml | grep generation | awk '{print $2}') - OBS_GEN=$(kubectl get deployment ${1} --namespace=${2:=default} -o yaml | grep Generation | awk '{print $2}') + CURRENT_GEN=$(kubectl get deployment ${1} --namespace=${2:=default} -o yaml | grep generation: | awk '{print $2}') + OBS_GEN=$(kubectl get deployment ${1} --namespace=${2:=default} -o yaml | grep observedGeneration: | awk '{print $2}') echo "observedGeneration ($OBS_GEN) should be >= generation ($CURRENT_GEN)." done echo "observedGeneration ($OBS_GEN) is >= generation ($CURRENT_GEN)" @@ -21,8 +21,8 @@ UPDATED_REPLIACS=-1 REPLICAS=0 until [ "$UPDATED_REPLIACS" == "$REPLICAS" ]; do sleep 1 - REPLICAS=$(kubectl get deployment ${1} --namespace=${2:=default} -o yaml | grep replicas | sed -n 2p | awk '{print $2}') - UPDATED_REPLIACS=$(kubectl get deployment ${1} --namespace=${2:=default} -o yaml | grep updatedReplicas | awk '{print $2}') + REPLICAS=$(kubectl get deployment ${1} --namespace=${2:=default} -o yaml | grep replicas: | sed -n 2p | awk '{print $2}') + UPDATED_REPLIACS=$(kubectl get deployment ${1} --namespace=${2:=default} -o yaml | grep updatedReplicas: | awk '{print $2}') echo "updatedReplicas ($UPDATED_REPLIACS) should be == replicas ($REPLICAS)." done echo "updatedReplicas ($UPDATED_REPLIACS) is == replicas ($REPLICAS)." @@ -32,8 +32,8 @@ AVAILABLE_REPLICAS=-1 REPLICAS=0 until [ "$AVAILABLE_REPLICAS" == "$REPLICAS" ]; do sleep 1 - REPLICAS=$(kubectl get deployment ${1} --namespace=${2:=default} -o yaml | grep replicas | sed -n 2p | awk '{print $2}') - AVAILABLE_REPLICAS=$(kubectl get deployment ${1} --namespace=${2:=default} -o yaml | grep -e "\bavailableReplicas" | awk '{print $2}') + REPLICAS=$(kubectl get deployment ${1} --namespace=${2:=default} -o yaml | grep replicas: | sed -n 2p | awk '{print $2}') + AVAILABLE_REPLICAS=$(kubectl get deployment ${1} --namespace=${2:=default} -o yaml | grep -e "\bavailableReplicas:" | awk '{print $2}') echo "availableReplicas ($AVAILABLE_REPLICAS) should be == replicas ($REPLICAS)." done echo "availableReplicas ($AVAILABLE_REPLICAS) is == replicas ($REPLICAS)." diff --git a/k8s-scripts.config b/k8s-scripts.config index 982ff7d2..e2add973 100644 --- a/k8s-scripts.config +++ b/k8s-scripts.config @@ -26,8 +26,8 @@ SECRETS=('example-app') # List of files ending in '.service.yml' in the kube directory SERVICES=('example-app') -# List of files ending in '.ingress.yml' in the kube directory (Not supported yet) -IGRESSES=() +# List of files ending in '.ingress.yml' in the kube directory +INGRESSES=() # List of files ending in '.deployment.yml' in the kube directory DEPLOYMENTS=('example-app') @@ -37,3 +37,4 @@ JOBS=() # List of files ending in '.blockingjob.yml' in the kube directory BLOCKING_JOBS=() +