Skip to content

Commit

Permalink
Merge pull request #49 from runconduit/siggy/lifecycle-redeploy-deploy
Browse files Browse the repository at this point in the history
Redeploy bb-terminus deployment in lifecycle env
  • Loading branch information
siggy authored Jul 5, 2018
2 parents e47e5b9 + cfddf78 commit 319a749
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lifecycle/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ kubectl create clusterrolebinding cluster-admin-binding-$USER \
Deploy 5 lifecycle namespaces:

```bash
conduit install --conduit-namespace conduit-lifecycle | kubectl apply -f -
conduit install --conduit-namespace conduit-lifecycle --tls optional | kubectl apply -f -
bin/deploy 5
```

Expand Down
2 changes: 1 addition & 1 deletion lifecycle/bin/deploy
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ do
echo "\nDeploying $NS..."
kubectl create ns $NS
cat lifecycle.yml |
conduit inject --conduit-namespace conduit-lifecycle - |
conduit inject --conduit-namespace conduit-lifecycle --tls optional - |
kubectl -n $NS apply -f -
done
18 changes: 15 additions & 3 deletions lifecycle/lifecycle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ spec:
exec \
/out/bb terminus \
--grpc-server-port=9090 \
--response-text=BANANA
--response-text=BANANA0
ports:
- containerPort: 9090
name: bb-term-grpc
Expand All @@ -316,6 +316,9 @@ apiVersion: rbac.authorization.k8s.io/v1beta1
metadata:
name: lifecycle:redeployer
rules:
- apiGroups: ["extensions"]
resources: ["deployments"]
verbs: ["get", "patch"]
- apiGroups: [""]
resources: ["pods", "services"]
verbs: ["create", "delete", "get", "list"]
Expand Down Expand Up @@ -366,16 +369,25 @@ data:
if [ $(( NOW - LAST )) -gt 30 ]; then
echo "bouncing services..."
for i in `seq 1 10`; do
svc=$(kubectl -n $LIFECYCLE_NS get svc/bb-terminus$i -o json)
SVC=$(kubectl -n $LIFECYCLE_NS get svc/bb-terminus$i -o json)
kubectl -n $LIFECYCLE_NS delete svc/bb-terminus$i
echo $svc | kubectl -n $LIFECYCLE_NS apply -f -
echo $SVC | kubectl -n $LIFECYCLE_NS apply -f -
done
LAST=NOW
fi
echo "sleeping for ${SLEEP_TIME} seconds..."
sleep $SLEEP_TIME
done
# redeploy the whole bb-terminus deployment
echo "redeploying bb-terminus deployment"
DEPLOY=$(kubectl -n $LIFECYCLE_NS get deploy/bb-terminus -o json)
echo $DEPLOY | sed -E 's/BANANA[0-9]+/BANANA'$(date +'%s')'/g' | kubectl -n $LIFECYCLE_NS apply -f -
# give the new deployment time to roll out, before we start deleting pods again
echo "sleeping for 60 seconds..."
sleep 60
done
---
apiVersion: extensions/v1beta1
Expand Down

0 comments on commit 319a749

Please sign in to comment.