mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-04 09:49:50 +00:00
Make a certain ipv4-vs-ipv6 config error non-fatal, for backward compat
This commit is contained in:
parent
f19b62fc09
commit
b2f0052d27
@ -678,7 +678,7 @@ func checkIPConfig(s *ProxyServer, dualStackSupported bool) (error, bool) {
|
|||||||
clusterCIDRs := strings.Split(s.Config.ClusterCIDR, ",")
|
clusterCIDRs := strings.Split(s.Config.ClusterCIDR, ",")
|
||||||
if badCIDRs(clusterCIDRs, badFamily) {
|
if badCIDRs(clusterCIDRs, badFamily) {
|
||||||
errors = append(errors, fmt.Errorf("cluster is %s but clusterCIDRs contains only IPv%s addresses", clusterType, badFamily))
|
errors = append(errors, fmt.Errorf("cluster is %s but clusterCIDRs contains only IPv%s addresses", clusterType, badFamily))
|
||||||
if s.Config.DetectLocalMode == kubeproxyconfig.LocalModeClusterCIDR {
|
if s.Config.DetectLocalMode == kubeproxyconfig.LocalModeClusterCIDR && !dualStackSupported {
|
||||||
// This has always been a fatal error
|
// This has always been a fatal error
|
||||||
fatal = true
|
fatal = true
|
||||||
}
|
}
|
||||||
|
@ -820,8 +820,9 @@ func Test_checkIPConfig(t *testing.T) {
|
|||||||
name string
|
name string
|
||||||
proxy *ProxyServer
|
proxy *ProxyServer
|
||||||
ssErr bool
|
ssErr bool
|
||||||
|
ssFatal bool
|
||||||
dsErr bool
|
dsErr bool
|
||||||
fatal bool
|
dsFatal bool
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
name: "empty config",
|
name: "empty config",
|
||||||
@ -875,8 +876,9 @@ func Test_checkIPConfig(t *testing.T) {
|
|||||||
PrimaryIPFamily: v1.IPv4Protocol,
|
PrimaryIPFamily: v1.IPv4Protocol,
|
||||||
},
|
},
|
||||||
ssErr: true,
|
ssErr: true,
|
||||||
|
ssFatal: false,
|
||||||
dsErr: true,
|
dsErr: true,
|
||||||
fatal: false,
|
dsFatal: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "wrong-family clusterCIDR when using ClusterCIDR LocalDetector",
|
name: "wrong-family clusterCIDR when using ClusterCIDR LocalDetector",
|
||||||
@ -888,8 +890,9 @@ func Test_checkIPConfig(t *testing.T) {
|
|||||||
PrimaryIPFamily: v1.IPv4Protocol,
|
PrimaryIPFamily: v1.IPv4Protocol,
|
||||||
},
|
},
|
||||||
ssErr: true,
|
ssErr: true,
|
||||||
|
ssFatal: true,
|
||||||
dsErr: true,
|
dsErr: true,
|
||||||
fatal: true,
|
dsFatal: false,
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
@ -934,8 +937,9 @@ func Test_checkIPConfig(t *testing.T) {
|
|||||||
PrimaryIPFamily: v1.IPv6Protocol,
|
PrimaryIPFamily: v1.IPv6Protocol,
|
||||||
},
|
},
|
||||||
ssErr: true,
|
ssErr: true,
|
||||||
|
ssFatal: false,
|
||||||
dsErr: true,
|
dsErr: true,
|
||||||
fatal: false,
|
dsFatal: false,
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
@ -984,8 +988,9 @@ func Test_checkIPConfig(t *testing.T) {
|
|||||||
podCIDRs: []string{"fd01:2345::/64"},
|
podCIDRs: []string{"fd01:2345::/64"},
|
||||||
},
|
},
|
||||||
ssErr: true,
|
ssErr: true,
|
||||||
|
ssFatal: true,
|
||||||
dsErr: true,
|
dsErr: true,
|
||||||
fatal: true,
|
dsFatal: true,
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
@ -1012,8 +1017,9 @@ func Test_checkIPConfig(t *testing.T) {
|
|||||||
PrimaryIPFamily: v1.IPv4Protocol,
|
PrimaryIPFamily: v1.IPv4Protocol,
|
||||||
},
|
},
|
||||||
ssErr: true,
|
ssErr: true,
|
||||||
|
ssFatal: false,
|
||||||
dsErr: true,
|
dsErr: true,
|
||||||
fatal: false,
|
dsFatal: false,
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
@ -1058,8 +1064,8 @@ func Test_checkIPConfig(t *testing.T) {
|
|||||||
PrimaryIPFamily: v1.IPv6Protocol,
|
PrimaryIPFamily: v1.IPv6Protocol,
|
||||||
},
|
},
|
||||||
ssErr: true,
|
ssErr: true,
|
||||||
|
ssFatal: false,
|
||||||
dsErr: false,
|
dsErr: false,
|
||||||
fatal: false,
|
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
@ -1086,8 +1092,8 @@ func Test_checkIPConfig(t *testing.T) {
|
|||||||
PrimaryIPFamily: v1.IPv6Protocol,
|
PrimaryIPFamily: v1.IPv6Protocol,
|
||||||
},
|
},
|
||||||
ssErr: true,
|
ssErr: true,
|
||||||
|
ssFatal: false,
|
||||||
dsErr: false,
|
dsErr: false,
|
||||||
fatal: false,
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1098,8 +1104,8 @@ func Test_checkIPConfig(t *testing.T) {
|
|||||||
t.Errorf("unexpected error in single-stack case: %v", err)
|
t.Errorf("unexpected error in single-stack case: %v", err)
|
||||||
} else if err == nil && c.ssErr {
|
} else if err == nil && c.ssErr {
|
||||||
t.Errorf("unexpected lack of error in single-stack case")
|
t.Errorf("unexpected lack of error in single-stack case")
|
||||||
} else if fatal != c.fatal {
|
} else if fatal != c.ssFatal {
|
||||||
t.Errorf("expected fatal=%v, got %v", c.fatal, fatal)
|
t.Errorf("expected fatal=%v, got %v", c.ssFatal, fatal)
|
||||||
}
|
}
|
||||||
|
|
||||||
err, fatal = checkIPConfig(c.proxy, true)
|
err, fatal = checkIPConfig(c.proxy, true)
|
||||||
@ -1107,8 +1113,8 @@ func Test_checkIPConfig(t *testing.T) {
|
|||||||
t.Errorf("unexpected error in dual-stack case: %v", err)
|
t.Errorf("unexpected error in dual-stack case: %v", err)
|
||||||
} else if err == nil && c.dsErr {
|
} else if err == nil && c.dsErr {
|
||||||
t.Errorf("unexpected lack of error in dual-stack case")
|
t.Errorf("unexpected lack of error in dual-stack case")
|
||||||
} else if fatal != c.fatal {
|
} else if fatal != c.dsFatal {
|
||||||
t.Errorf("expected fatal=%v, got %v", c.fatal, fatal)
|
t.Errorf("expected fatal=%v, got %v", c.dsFatal, fatal)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user