Skip to content

Commit 526b830

Browse files
authored
add toggle to adjust failurePolicy of pod webhook and documentations (#4063)
the vulcheck failed due to other reasons.
1 parent 9ab7f9d commit 526b830

File tree

5 files changed

+26
-2
lines changed

5 files changed

+26
-2
lines changed

config/webhook/manifests.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ webhooks:
1111
name: webhook-service
1212
namespace: system
1313
path: /mutate-v1-pod
14-
failurePolicy: Fail
14+
failurePolicy: Ignore
1515
name: mpod.elbv2.k8s.aws
1616
rules:
1717
- apiGroups:

docs/deploy/pod_readiness_gate.md

+15
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,21 @@ The readiness gates have the prefix `target-health.elbv2.k8s.aws` and the contro
4747
!!!tip "create ingress or service before pod"
4848
To ensure all of your pods in a namespace get the readiness gate config, you need create your Ingress or Service and label the namespace before creating the pods
4949

50+
## FailurePolicy
51+
The `failurePolicy` of a webhook determines how errors, such as unrecognized or timeout errors, are handled by the admission webhook.
52+
53+
* `failurePolicy: Fail`: When applied to a pod mutation webhook, this setting will prevent the launch of any pods in labeled namespaces if the AWSLoadBalancerController pods are unavailable. While this can help avoid incomplete or faulty deployments, it could also delay the cluster's recovery in extreme scenarios, such as an API Server outage.
54+
* `failurePolicy: Ignore`: Setting this policy allows Kubernetes to proceed with pod deployments even if the AWSLoadBalancerController pods are unavailable. This can lead to availability risks for applications since Kubernetes may terminate application pods before the new pods have become healthy in the TargetGroups
55+
56+
To strike a balance between reliability and availability, the default failurePolicy for pod mutation webhooks that inject readiness gates is configured as follows:
57+
58+
* `failurePolicy: Ignore` (for versions > v2.11.0)
59+
* `failurePolicy: Fail` (for versions <= v2.11.0)
60+
You can customize the behavior using Helm chart settings, e.g. `--set podMutatorWebhookConfig.failurePolicy=Fail`
61+
62+
!!!note "Recommended settings"
63+
For optimal reliability & availability, it is recommended to use `failurePolicy: Fail` combined with an explicit [Object Selector](#object-selector)
64+
5065
## Object Selector
5166
The default webhook configuration matches all pods in the namespaces containing the label `elbv2.k8s.aws/pod-readiness-gate-inject=enabled`. You can modify the webhook configuration further
5267
to select specific pods from the labeled namespace by specifying the `objectSelector`. For example, in order to select resources with `elbv2.k8s.aws/pod-readiness-gate-inject: enabled` label,

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ webhooks:
1919
name: {{ template "aws-load-balancer-controller.webhookService" . }}
2020
namespace: {{ $.Release.Namespace }}
2121
path: /mutate-v1-pod
22-
failurePolicy: Ignore
22+
failurePolicy: {{ .Values.podMutatorWebhookConfig.failurePolicy }}
2323
name: mpod.elbv2.k8s.aws
2424
admissionReviewVersions:
2525
- v1beta1

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

+4
Original file line numberDiff line numberDiff line change
@@ -353,3 +353,7 @@ serviceMutatorWebhookConfig:
353353
operations:
354354
- CREATE
355355
# - UPDATE
356+
357+
podMutatorWebhookConfig:
358+
# whether or not to fail the pod creation if the webhook fails
359+
failurePolicy: Ignore

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

+5
Original file line numberDiff line numberDiff line change
@@ -430,6 +430,11 @@ serviceMutatorWebhookConfig:
430430
- CREATE
431431
# - UPDATE
432432

433+
# podMutatorWebhookConfig contains configurations specific to the service mutator webhook
434+
podMutatorWebhookConfig:
435+
# whether or not to fail the pod creation if the webhook fails
436+
failurePolicy: Ignore
437+
433438
# serviceTargetENISGTags specifies AWS tags, in addition to the cluster tags, for finding the target ENI SG to which to add inbound rules from NLBs.
434439
serviceTargetENISGTags:
435440

0 commit comments

Comments
 (0)