Created
August 21, 2019 16:37
-
-
Save ivansantos-jumia/9dd8f8f796a7a308e5fe306f9c44f825 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 | |
mkdir bkpIngressObjects | |
# clusters | |
for cluster in cluster1 cluster2 | |
do | |
mkdir bkpIngressObjects/${cluster} | |
kubectl config use-context $cluster | |
for ingObject in $(kubectl get ing -o custom-columns=NAME:.metadata.name | grep -v NAME) | |
kubectl get ing/$ingObject -o json > bkpIngressObjects/${cluster}/${ingObject}.bkp.json | |
kubectl get ing/$ingObject -o json | jq '(.spec.rules[].http.paths[].backend.serviceName) |= "maintenance-page"' > ing.tmp | |
jq '(.spec.rules[].http.paths[].backend.servicePort) |= "80"' ing.txt | kubectl apply -f - | |
done | |
rm -f ing.tmp | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment