From c19425ce6fce42d0d354e256143fa42347236d10 Mon Sep 17 00:00:00 2001 From: Markus Rudy Date: Thu, 30 Nov 2023 08:46:02 +0100 Subject: [PATCH] to be squashed: tidy up --- .../files/routing/experimental/all-nodes.sh | 6 ++---- .../files/routing/experimental/operator.sh | 18 ++++++++---------- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/dev-docs/howto/vpn/helm/files/routing/experimental/all-nodes.sh b/dev-docs/howto/vpn/helm/files/routing/experimental/all-nodes.sh index 52c6e83faa..81d9652ab4 100644 --- a/dev-docs/howto/vpn/helm/files/routing/experimental/all-nodes.sh +++ b/dev-docs/howto/vpn/helm/files/routing/experimental/all-nodes.sh @@ -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 @@ -45,7 +45,6 @@ cleanup_other() { done } - cleanup_exit() { cleanup_other cleanup_vpn @@ -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 diff --git a/dev-docs/howto/vpn/helm/files/routing/experimental/operator.sh b/dev-docs/howto/vpn/helm/files/routing/experimental/operator.sh index 942735b76d..39e5befcb6 100644 --- a/dev-docs/howto/vpn/helm/files/routing/experimental/operator.sh +++ b/dev-docs/howto/vpn/helm/files/routing/experimental/operator.sh @@ -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