Skip to content

Commit 76eb84b

Browse files
author
Joshua Reed
committed
Rebase again, and add nginx run script.
1 parent 0d3a40e commit 76eb84b

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

hack/add_addresses.sh

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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+

0 commit comments

Comments
 (0)