Skip to content

Commit

Permalink
fixup! dev-docs: full L3 connectivity in VPN chart
Browse files Browse the repository at this point in the history
  • Loading branch information
burgerdev committed Jan 5, 2024
1 parent efc297a commit 157cf12
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
10 changes: 5 additions & 5 deletions dev-docs/howto/vpn/helm/files/routing/operator.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ cep_patch() {
vpn_cidrs=$(for ip in ${VPN_PEER_CIDRS}; do printf '"%s" ' "${ip}"; done | jq -s -c -j)

masq_patch() {
kubectl -n kube-system get configmap ip-masq-agent -o json | \
jq -r .data.config | \
jq "{ masqLinkLocal: .masqLinkLocal, nonMasqueradeCIDRs: ((.nonMasqueradeCIDRs - ${vpn_cidrs}) + ${vpn_cidrs}) }" | \
jq '@json | [{op: "replace", path: "/data/config", value: . }]'
kubectl -n kube-system get configmap ip-masq-agent -o json |
jq -r .data.config |
jq "{ masqLinkLocal: .masqLinkLocal, nonMasqueradeCIDRs: ((.nonMasqueradeCIDRs - ${vpn_cidrs}) + ${vpn_cidrs}) }" |
jq '@json | [{op: "replace", path: "/data/config", value: . }]'
}

reconcile_masq() {
if ! kubectl -n kube-system get configmap ip-masq-agent >/dev/null; then
if ! kubectl -n kube-system get configmap ip-masq-agent > /dev/null; then
# We don't know enough to create an ip-masq-agent.
return 0
fi
Expand Down
22 changes: 11 additions & 11 deletions dev-docs/howto/vpn/helm/files/routing/sidecar.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,25 @@

reconcile_sip_verification() {

# Disable source IP verification on our network interface. Otherwise, VPN
# packets will be dropped by Cilium.
# Disable source IP verification on our network interface. Otherwise, VPN
# packets will be dropped by Cilium.

cilium_agent=$(pidof cilium-agent)
myip=$(ip -j addr show eth0 | jq -r '.[0].addr_info[] | select(.family == "inet") | .local')
cilium_agent=$(pidof cilium-agent)
myip=$(ip -j addr show eth0 | jq -r '.[0].addr_info[] | select(.family == "inet") | .local')

cilium() {
cilium() {
nsenter -t "${cilium_agent}" -a -r -w cilium "$@"
}
}

myendpoint=$(cilium endpoint get "ipv4:${myip}" | jq '.[0].id')
myendpoint=$(cilium endpoint get "ipv4:${myip}" | jq '.[0].id')

if [ "$(cilium endpoint config "${myendpoint}" -o json | jq -r .realized.options.SourceIPVerification)" = "Enabled" ]; then
cilium endpoint config "${myendpoint}" SourceIPVerification=Disabled
fi
if [ "$(cilium endpoint config "${myendpoint}" -o json | jq -r .realized.options.SourceIPVerification)" = "Enabled" ]; then
cilium endpoint config "${myendpoint}" SourceIPVerification=Disabled
fi

}

while true; do
reconcile_sip_verification
sleep 10
done
done

0 comments on commit 157cf12

Please sign in to comment.