Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci-datapath: Enable IPV6 masquerading when KPR=off #25111

Merged
merged 2 commits into from
Apr 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 8 additions & 5 deletions .github/workflows/conformance-datapath.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,6 @@ jobs:
tunnel: 'vxlan'
encryption: 'ipsec'
encryption-node: 'false'
ipv6: 'false' # until https://github.com/cilium/cilium/issues/23461 has been fixed

- name: '10'
kernel: '5.4-main'
Expand Down Expand Up @@ -343,9 +342,7 @@ jobs:
--rollback=false \
--config monitor-aggregation=none \
--nodes-without-cilium=kind-worker3 \
--helm-set-string=kubeProxyReplacement=${{ matrix.kpr }} \
--helm-set=bpf.masquerade=true \
--helm-set=enableIPv6Masquerade=false"
--helm-set-string=kubeProxyReplacement=${{ matrix.kpr }}"
TUNNEL="--helm-set-string=tunnelProtocol=${{ matrix.tunnel }}"
if [ "${{ matrix.tunnel }}" == "disabled" ]; then
TUNNEL="--helm-set-string=routingMode=native --helm-set-string=autoDirectNodeRoutes=true --helm-set-string=ipv4NativeRoutingCIDR=10.244.0.0/16"
Expand All @@ -363,6 +360,12 @@ jobs:
if [ "${{ matrix.ipv6 }}" != "false" ]; then
IPV6="--helm-set=ipv6.enabled=true"
fi
MASQ=""
if [ "${{ matrix.kpr }}" == "strict" ]; then
# BPF-masq requires KPR=strict.
# Disable IPv6 until https://github.com/cilium/cilium/issues/14350 has been resolved
MASQ="--helm-set=bpf.masquerade=true --helm-set=enableIPv6Masquerade=false"
fi
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't seem to understand this second commit... It says:

Enable v6 masquerading with KPR=off in ci-dp

...but enableIPv6Masquerade is still false,

More test coverage.

...but bpf.masquerade is now set to true only when KPR=strict (used to be set unconditionally).

Could you explain what's the idea of this change?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

...but enableIPv6Masquerade is still false,

If not specified, it defaults to true - https://github.com/cilium/cilium/blob/main/install/kubernetes/cilium/values.yaml#L1527

...but bpf.masquerade is now set to true only when KPR=strict

This is because of https://github.com/cilium/cilium/blob/main/daemon/cmd/daemon.go#L940 (KPR=strict means that NodePort is enabled).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is because of https://github.com/cilium/cilium/blob/main/daemon/cmd/daemon.go#L940

How did it work before? When KPR could be none, and bpf.masquerade was always enabled.

Copy link
Member Author

@brb brb Apr 27, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very good question. I wanted to figure out myself. Anyway:

level=warning msg="Falling back to iptables-based masquerading." error="BPF masquerade requires NodePort (--enable-node-port="true")" subsys=daemon

The agent automatically switched to the iptables-based masquerading.

EGRESS_GATEWAY=""
if [ "${{ matrix.egress-gateway }}" == "true" ]; then
EGRESS_GATEWAY="--helm-set=egressGateway.enabled=true"
Expand All @@ -385,7 +388,7 @@ jobs:
HOST_FW="--helm-set=hostFirewall.enabled=true"
fi

CONFIG="${CILIUM_INSTALL_DEFAULTS} ${TUNNEL} ${LB_MODE} ${ENDPOINT_ROUTES} ${IPV6} ${EGRESS_GATEWAY} ${ENCRYPT} ${HOST_FW} ${LB_ACCELERATION}"
CONFIG="${CILIUM_INSTALL_DEFAULTS} ${TUNNEL} ${LB_MODE} ${ENDPOINT_ROUTES} ${IPV6} ${MASQ} ${EGRESS_GATEWAY} ${ENCRYPT} ${HOST_FW} ${LB_ACCELERATION}"
echo "cilium_install_defaults=${CONFIG}" >> $GITHUB_OUTPUT

- name: Checkout pull request for Helm chart
Expand Down
17 changes: 0 additions & 17 deletions test/k8s/datapath_configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,23 +168,6 @@ var _ = Describe("K8sDatapathConfig", func() {
Expect(testPodHTTPToOutside(kubectl, "http://google.com", false, false, true)).
Should(BeTrue(), "IPv6 connectivity test to http://google.com failed")
})

// TODO(brb) Enable IPv6 masq in ci-datapath, and then drop this test case
It("Check iptables masquerading without random-fully", func() {
options := map[string]string{
"bpf.masquerade": "false",
"enableIPv6Masquerade": "true",
}
enableVXLANTunneling(options)
deploymentManager.DeployCilium(options, DeployCiliumOptionsAndDNS)
Expect(testPodConnectivityAcrossNodes(kubectl)).Should(BeTrue(), "Connectivity test between nodes failed")

By("Test iptables masquerading")
Expect(testPodHTTPToOutside(kubectl, "http://google.com", false, false, false)).
Should(BeTrue(), "IPv4 connectivity test to http://google.com failed")
Expect(testPodHTTPToOutside(kubectl, "http://google.com", false, false, true)).
Should(BeTrue(), "IPv6 connectivity test to http://google.com failed")
})
})

SkipContextIf(func() bool {
Expand Down