script to set a cluster in maintenance mode

This commit is contained in:
Ulf Gebhardt 2023-02-27 10:52:34 +01:00
parent e045bc96f9
commit b5bbf5164d
Signed by: ulfgebhardt
GPG Key ID: DA6B843E748679C9
3 changed files with 46 additions and 0 deletions

View File

@ -0,0 +1,22 @@
#!/bin/bash
# base setup
SCRIPT_PATH=$(realpath $0)
SCRIPT_DIR=$(dirname $SCRIPT_PATH)
# configuration
CONFIGURATION=${CONFIGURATION:-"example"}
KUBECONFIG=${KUBECONFIG:-${SCRIPT_DIR}/../configurations/${CONFIGURATION}/kubeconfig.yaml}
case $1 in
on)
kubectl --kubeconfig=${KUBECONFIG} patch ingress ingress-ocelot-webapp --type merge --patch-file ${SCRIPT_DIR}/../src/kubernetes/patches/patch.ingress.maintenance.on.yaml
;;
off)
kubectl --kubeconfig=${KUBECONFIG} patch ingress ingress-ocelot-webapp --type merge --patch-file ${SCRIPT_DIR}/../src/kubernetes/patches/patch.ingress.maintenance.off.yaml
;;
*)
echo -e "Run this script with first argument either 'on' or 'off'"
exit
;;
esac

View File

@ -0,0 +1,12 @@
spec:
rules:
- host:
http:
paths:
- path: /
pathType: ImplementationSpecific
backend:
service:
name: ocelot-webapp
port:
number: 3000

View File

@ -0,0 +1,12 @@
spec:
rules:
- host:
http:
paths:
- path: /
pathType: ImplementationSpecific
backend:
service:
name: ocelot-maintenance
port:
number: 80