Skip to content

Commit

Permalink
cni-server: fix failure in ipv6/dual clusters running in docker (#4417)
Browse files Browse the repository at this point in the history
Signed-off-by: zhangzujian <zhangzujian.7@gmail.com>
  • Loading branch information
zhangzujian authored Aug 20, 2024
1 parent 786eb0a commit c03dfd2
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 16 deletions.
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

0 comments on commit c03dfd2

Please sign in to comment.