Skip to content

Commit

Permalink
Chart: Implement unhealthyPodEvictionPolicy.
Browse files Browse the repository at this point in the history
  • Loading branch information
chengjoey authored and Gacko committed Sep 20, 2024
1 parent 43a7d8d commit b4f7179
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 0 deletions.
2 changes: 2 additions & 0 deletions charts/ingress-nginx/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,7 @@ As of version `1.26.0` of this chart, by simply not providing any clusterIP valu
| controller.topologySpreadConstraints | list | `[]` | Topology spread constraints rely on node labels to identify the topology domain(s) that each Node is in. # Ref: https://kubernetes.io/docs/concepts/workloads/pods/pod-topology-spread-constraints/ # |
| controller.udp.annotations | object | `{}` | Annotations to be added to the udp config configmap |
| controller.udp.configMapNamespace | string | `""` | Allows customization of the udp-services-configmap; defaults to $(POD_NAMESPACE) |
| controller.unhealthyPodEvictionPolicy | string | `""` | Eviction policy for unhealthy pods guarded by PodDisruptionBudget. Ref: https://kubernetes.io/blog/2023/01/06/unhealthy-pod-eviction-policy-for-pdbs/ |
| controller.updateStrategy | object | `{}` | The update strategy to apply to the Deployment or DaemonSet # |
| controller.watchIngressWithoutClass | bool | `false` | Process Ingress objects without ingressClass annotation/ingressClassName field Overrides value for --watch-ingress-without-class flag of the controller binary Defaults to false |
| defaultBackend.affinity | object | `{}` | Affinity and anti-affinity rules for server scheduling to nodes # Ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity |
Expand Down Expand Up @@ -543,6 +544,7 @@ As of version `1.26.0` of this chart, by simply not providing any clusterIP valu
| defaultBackend.serviceAccount.name | string | `""` | |
| defaultBackend.tolerations | list | `[]` | Node tolerations for server scheduling to nodes with taints # Ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/ # |
| defaultBackend.topologySpreadConstraints | list | `[]` | Topology spread constraints rely on node labels to identify the topology domain(s) that each Node is in. Ref.: https://kubernetes.io/docs/concepts/workloads/pods/pod-topology-spread-constraints/ |
| defaultBackend.unhealthyPodEvictionPolicy | string | `""` | Eviction policy for unhealthy pods guarded by PodDisruptionBudget. Ref: https://kubernetes.io/blog/2023/01/06/unhealthy-pod-eviction-policy-for-pdbs/ |
| defaultBackend.updateStrategy | object | `{}` | The update strategy to apply to the Deployment or DaemonSet # |
| dhParam | string | `""` | A base64-encoded Diffie-Hellman parameter. This can be generated with: `openssl dhparam 4096 2> /dev/null | base64` # Ref: https://github.com/kubernetes/ingress-nginx/tree/main/docs/examples/customization/ssl-dh-param |
| imagePullSecrets | list | `[]` | Optional array of imagePullSecrets containing private registry credentials # Ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/ |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,8 @@ spec:
{{- else if .Values.controller.maxUnavailable }}
maxUnavailable: {{ .Values.controller.maxUnavailable }}
{{- end }}
{{- if .Values.controller.unhealthyPodEvictionPolicy }}
unhealthyPodEvictionPolicy: {{ .Values.controller.unhealthyPodEvictionPolicy }}
{{- end }}
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,8 @@ spec:
{{- else if .Values.defaultBackend.maxUnavailable }}
maxUnavailable: {{ .Values.defaultBackend.maxUnavailable }}
{{- end }}
{{- if .Values.defaultBackend.unhealthyPodEvictionPolicy }}
unhealthyPodEvictionPolicy: {{ .Values.defaultBackend.unhealthyPodEvictionPolicy }}
{{- end }}
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -87,3 +87,16 @@ tests:
- equal:
path: spec.maxUnavailable
value: 1

- it: should create a PodDisruptionBudget with `unhealthyPodEvictionPolicy` if `controller.unhealthyPodEvictionPolicy` is set
set:
controller.replicaCount: 2
controller.unhealthyPodEvictionPolicy: IfHealthyBudget
asserts:
- hasDocuments:
count: 1
- isKind:
of: PodDisruptionBudget
- equal:
path: spec.unhealthyPodEvictionPolicy
value: IfHealthyBudget
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,17 @@ tests:
- equal:
path: spec.maxUnavailable
value: 1

- it: should create a PodDisruptionBudget with `unhealthyPodEvictionPolicy` if `defaultBackend.unhealthyPodEvictionPolicy` is set
set:
defaultBackend.enabled: true
defaultBackend.replicaCount: 2
defaultBackend.unhealthyPodEvictionPolicy: IfHealthyBudget
asserts:
- hasDocuments:
count: 1
- isKind:
of: PodDisruptionBudget
- equal:
path: spec.unhealthyPodEvictionPolicy
value: IfHealthyBudget
6 changes: 6 additions & 0 deletions charts/ingress-nginx/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,9 @@ controller:
minAvailable: 1
# -- Maximum unavailable pods set in PodDisruptionBudget. If set, 'minAvailable' is ignored.
# maxUnavailable: 1
# -- Eviction policy for unhealthy pods guarded by PodDisruptionBudget.
# Ref: https://kubernetes.io/blog/2023/01/06/unhealthy-pod-eviction-policy-for-pdbs/
unhealthyPodEvictionPolicy: ""

## Define requests resources to avoid probe issues due to CPU utilization in busy nodes
## ref: https://github.com/kubernetes/ingress-nginx/issues/4735#issuecomment-551204903
Expand Down Expand Up @@ -1101,6 +1104,9 @@ defaultBackend:
minAvailable: 1
# -- Maximum unavailable pods set in PodDisruptionBudget. If set, 'minAvailable' is ignored.
# maxUnavailable: 1
# -- Eviction policy for unhealthy pods guarded by PodDisruptionBudget.
# Ref: https://kubernetes.io/blog/2023/01/06/unhealthy-pod-eviction-policy-for-pdbs/
unhealthyPodEvictionPolicy: ""

resources: {}
# limits:
Expand Down

0 comments on commit b4f7179

Please sign in to comment.