Skip to content

Commit

Permalink
Merge pull request #20 from reactiveops/sz/ingress
Browse files Browse the repository at this point in the history
Remainder of Ingress additions, deploy/[subdirectory] support for config files
  • Loading branch information
sairez authored Nov 29, 2016
2 parents 5b93199 + cb14a6a commit a6099c6
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 14 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ JOBS=()
# List of files ending in '.blockingjob.yml' in the kube directory
BLOCKING_JOBS=()
```

### Generating a config
Expand Down
2 changes: 1 addition & 1 deletion bin/docker-push
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,4 @@ if [ $? -ne 0 ]
then
echo "Unable to push docker image, aborting."
exit 1
fi
fi
8 changes: 4 additions & 4 deletions bin/k8s-deploy
Original file line number Diff line number Diff line change
Expand Up @@ -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 ]
Expand Down Expand Up @@ -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 ]
Expand Down Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion bin/run-blocking-job
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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"
Expand Down
12 changes: 6 additions & 6 deletions bin/verify-deployment
Original file line number Diff line number Diff line change
Expand Up @@ -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)"
Expand All @@ -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)."
Expand All @@ -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)."
Expand Down
5 changes: 3 additions & 2 deletions k8s-scripts.config
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand All @@ -37,3 +37,4 @@ JOBS=()

# List of files ending in '.blockingjob.yml' in the kube directory
BLOCKING_JOBS=()

0 comments on commit a6099c6

Please sign in to comment.