Skip to content

Commit

Permalink
Merge pull request #122 from projectsyn/feat/bpf-masquerade
Browse files Browse the repository at this point in the history
Enable BPF masquerading by default
  • Loading branch information
simu authored Jul 10, 2024
2 parents b3215de + 8226840 commit f89cb0c
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 7 deletions.
2 changes: 1 addition & 1 deletion class/defaults.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ parameters:
egressGateway:
enabled: ${cilium:egress_gateway:enabled}
bpf:
masquerade: ${cilium:egress_gateway:enabled}
masquerade: true
l7Proxy: ${cilium:_egressgw_l7proxy:${cilium:egress_gateway:enabled}}
prometheus:
enabled: true
Expand Down
24 changes: 23 additions & 1 deletion component/render-helm-values.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,32 @@ local renderPodCIDRList = {
},
};

// Ensure that BPF masquerading is enabled when the Egress Gateway (or Egress
// Gateway HA)feature is enabled.
local forceBPFMasqueradeEgressGW = {
local egressGWHA =
std.get(
std.get(
std.get(self, 'enterprise', {}), 'egressGatewayHA', {}
),
'enabled',
false
),
local cfg = self,
bpf+: {
[if !super.bpf.masquerade && (cfg.egressGateway.enabled || egressGWHA) then 'masquerade']:
std.trace(
'Forcing BPF masquerading since Egress Gateway (or Egress Gateway HA) feature is enabled',
true
),
},
};

local cilium_values = std.prune(
params.cilium_helm_values +
replaceDeprecatedIPv4PodCIDR +
renderPodCIDRList
renderPodCIDRList +
forceBPFMasqueradeEgressGW
);

local helm_values = {
Expand Down
2 changes: 2 additions & 0 deletions docs/modules/ROOT/pages/references/parameters.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,8 @@ l7Proxy: false
Notably, the L7 proxy feature is disabled by default when egress gateway policies are enabled.
This is recommended by the Cilium documentation, see also https://docs.cilium.io/en/{helm-minor-version}/network/egress-gateway/#incompatibility-with-other-features[the upstream documentation].

Additionally, BPF masquerading can't be disabled when the egress gateway feature is enabled.

For Cilium EE, the component uses Helm value `egressGateway.enabled` for Helm value `enterprise.egressGatewayHA.enabled` by default.
It's possible to override this by explicitly setting `egressGateway.enabled=false` and `enterprise.egressGatewayHA.enabled=true` in the component's `cilium_helm_values`.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ data:
enable-auto-protect-node-port-range: 'true'
enable-bgp-control-plane: 'true'
enable-bpf-clock-probe: 'false'
enable-bpf-masquerade: 'false'
enable-bpf-masquerade: 'true'
enable-endpoint-health-checking: 'true'
enable-endpoint-routes: 'true'
enable-health-check-loadbalancer-ip: 'false'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ data:
enable-auto-protect-node-port-range: 'true'
enable-bgp-control-plane: 'false'
enable-bpf-clock-probe: 'false'
enable-bpf-masquerade: 'false'
enable-bpf-masquerade: 'true'
enable-endpoint-health-checking: 'true'
enable-endpoint-routes: 'true'
enable-health-check-loadbalancer-ip: 'false'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ data:
enable-auto-protect-node-port-range: 'true'
enable-bgp-control-plane: 'false'
enable-bpf-clock-probe: 'false'
enable-bpf-masquerade: 'false'
enable-bpf-masquerade: 'true'
enable-endpoint-health-checking: 'true'
enable-endpoint-routes: 'true'
enable-health-check-loadbalancer-ip: 'false'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ data:
enable-auto-protect-node-port-range: 'true'
enable-bgp-control-plane: 'false'
enable-bpf-clock-probe: 'false'
enable-bpf-masquerade: 'false'
enable-bpf-masquerade: 'true'
enable-endpoint-health-checking: 'true'
enable-endpoint-routes: 'true'
enable-health-check-loadbalancer-ip: 'false'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ spec:
secretNamespace:
name: cilium
bpf:
masquerade: false
masquerade: true
cni:
binPath: /var/lib/cni/bin
confPath: /var/run/multus/cni/net.d
Expand Down

0 comments on commit f89cb0c

Please sign in to comment.