mirror of https://github.com/k3s-io/k3s
Merge pull request #58690 from adohe/validate_er_name
Automatic merge from submit-queue (batch tested with PRs 58690, 64773, 64880, 64915, 64831). 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>. add extended resource name validation @smarterclayton I dont know who is in charge of extended resource, so just assign this to you. This is a quite simple PR, just add extended resource name validation test case, as we validate extended resource quantity and overcommit. ```release-note NONE ```pull/8/head
commit
c7da0a52e1
|
@ -7480,6 +7480,31 @@ func TestValidatePod(t *testing.T) {
|
|||
Spec: validPodSpec(nil),
|
||||
},
|
||||
},
|
||||
"invalid extended resource name in container request": {
|
||||
expectedError: "must be a standard resource for containers",
|
||||
spec: core.Pod{
|
||||
ObjectMeta: metav1.ObjectMeta{Name: "123", Namespace: "ns"},
|
||||
Spec: core.PodSpec{
|
||||
Containers: []core.Container{
|
||||
{
|
||||
Name: "invalid",
|
||||
Image: "image",
|
||||
ImagePullPolicy: "IfNotPresent",
|
||||
Resources: core.ResourceRequirements{
|
||||
Requests: core.ResourceList{
|
||||
core.ResourceName("invalid-name"): resource.MustParse("2"),
|
||||
},
|
||||
Limits: core.ResourceList{
|
||||
core.ResourceName("invalid-name"): resource.MustParse("2"),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
RestartPolicy: core.RestartPolicyAlways,
|
||||
DNSPolicy: core.DNSClusterFirst,
|
||||
},
|
||||
},
|
||||
},
|
||||
"invalid extended resource requirement: request must be == limit": {
|
||||
expectedError: "must be equal to example.com/a",
|
||||
spec: core.Pod{
|
||||
|
|
Loading…
Reference in New Issue