Skip to content

Commit d50f3b9

Browse files
committed
Add WAFv2ACLArn field to IngressClassParams
1 parent 2b3f870 commit d50f3b9

File tree

6 files changed

+24
-3
lines changed

6 files changed

+24
-3
lines changed

apis/elbv2/v1beta1/ingressclassparams_types.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,10 @@ type IngressClassParamsSpec struct {
156156
// MinimumLoadBalancerCapacity define the capacity reservation for LoadBalancers for all Ingress that belong to IngressClass with this IngressClassParams.
157157
// +optional
158158
MinimumLoadBalancerCapacity *MinimumLoadBalancerCapacity `json:"minimumLoadBalancerCapacity,omitempty"`
159+
160+
// WAFv2ACLArn specifies ARN for the Amazon WAFv2 web ACL.
161+
// +optional
162+
WAFv2ACLArn string `json:"wafv2AclArn"`
159163
}
160164

161165
// +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
@@ -246,6 +246,9 @@ spec:
246246
- value
247247
type: object
248248
type: array
249+
wafv2AclArn:
250+
description: WAFv2ACLArn specifies ARN for the Amazon WAFv2 web ACL.
251+
type: string
249252
type: object
250253
type: object
251254
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: 9 additions & 2 deletions
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
@@ -251,4 +252,10 @@ They may specify `capacityUnits`. If the field is specified, LBC will ignore the
251252

252253
##### spec.minimumLoadBalancerCapacity.capacityUnits
253254

254-
If `capacityUnits` is specified, it must be to valid positive value greater than 0. If set to 0, the LBC will reset the capacity reservation for the load balancer.
255+
If `capacityUnits` is specified, it must be to valid positive value greater than 0. If set to 0, the LBC will reset the capacity reservation for the load balancer.
256+
257+
#### spec.wafv2AclArn
258+
259+
Cluster administrators can use the optional `wafv2AclArn` field to specify ARN for the Amazon WAFv2 web ACL.
260+
Only Regional WAFv2 is supported.
261+
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
@@ -245,6 +245,9 @@ spec:
245245
- value
246246
type: object
247247
type: array
248+
wafv2AclArn:
249+
description: WAFv2ACLArn specifies ARN for the Amazon WAFv2 web ACL.
250+
type: string
248251
type: object
249252
type: object
250253
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)