Skip to content

Commit 9ccb9af

Browse files
committed
Add a test
1 parent 9bbbe40 commit 9ccb9af

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
@@ -2436,6 +2436,109 @@ func Test_defaultModelBuilder_Build(t *testing.T) {
24362436
"80:3": null
24372437
}
24382438
}
2439+
}`,
2440+
},
2441+
{
2442+
name: "Ingress - wafv2AclArn in IngressClassParams",
2443+
env: env{
2444+
svcs: []*corev1.Service{ns_1_svc_1, ns_1_svc_2, ns_1_svc_3},
2445+
},
2446+
fields: fields{
2447+
resolveViaDiscoveryCalls: []resolveViaDiscoveryCall{resolveViaDiscoveryCallForInternalLB},
2448+
listLoadBalancersCalls: []listLoadBalancersCall{listLoadBalancerCallForEmptyLB},
2449+
enableBackendSG: true,
2450+
},
2451+
args: args{
2452+
ingGroup: Group{
2453+
ID: GroupID{Namespace: "ns-1", Name: "ing-1"},
2454+
Members: []ClassifiedIngress{
2455+
{
2456+
IngClassConfig: ClassConfiguration{
2457+
IngClassParams: &v1beta1.IngressClassParams{
2458+
Spec: v1beta1.IngressClassParamsSpec{
2459+
WAFv2ACLArn: "alb.ingress.kubernetes.io/wafv2-acl-arn: arn:aws:wafv2:us-west-2:xxxxx:regional/webacl/xxxxxxx/3ab78708-85b0-49d3-b4e1-7a9615a6613b",
2460+
},
2461+
},
2462+
},
2463+
Ing: &networking.Ingress{ObjectMeta: metav1.ObjectMeta{
2464+
Namespace: "ns-1",
2465+
Name: "ing-1",
2466+
},
2467+
Spec: networking.IngressSpec{
2468+
Rules: []networking.IngressRule{
2469+
{
2470+
Host: "app-1.example.com",
2471+
IngressRuleValue: networking.IngressRuleValue{
2472+
HTTP: &networking.HTTPIngressRuleValue{
2473+
Paths: []networking.HTTPIngressPath{
2474+
{
2475+
Path: "/svc-1",
2476+
Backend: networking.IngressBackend{
2477+
Service: &networking.IngressServiceBackend{
2478+
Name: ns_1_svc_1.Name,
2479+
Port: networking.ServiceBackendPort{
2480+
Name: "http",
2481+
},
2482+
},
2483+
},
2484+
},
2485+
{
2486+
Path: "/svc-2",
2487+
Backend: networking.IngressBackend{
2488+
Service: &networking.IngressServiceBackend{
2489+
Name: ns_1_svc_2.Name,
2490+
Port: networking.ServiceBackendPort{
2491+
Name: "http",
2492+
},
2493+
},
2494+
},
2495+
},
2496+
},
2497+
},
2498+
},
2499+
},
2500+
{
2501+
Host: "app-2.example.com",
2502+
IngressRuleValue: networking.IngressRuleValue{
2503+
HTTP: &networking.HTTPIngressRuleValue{
2504+
Paths: []networking.HTTPIngressPath{
2505+
{
2506+
Path: "/svc-3",
2507+
Backend: networking.IngressBackend{
2508+
Service: &networking.IngressServiceBackend{
2509+
Name: ns_1_svc_3.Name,
2510+
Port: networking.ServiceBackendPort{
2511+
Name: "https",
2512+
},
2513+
},
2514+
},
2515+
},
2516+
},
2517+
},
2518+
},
2519+
},
2520+
},
2521+
},
2522+
},
2523+
},
2524+
},
2525+
},
2526+
},
2527+
wantStackPatch: `
2528+
{
2529+
"id":"ns-1/ing-1",
2530+
"resources":{
2531+
"AWS::WAFv2::WebACLAssociation":{
2532+
"LoadBalancer":{
2533+
"spec":{
2534+
"resourceARN":{
2535+
"$ref":"#/resources/AWS::ElasticLoadBalancingV2::LoadBalancer/LoadBalancer/status/loadBalancerARN"
2536+
},
2537+
"webACLARN":"alb.ingress.kubernetes.io/wafv2-acl-arn: arn:aws:wafv2:us-west-2:xxxxx:regional/webacl/xxxxxxx/3ab78708-85b0-49d3-b4e1-7a9615a6613b"
2538+
}
2539+
}
2540+
}
2541+
}
24392542
}`,
24402543
},
24412544
{

0 commit comments

Comments
 (0)