Skip to content

Commit 4cf7c33

Browse files
authored
add objectSelector to the controller webhooks (#3165)
The service mutator and ingressclassparams validator webhooks ignore the services and the ingressclassparams resources included in the controller manifest. The webhook service is of type ClusterIP and need not be mutated by the webhook. This change resolves the cyclic dependency between the service and the mutator webhook. In the long term we will use the `matchConditions` once `AdmissionWebhookMatchConditions` feature is GA. As for the `ingressclassparams`, the webhook might not be available during chart install/upgrade time causing the operation to fail. This is a short term fix to get backward compatible behavior.
1 parent 4d40b00 commit 4cf7c33

File tree

6 files changed

+47
-5
lines changed

6 files changed

+47
-5
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
apiVersion: admissionregistration.k8s.io/v1
2+
kind: ValidatingWebhookConfiguration
3+
metadata:
4+
name: webhook
5+
webhooks:
6+
- name: vingressclassparams.elbv2.k8s.aws
7+
objectSelector:
8+
matchExpressions:
9+
- key: app.kubernetes.io/name
10+
operator: NotIn
11+
values:
12+
- aws-load-balancer-controller

config/webhook/kustomization.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,5 @@ configurations:
77

88
patchesStrategicMerge:
99
- pod_mutator_patch.yaml
10+
- service_mutator_patch.yaml
11+
- ingressclassparams_validator_patch.yaml
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
apiVersion: admissionregistration.k8s.io/v1
2+
kind: MutatingWebhookConfiguration
3+
metadata:
4+
name: webhook
5+
webhooks:
6+
- name: mservice.elbv2.k8s.aws
7+
objectSelector:
8+
matchExpressions:
9+
- key: app.kubernetes.io/name
10+
operator: NotIn
11+
values:
12+
- aws-load-balancer-controller

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
apiVersion: v2
22
name: aws-load-balancer-controller
33
description: AWS Load Balancer Controller Helm chart for Kubernetes
4-
version: 1.5.1
4+
version: 1.5.2
55
appVersion: v2.5.1
66
home: https://github.com/aws/eks-charts
77
icon: https://raw.githubusercontent.com/aws/eks-charts/master/docs/logo/aws.png

helm/aws-load-balancer-controller/templates/webhook.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,12 @@ webhooks:
6969
name: mservice.elbv2.k8s.aws
7070
admissionReviewVersions:
7171
- v1beta1
72+
objectSelector:
73+
matchExpressions:
74+
- key: app.kubernetes.io/name
75+
operator: NotIn
76+
values:
77+
- {{ include "aws-load-balancer-controller.name" . }}
7278
rules:
7379
- apiGroups:
7480
- ""
@@ -127,6 +133,12 @@ webhooks:
127133
name: vingressclassparams.elbv2.k8s.aws
128134
admissionReviewVersions:
129135
- v1beta1
136+
objectSelector:
137+
matchExpressions:
138+
- key: app.kubernetes.io/name
139+
operator: NotIn
140+
values:
141+
- {{ include "aws-load-balancer-controller.name" . }}
130142
rules:
131143
- apiGroups:
132144
- elbv2.k8s.aws

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

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,14 +119,18 @@ ingressClassParams:
119119
# The name of ingressClassParams resource will be referred in ingressClass
120120
name:
121121
spec: {}
122-
# You always can set specifications in `helm install` command through `--set` or `--set-string`
123-
# If you do want to specify specifications in values.yaml, uncomment the following
124-
# lines, adjust them as necessary, and remove the curly braces after 'spec:'.
122+
# Due to dependency issue, the validation webhook ignores this particular ingressClassParams resource.
123+
# We recommend creating ingressClassParams resources separately after installing this chart and the
124+
# controller is functional.
125+
#
126+
# You can set the specifications in the `helm install` command through `--set` or `--set-string`
127+
# If you do want to specify in the values.yaml, uncomment the following
128+
# lines, adjust them as necessary, and remove the curly braces after 'spec:'
129+
#
125130
# namespaceSelector:
126131
# matchLabels:
127132
# group:
128133
# scheme:
129-
# subnets:
130134
# ipAddressType:
131135
# tags:
132136
# loadBalancerAttributes:

0 commit comments

Comments
 (0)