Skip to content

Commit 0ca2e1d

Browse files
committed
Add a test
1 parent c444097 commit 0ca2e1d

File tree

1 file changed

+103
-0
lines changed

1 file changed

+103
-0
lines changed

pkg/ingress/model_builder_test.go

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2743,6 +2743,109 @@ func Test_defaultModelBuilder_Build(t *testing.T) {
27432743
}
27442744
}
27452745
}
2746+
}`,
2747+
},
2748+
{
2749+
name: "Ingress - wafv2AclArn in IngressClassParams",
2750+
env: env{
2751+
svcs: []*corev1.Service{ns_1_svc_1, ns_1_svc_2, ns_1_svc_3},
2752+
},
2753+
fields: fields{
2754+
resolveViaDiscoveryCalls: []resolveViaDiscoveryCall{resolveViaDiscoveryCallForInternalLB},
2755+
listLoadBalancersCalls: []listLoadBalancersCall{listLoadBalancerCallForEmptyLB},
2756+
enableBackendSG: true,
2757+
},
2758+
args: args{
2759+
ingGroup: Group{
2760+
ID: GroupID{Namespace: "ns-1", Name: "ing-1"},
2761+
Members: []ClassifiedIngress{
2762+
{
2763+
IngClassConfig: ClassConfiguration{
2764+
IngClassParams: &v1beta1.IngressClassParams{
2765+
Spec: v1beta1.IngressClassParamsSpec{
2766+
WAFv2ACLArn: "alb.ingress.kubernetes.io/wafv2-acl-arn: arn:aws:wafv2:us-west-2:xxxxx:regional/webacl/xxxxxxx/3ab78708-85b0-49d3-b4e1-7a9615a6613b",
2767+
},
2768+
},
2769+
},
2770+
Ing: &networking.Ingress{ObjectMeta: metav1.ObjectMeta{
2771+
Namespace: "ns-1",
2772+
Name: "ing-1",
2773+
},
2774+
Spec: networking.IngressSpec{
2775+
Rules: []networking.IngressRule{
2776+
{
2777+
Host: "app-1.example.com",
2778+
IngressRuleValue: networking.IngressRuleValue{
2779+
HTTP: &networking.HTTPIngressRuleValue{
2780+
Paths: []networking.HTTPIngressPath{
2781+
{
2782+
Path: "/svc-1",
2783+
Backend: networking.IngressBackend{
2784+
Service: &networking.IngressServiceBackend{
2785+
Name: ns_1_svc_1.Name,
2786+
Port: networking.ServiceBackendPort{
2787+
Name: "http",
2788+
},
2789+
},
2790+
},
2791+
},
2792+
{
2793+
Path: "/svc-2",
2794+
Backend: networking.IngressBackend{
2795+
Service: &networking.IngressServiceBackend{
2796+
Name: ns_1_svc_2.Name,
2797+
Port: networking.ServiceBackendPort{
2798+
Name: "http",
2799+
},
2800+
},
2801+
},
2802+
},
2803+
},
2804+
},
2805+
},
2806+
},
2807+
{
2808+
Host: "app-2.example.com",
2809+
IngressRuleValue: networking.IngressRuleValue{
2810+
HTTP: &networking.HTTPIngressRuleValue{
2811+
Paths: []networking.HTTPIngressPath{
2812+
{
2813+
Path: "/svc-3",
2814+
Backend: networking.IngressBackend{
2815+
Service: &networking.IngressServiceBackend{
2816+
Name: ns_1_svc_3.Name,
2817+
Port: networking.ServiceBackendPort{
2818+
Name: "https",
2819+
},
2820+
},
2821+
},
2822+
},
2823+
},
2824+
},
2825+
},
2826+
},
2827+
},
2828+
},
2829+
},
2830+
},
2831+
},
2832+
},
2833+
},
2834+
wantStackPatch: `
2835+
{
2836+
"id":"ns-1/ing-1",
2837+
"resources":{
2838+
"AWS::WAFv2::WebACLAssociation":{
2839+
"LoadBalancer":{
2840+
"spec":{
2841+
"resourceARN":{
2842+
"$ref":"#/resources/AWS::ElasticLoadBalancingV2::LoadBalancer/LoadBalancer/status/loadBalancerARN"
2843+
},
2844+
"webACLARN":"alb.ingress.kubernetes.io/wafv2-acl-arn: arn:aws:wafv2:us-west-2:xxxxx:regional/webacl/xxxxxxx/3ab78708-85b0-49d3-b4e1-7a9615a6613b"
2845+
}
2846+
}
2847+
}
2848+
}
27462849
}`,
27472850
},
27482851
{

0 commit comments

Comments
 (0)