mirror of
https://github.com/kubernetes-sigs/kind.git
synced 2025-12-01 07:26:05 +07:00
Merge pull request #3483 from tnqn/validate-ip-family
Add ipFamily validation
This commit is contained in:
@@ -52,6 +52,11 @@ func (c *Cluster) Validate() error {
|
||||
}
|
||||
}
|
||||
|
||||
// ipFamily should be ipv4, ipv6, or dual
|
||||
if c.Networking.IPFamily != IPv4Family && c.Networking.IPFamily != IPv6Family && c.Networking.IPFamily != DualStackFamily {
|
||||
errs = append(errs, errors.Errorf("invalid ipFamily: %s", c.Networking.IPFamily))
|
||||
}
|
||||
|
||||
// podSubnet should be a valid CIDR
|
||||
if err := validateSubnets(c.Networking.PodSubnet, c.Networking.IPFamily); err != nil {
|
||||
errs = append(errs, errors.Errorf("invalid pod subnet %v", err))
|
||||
|
||||
@@ -97,6 +97,16 @@ func TestClusterValidate(t *testing.T) {
|
||||
}(),
|
||||
ExpectErrors: 1,
|
||||
},
|
||||
{
|
||||
Name: "bogus ipFamily",
|
||||
Cluster: func() Cluster {
|
||||
c := Cluster{}
|
||||
SetDefaultsCluster(&c)
|
||||
c.Networking.IPFamily = "ds"
|
||||
return c
|
||||
}(),
|
||||
ExpectErrors: 1,
|
||||
},
|
||||
{
|
||||
Name: "bogus serviceSubnet",
|
||||
Cluster: func() Cluster {
|
||||
|
||||
Reference in New Issue
Block a user