File tree Expand file tree Collapse file tree 2 files changed +34
-1
lines changed Expand file tree Collapse file tree 2 files changed +34
-1
lines changed Original file line number Diff line number Diff line change 1
1
wikibase-local-ca.crt
2
-
2
+ * .bak
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ # This script automatically updates the service endpoint of any existing ingress
4
+ # created by the Platform API with the label "wbstack-ingress-generation".
5
+ #
6
+ # Example of rerouting ingresses to the "anubis" service:
7
+ # ./bin/update-ingress-service anubis
8
+
9
+ function usage() {
10
+ echo " usage: $( basename $0 ) <service>"
11
+ }
12
+
13
+ SERVICE=$1
14
+ if [[ -z " ${SERVICE} " ]]; then
15
+ usage
16
+ exit 1
17
+ fi
18
+
19
+ INGRESSES=$( kubectl get ingress -l wbstack-ingress-generation -o json)
20
+
21
+ echo " $INGRESSES " > " wbstack-ingresses-$( date +%s) .json.bak"
22
+
23
+ UPDATED_INGRESSES=$( echo " $INGRESSES " | jq ' .items[].spec.rules[].http.paths[].backend.service.name="' $SERVICE ' "' )
24
+
25
+ kubectl diff -f <( echo " $UPDATED_INGRESSES " )
26
+
27
+ read -p " Do you want to deploy these changes? (y/N): " CONFIRMATION
28
+ if [[ ! $CONFIRMATION =~ ^[Yy]$ ]]; then
29
+ echo " canceled"
30
+ exit 1
31
+ fi
32
+
33
+ kubectl apply -f <( echo " $UPDATED_INGRESSES " )
You can’t perform that action at this time.
0 commit comments