-
-
Save heim/3881e4c62a01f17255f9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
_container=$1 | |
cat > controller.yaml <<EOF | |
--- | |
kind: ReplicationController | |
apiVersion: v1 | |
metadata: | |
name: some-app | |
spec: | |
replicas: 1 | |
selector: | |
app: some-app | |
template: | |
metadata: | |
labels: | |
app: some-app | |
spec: | |
containers: | |
- name: some-app | |
imagePullPolicy: Always | |
image: $_image | |
EOF |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#auth kubernetes | |
#check dependencies | |
_image="path-to-image:$_sha" | |
./create-rc.sh $_image | |
kubectl get rc some-app > /dev/null 2>&1; | |
if [ $? -ne 0 ]; then | |
echo "Replication controller does not exist, creating."; | |
kubectl create -f controller.yaml; | |
else | |
echo "Updating rc and performing rolling update"; | |
kubectl apply -f controller.yaml; | |
sleep 2; | |
kubectl rolling-update some-app --image=$_image --update-period=30s --timeout=1m30s; | |
if [ $? -ne 0 ]; then | |
echo "Could not perform rolling update" | |
exit 1; | |
fi; | |
fi | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment