Skip to content

Commit

Permalink
to be squashed: tidy up
Browse files Browse the repository at this point in the history
  • Loading branch information
burgerdev committed Nov 30, 2023
1 parent fbc4736 commit c19425c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ cleanup_vpn() {
}

reconcile_other() {
cleanup_vpn 2>/dev/null
cleanup_vpn 2> /dev/null
for cidr in ${VPN_PEER_CIDRS}; do
ip route replace "${cidr}" dev cilium_wg0
done
Expand All @@ -45,7 +45,6 @@ cleanup_other() {
done
}


cleanup_exit() {
cleanup_other
cleanup_vpn
Expand All @@ -57,8 +56,7 @@ trap cleanup_exit INT TERM
# the routing rules periodically.

while true; do
if ip link show "${MAGIC_INTERFACE}" 2>/dev/null >&2
then
if ip link show "${MAGIC_INTERFACE}" 2> /dev/null >&2; then
reconcile_vpn
else
reconcile_other
Expand Down
18 changes: 8 additions & 10 deletions dev-docs/howto/vpn/helm/files/routing/experimental/operator.sh
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
#!/bin/sh


all_ips() {
kubectl get pods vpn-frontend-0 -o go-template --template '{{ range .status.podIPs }}{{ printf "%s " .ip }}{{ end }}'
echo "${VPN_PEER_CIDRS}"
kubectl get pods vpn-frontend-0 -o go-template --template '{{ range .status.podIPs }}{{ printf "%s " .ip }}{{ end }}'
echo "${VPN_PEER_CIDRS}"
}

cep_patch() {
printf '[{"op": "replace", "path": "/status/networking/addressing", "value": '
for ip in $(all_ips); do printf '{"ipv4": "%s"}' "${ip}"; done | jq -s -c -j
echo '}]'
printf '[{"op": "replace", "path": "/status/networking/addressing", "value": '
for ip in $(all_ips); do printf '{"ipv4": "%s"}' "${ip}"; done | jq -s -c -j
echo '}]'
}

while true
do
kubectl patch ciliumendpoint vpn-frontend-0 --type json --patch "$(cep_patch)" >/dev/null
sleep 10
while true; do
kubectl patch ciliumendpoint vpn-frontend-0 --type json --patch "$(cep_patch)" > /dev/null
sleep 10
done

0 comments on commit c19425c

Please sign in to comment.