Skip to content

Commit

Permalink
install: Do not use individual HelmOpts
Browse files Browse the repository at this point in the history
We need to merge the Helm opts before iterating over them, as they can
be defined via different fields.

Signed-off-by: Martynas Pumputis <[email protected]>
  • Loading branch information
brb authored and tklauser committed May 31, 2023
1 parent 89773cc commit 9ddd6d8
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions install/autodetect.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,7 @@ func (k *K8sInstaller) autodetectAndValidate(ctx context.Context) error {
}

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

func (k *K8sInstaller) autodetectKubeProxy(ctx context.Context) error {
Expand Down Expand Up @@ -261,12 +260,22 @@ func (k *K8sInstaller) autodetectKubeProxy(ctx context.Context) error {
return nil
}

func (k *K8sInstaller) autoEnableBPFMasq() {
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 := k.params.KubeProxyReplacement == "strict"
foundMasq := false
enabledIPv6 := false
for _, param := range k.params.HelmOpts.Values {
for _, param := range vals {
param, ok := param.(string)
if !ok {
continue
}

if !foundKPRStrict && param == "kubeProxyReplacement=strict" {
foundKPRStrict = true
continue
Expand All @@ -285,4 +294,6 @@ func (k *K8sInstaller) autoEnableBPFMasq() {
k.params.HelmOpts.Values = append(k.params.HelmOpts.Values,
"bpf.masquerade=true")
}

return nil
}

0 comments on commit 9ddd6d8

Please sign in to comment.