Skip to content

Commit

Permalink
add ipv6 unsupport for nerdctl
Browse files Browse the repository at this point in the history
  • Loading branch information
yankay committed Oct 26, 2023
1 parent 0595203 commit 6dc2409
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pkg/cluster/internal/providers/docker/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ func ensureNetwork(name string) error {
// https://github.com/kubernetes-sigs/kind/issues/1544
// Otherwise if it's not a pool overlap error, fail
// If it is, make more attempts below
if isIPv6UnavailableError(err) {
if isIPv6UnavailableError(err) || isIPv6UnSupportError(err) {
// only one attempt, IPAM is automatic in ipv4 only
return createNetworkNoDuplicates(name, "", mtu)
}
Expand Down Expand Up @@ -264,6 +264,12 @@ func isIPv6UnavailableError(err error) bool {
return rerr != nil && strings.HasPrefix(string(rerr.Output), "Error response from daemon: Cannot read IPv6 setup for bridge")
}

// The nerdctl do not support the ipv6 network, https://github.com/containerd/nerdctl/issues/1547
func isIPv6UnSupportError(err error) bool {
rerr := exec.RunErrorForError(err)
return rerr != nil && strings.Contains(string(rerr.Output), "unknown flag: --ipv6")
}

func isPoolOverlapError(err error) bool {
rerr := exec.RunErrorForError(err)
return rerr != nil && strings.HasPrefix(string(rerr.Output), "Error response from daemon: Pool overlaps with other one on this address space") || strings.Contains(string(rerr.Output), "networks have overlapping")
Expand Down

0 comments on commit 6dc2409

Please sign in to comment.