Skip to content

Commit b8217a3

Browse files
committed
Add WAFv2ACLArn field to IngressClassParams
1 parent 8ba34e2 commit b8217a3

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
@@ -146,6 +146,10 @@ type IngressClassParamsSpec struct {
146146
// Listeners define a list of listeners with their protocol, port and attributes.
147147
// +optional
148148
Listeners []Listener `json:"listeners,omitempty"`
149+
150+
// WAFv2ACLArn specifies ARN for the Amazon WAFv2 web ACL.
151+
// +optional
152+
WAFv2ACLArn string `json:"wafv2AclArn"`
149153
}
150154

151155
// +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
@@ -234,6 +234,9 @@ spec:
234234
- value
235235
type: object
236236
type: array
237+
wafv2AclArn:
238+
description: WAFv2ACLArn specifies ARN for the Amazon WAFv2 web ACL.
239+
type: string
237240
type: object
238241
type: object
239242
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
@@ -177,8 +177,9 @@ Cluster administrators can use the optional `inboundCIDRs` field to specify the
177177
If the field is specified, LBC will ignore the `alb.ingress.kubernetes.io/inbound-cidrs` annotation.
178178

179179
#### spec.certificateArn
180+
180181
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.
181-
182+
182183
If the field is specified, LBC will ignore the `alb.ingress.kubernetes.io/certificate-arn` annotation.
183184

184185
#### spec.sslPolicy
@@ -233,3 +234,9 @@ Cluster administrators can use `loadBalancerAttributes` field to specify the [Lo
233234

234235
1. If `loadBalancerAttributes` is set, the attributes defined will be applied to the load balancer that belong to this IngressClass. If you specify invalid keys or values for the load balancer attributes, the controller will fail to reconcile ingresses belonging to the particular ingress class.
235236
2. If `loadBalancerAttributes` un-specified, Ingresses with this IngressClass can continue to use `alb.ingress.kubernetes.io/load-balancer-attributes` annotation to specify the load balancer attributes.
237+
238+
#### spec.wafv2AclArn
239+
240+
Cluster administrators can use the optional `wafv2AclArn` field to specify ARN for the Amazon WAFv2 web ACL.
241+
Only Regional WAFv2 is supported.
242+
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
@@ -233,6 +233,9 @@ spec:
233233
- value
234234
type: object
235235
type: array
236+
wafv2AclArn:
237+
description: WAFv2ACLArn specifies ARN for the Amazon WAFv2 web ACL.
238+
type: string
236239
type: object
237240
type: object
238241
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)