Skip to content

Commit

Permalink
helm: remove bpf.masquerade autodetection logic
Browse files Browse the repository at this point in the history
The current logic is supposed to automatically enable BPF masquerade
when KPR is enabled, and IPv6 is not enabled. However, it looks like
it is broken since 9ddd6d8 ("install: Do not use individual
HelmOpts"), because we iterate on a map of maps containing the rendered
values, but attempt to match the values against --set strings.

Instead of fixing it, let's just remove this logic altogether for the
sake of simplicity. Additionally, it is potentially fragile, and may
lead to surprises to users (as well as in CI) given the difference with
respect to the default Cilium's values, and a plain helm install.

Signed-off-by: Marco Iorio <[email protected]>
  • Loading branch information
giorio94 authored and michi-covalent committed Mar 12, 2024
1 parent 27fef70 commit fa12a6f
Showing 1 changed file with 1 addition and 39 deletions.
40 changes: 1 addition & 39 deletions install/autodetect.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ func (k *K8sInstaller) autodetectAndValidate(ctx context.Context, helmValues map
}

k.autodetectKubeProxy(ctx)
return k.autoEnableBPFMasq()
return nil
}

func (k *K8sInstaller) autodetectKubeProxy(ctx context.Context) error {
Expand Down Expand Up @@ -224,41 +224,3 @@ func (k *K8sInstaller) autodetectKubeProxy(ctx context.Context) error {

return nil
}

func (k *K8sInstaller) autoEnableBPFMasq() error {
vals, err := k.getHelmValues()
if err != nil {
return err
}

// Auto-enable BPF masquerading if KPR=strict and IPv6=disabled
foundKPRStrict := false
foundMasq := false
enabledIPv6 := false
for _, param := range vals {
param, ok := param.(string)
if !ok {
continue
}

if !foundKPRStrict && param == "kubeProxyReplacement=strict" {
foundKPRStrict = true
continue
}
if strings.HasPrefix(param, "bpf.masquerade") {
foundMasq = true
break
}
if strings.HasPrefix(param, "ipv6.enabled=true") {
enabledIPv6 = true
break
}
}

if foundKPRStrict && !foundMasq && !enabledIPv6 {
k.params.HelmOpts.Values = append(k.params.HelmOpts.Values,
"bpf.masquerade=true")
}

return nil
}

0 comments on commit fa12a6f

Please sign in to comment.