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 committed May 31, 2023
1 parent 8bcf9b7 commit 3d8185a
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions install/autodetect.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,10 @@ func (k *K8sInstaller) autodetectAndValidate(ctx context.Context) error {
}

k.autodetectKubeProxy(ctx)
k.autoEnableBPFMasq()
if err := k.autoEnableBPFMasq(); err != nil {
return err
}

return nil
}

Expand Down Expand Up @@ -261,12 +264,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 +298,6 @@ func (k *K8sInstaller) autoEnableBPFMasq() {
k.params.HelmOpts.Values = append(k.params.HelmOpts.Values,
"bpf.masquerade=true")
}

return nil
}

0 comments on commit 3d8185a

Please sign in to comment.