Merge pull request #55578 from xiangpengzhao/validatePodCidr
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. Validate podCIDR of node spec. **Release note**: ```release-note NONE ```
This commit is contained in:
@@ -8273,6 +8273,24 @@ func TestValidateNode(t *testing.T) {
|
||||
ExternalID: "external",
|
||||
},
|
||||
},
|
||||
{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "abc",
|
||||
},
|
||||
Status: core.NodeStatus{
|
||||
Addresses: []core.NodeAddress{
|
||||
{Type: core.NodeExternalIP, Address: "something"},
|
||||
},
|
||||
Capacity: core.ResourceList{
|
||||
core.ResourceName(core.ResourceCPU): resource.MustParse("10"),
|
||||
core.ResourceName(core.ResourceMemory): resource.MustParse("0"),
|
||||
},
|
||||
},
|
||||
Spec: core.NodeSpec{
|
||||
ExternalID: "external",
|
||||
PodCIDR: "192.168.0.0/16",
|
||||
},
|
||||
},
|
||||
}
|
||||
for _, successCase := range successCases {
|
||||
if errs := ValidateNode(&successCase); len(errs) != 0 {
|
||||
@@ -8496,6 +8514,24 @@ func TestValidateNode(t *testing.T) {
|
||||
ExternalID: "external",
|
||||
},
|
||||
},
|
||||
"invalid-pod-cidr": {
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "abc",
|
||||
},
|
||||
Status: core.NodeStatus{
|
||||
Addresses: []core.NodeAddress{
|
||||
{Type: core.NodeExternalIP, Address: "something"},
|
||||
},
|
||||
Capacity: core.ResourceList{
|
||||
core.ResourceName(core.ResourceCPU): resource.MustParse("10"),
|
||||
core.ResourceName(core.ResourceMemory): resource.MustParse("0"),
|
||||
},
|
||||
},
|
||||
Spec: core.NodeSpec{
|
||||
ExternalID: "external",
|
||||
PodCIDR: "192.168.0.0",
|
||||
},
|
||||
},
|
||||
}
|
||||
for k, v := range errorCases {
|
||||
errs := ValidateNode(&v)
|
||||
|
Reference in New Issue
Block a user