Skip to content

Commit 239bc7d

Browse files
committed
add ipv6 unsupport for nerdctl
Signed-off-by: Kay Yan <[email protected]>
1 parent 0595203 commit 239bc7d

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

pkg/cluster/internal/providers/docker/network.go

+7-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ func ensureNetwork(name string) error {
7777
// https://github.com/kubernetes-sigs/kind/issues/1544
7878
// Otherwise if it's not a pool overlap error, fail
7979
// If it is, make more attempts below
80-
if isIPv6UnavailableError(err) {
80+
if isIPv6UnavailableError(err) || isIPv6UnsupportError(err) {
8181
// only one attempt, IPAM is automatic in ipv4 only
8282
return createNetworkNoDuplicates(name, "", mtu)
8383
}
@@ -264,6 +264,12 @@ func isIPv6UnavailableError(err error) bool {
264264
return rerr != nil && strings.HasPrefix(string(rerr.Output), "Error response from daemon: Cannot read IPv6 setup for bridge")
265265
}
266266

267+
// The nerdctl do not support the ipv6 network, https://github.com/containerd/nerdctl/issues/1547
268+
func isIPv6UnsupportError(err error) bool {
269+
rerr := exec.RunErrorForError(err)
270+
return rerr != nil && strings.Contains(string(rerr.Output), "unknown flag: --ipv6")
271+
}
272+
267273
func isPoolOverlapError(err error) bool {
268274
rerr := exec.RunErrorForError(err)
269275
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")

0 commit comments

Comments
 (0)