Skip to content

Commit 3f711d0

Browse files
committed
Add WAFv2ACLArn field to IngressClassParams
1 parent 1824e8e commit 3f711d0

File tree

6 files changed

+23
-2
lines changed

6 files changed

+23
-2
lines changed

apis/elbv2/v1beta1/ingressclassparams_types.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,10 @@ type IngressClassParamsSpec struct {
170170

171171
// PrefixListsIDs defines the security group prefix lists for all Ingresses that belong to IngressClass with this IngressClassParams.
172172
PrefixListsIDs []string `json:"PrefixListsIDs,omitempty"`
173+
174+
// WAFv2ACLArn specifies ARN for the Amazon WAFv2 web ACL.
175+
// +optional
176+
WAFv2ACLArn string `json:"wafv2AclArn"`
173177
}
174178

175179
// +kubebuilder:object:root=true

config/crd/bases/elbv2.k8s.aws_ingressclassparams.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,9 @@ spec:
261261
- value
262262
type: object
263263
type: array
264+
wafv2AclArn:
265+
description: WAFv2ACLArn specifies ARN for the Amazon WAFv2 web ACL.
266+
type: string
264267
type: object
265268
type: object
266269
served: true

config/webhook/manifests.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
---
21
apiVersion: admissionregistration.k8s.io/v1
32
kind: MutatingWebhookConfiguration
43
metadata:

docs/guide/ingress/ingress_class.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,8 +187,9 @@ Cluster administrators can use the optional `inboundCIDRs` field to specify the
187187
If the field is specified, LBC will ignore the `alb.ingress.kubernetes.io/inbound-cidrs` annotation.
188188

189189
#### spec.certificateArn
190+
190191
Cluster administrators can use the optional `certificateARN` field to specify the ARN of the certificates for all Ingresses that belong to IngressClass with this IngressClassParams.
191-
192+
192193
If the field is specified, LBC will ignore the `alb.ingress.kubernetes.io/certificate-arn` annotation.
193194

194195
#### spec.sslPolicy
@@ -267,3 +268,9 @@ Cluster administrators can use `prefixListIDs` field to specify the managed pref
267268

268269
1. If `prefixListIDs` is set, the prefix lists defined will be applied to the load balancer that belong to this IngressClass. If you specify invalid prefix list IDs, the controller will fail to reconcile ingresses belonging to the particular ingress class.
269270
2. If `prefixListIDs` un-specified, Ingresses with this IngressClass can continue to use `alb.ingress.kubernetes.io/security-group-prefix-lists` annotation to specify the load balancer prefix lists.
271+
272+
#### spec.wafv2AclArn
273+
274+
Cluster administrators can use the optional `wafv2AclArn` field to specify ARN for the Amazon WAFv2 web ACL.
275+
Only Regional WAFv2 is supported.
276+
When this annotation is absent or empty, the controller will keep LoadBalancer WAFv2 settings unchanged. To disable WAFv2, explicitly set the annotation value to 'none'.

helm/aws-load-balancer-controller/crds/crds.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,9 @@ spec:
260260
- value
261261
type: object
262262
type: array
263+
wafv2AclArn:
264+
description: WAFv2ACLArn specifies ARN for the Amazon WAFv2 web ACL.
265+
type: string
263266
type: object
264267
type: object
265268
served: true

pkg/ingress/model_build_load_balancer_addons.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package ingress
22

33
import (
44
"context"
5+
56
"github.com/pkg/errors"
67
"k8s.io/apimachinery/pkg/util/sets"
78
"sigs.k8s.io/aws-load-balancer-controller/pkg/annotations"
@@ -39,6 +40,10 @@ func (t *defaultModelBuildTask) buildWAFv2WebACLAssociation(_ context.Context, l
3940
if rawWebACLARN != "" {
4041
explicitWebACLARNs.Insert(rawWebACLARN)
4142
}
43+
params := member.IngClassConfig.IngClassParams
44+
if params != nil && params.Spec.WAFv2ACLArn != "" {
45+
explicitWebACLARNs.Insert(params.Spec.WAFv2ACLArn)
46+
}
4247
}
4348
if len(explicitWebACLARNs) == 0 {
4449
return nil, nil

0 commit comments

Comments
 (0)