Merge pull request #115447 from kidddddddddddddddddddddd/ingress

[ingress] Create with ingressClass annotation and IngressClassName both set
This commit is contained in:
Kubernetes Prow Robot
2023-03-15 02:02:16 -07:00
committed by GitHub
3 changed files with 25 additions and 5 deletions

View File

@@ -993,12 +993,19 @@ func TestValidateIngressCreate(t *testing.T) {
},
expectedErrs: field.ErrorList{},
},
"class field and annotation set": {
"class field and annotation set with same value": {
tweakIngress: func(ingress *networking.Ingress) {
ingress.Spec.IngressClassName = utilpointer.String("foo")
ingress.Annotations = map[string]string{annotationIngressClass: "foo"}
},
expectedErrs: field.ErrorList{},
},
"class field and annotation set with different value": {
tweakIngress: func(ingress *networking.Ingress) {
ingress.Spec.IngressClassName = utilpointer.String("bar")
ingress.Annotations = map[string]string{annotationIngressClass: "foo"}
},
expectedErrs: field.ErrorList{field.Invalid(field.NewPath("annotations").Child(annotationIngressClass), "foo", "can not be set when the class field is also set")},
expectedErrs: field.ErrorList{field.Invalid(field.NewPath("annotations").Child(annotationIngressClass), "foo", "must match `ingressClassName` when both are specified")},
},
"valid regex path": {
tweakIngress: func(ingress *networking.Ingress) {