From fa12a6f0776346e1f5b8df1cdf5804e4986a56a6 Mon Sep 17 00:00:00 2001 From: Marco Iorio Date: Tue, 5 Mar 2024 11:56:42 +0100 Subject: [PATCH] helm: remove bpf.masquerade autodetection logic 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 9ddd6d82c297 ("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 --- install/autodetect.go | 40 +--------------------------------------- 1 file changed, 1 insertion(+), 39 deletions(-) diff --git a/install/autodetect.go b/install/autodetect.go index 944a0d75d5..ea9890871d 100644 --- a/install/autodetect.go +++ b/install/autodetect.go @@ -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 { @@ -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 -}