Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cni-server: fix failure in ipv6/dual clusters running in docker #4417

Merged
merged 1 commit into from
Aug 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 1 addition & 8 deletions charts/kube-ovn/templates/ovncni-ds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,7 @@ spec:
- --secure-serving={{- .Values.func.SECURE_SERVING }}
securityContext:
runAsUser: 0
privileged: false
capabilities:
add:
- NET_ADMIN
- NET_BIND_SERVICE
- NET_RAW
- SYS_ADMIN
- CAP_SYS_PTRACE
privileged: true
env:
- name: ENABLE_SSL
value: "{{ .Values.networking.ENABLE_SSL }}"
Expand Down
9 changes: 1 addition & 8 deletions dist/images/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4268,14 +4268,7 @@ spec:
- --secure-serving=${SECURE_SERVING}
securityContext:
runAsUser: 0
privileged: false
capabilities:
add:
- NET_ADMIN
- NET_BIND_SERVICE
- NET_RAW
- SYS_ADMIN
- CAP_SYS_PTRACE
privileged: true
env:
- name: ENABLE_SSL
value: "$ENABLE_SSL"
Expand Down
16 changes: 16 additions & 0 deletions pkg/daemon/ovs_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (
"time"

"github.com/containernetworking/plugins/pkg/ns"
"github.com/containernetworking/plugins/pkg/utils/sysctl"
"github.com/k8snetworkplumbingwg/sriovnet"
sriovutilfs "github.com/k8snetworkplumbingwg/sriovnet/pkg/utils/filesystem"
"github.com/vishvananda/netlink"
Expand Down Expand Up @@ -236,6 +237,21 @@ func configureContainerNic(nicName, ifName, ipAddr, gateway string, isDefaultRou
}
}

if util.CheckProtocol(ipAddr) == kubeovnv1.ProtocolDual || util.CheckProtocol(ipAddr) == kubeovnv1.ProtocolIPv6 {
// For docker version >=17.x the "none" network will disable ipv6 by default.
// We have to enable ipv6 here to add v6 address and gateway.
// See https://github.com/containernetworking/cni/issues/531
value, err := sysctl.Sysctl("net.ipv6.conf.all.disable_ipv6")
if err != nil {
return fmt.Errorf("failed to get sysctl net.ipv6.conf.all.disable_ipv6: %v", err)
}
if value != "0" {
if _, err = sysctl.Sysctl("net.ipv6.conf.all.disable_ipv6", "0"); err != nil {
return fmt.Errorf("failed to enable ipv6 on all nic: %v", err)
}
}
}

if nicType == util.InternalType {
if err = addAdditionalNic(ifName); err != nil {
return err
Expand Down
Loading