File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ while true ; do
4
+ ADDRESSES=$( kubectl get machine -o json | jq -r ' .items[] | select(.metadata.labels."cluster.x-k8s.io/control-plane" != null) | .status | select(.addresses!=null) | .addresses[].address' )
5
+ if [[ $ADDRESSES != $OLD_ADDRESSES ]]; then
6
+ cp hack/nginx.conf ./nginx.conf
7
+ echo $ADDRESSES
8
+ for ADDRESS in $ADDRESSES ; do
9
+ sleep 5
10
+ echo $ADDRESS
11
+ sed -i.bak ' /upstream kubeendpoints/a\' $' \n ' $' \t ' ' server ' $ADDRESS ' :6443 max_fails=3 fail_timeout=10s;' $' \n ' nginx.conf
12
+ done
13
+ docker stop nginx-container || echo
14
+ docker rm nginx-container || echo
15
+ docker run --name=nginx-container --rm -p 8082:8082 -v $( pwd) /nginx.conf:/etc/nginx/nginx.conf nginx &
16
+ fi
17
+ OLD_ADDRESSES=$ADDRESSES
18
+ sleep 5
19
+ done
20
+
21
+
You can’t perform that action at this time.
0 commit comments