Skip to content

Commit

Permalink
Add HPA Custom Behavior (#4391)
Browse files Browse the repository at this point in the history
* Allow for HorizontalPodAutoscaler custom `behavior`
- Defines a `controller.autoscaling.behavior` object and defaults it to an empty object `{}`.
- References the object in the `templates/controller-hpa.yaml`.

* update README
  • Loading branch information
saedx1 authored Oct 10, 2023
1 parent 4fc31a1 commit e390768
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions charts/nginx-ingress/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,7 @@ The following tables lists the configurable parameters of the NGINX Ingress Cont
|`controller.minReadySeconds` | Specifies the minimum number of seconds for which a newly created Pod should be ready without any of its containers crashing, for it to be considered available. [docs](https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#min-ready-seconds) | 0 |
|`controller.autoscaling.enabled` | Enables HorizontalPodAutoscaling. | false |
|`controller.autoscaling.annotations` | The annotations of the Ingress Controller HorizontalPodAutoscaler. | {} |
|`controller.autoscaling.behavior` | Behavior configuration for the HPA. | {} |
|`controller.autoscaling.minReplicas` | Minimum number of replicas for the HPA. | 1 |
|`controller.autoscaling.maxReplicas` | Maximum number of replicas for the HPA. | 3 |
|`controller.autoscaling.targetCPUUtilizationPercentage` | The target CPU utilization percentage. | 50 |
Expand Down
4 changes: 4 additions & 0 deletions charts/nginx-ingress/templates/controller-hpa.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ spec:
name: {{ include "nginx-ingress.controller.fullname" . }}
minReplicas: {{ .Values.controller.autoscaling.minReplicas }}
maxReplicas: {{ .Values.controller.autoscaling.maxReplicas }}
{{- if .Values.controller.autoscaling.behavior }}
behavior:
{{ toYaml .Values.controller.autoscaling.behavior | indent 4 }}
{{- end }}
metrics:
{{- if .Values.controller.autoscaling.targetMemoryUtilizationPercentage }}
- type: Resource
Expand Down
2 changes: 2 additions & 0 deletions charts/nginx-ingress/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,8 @@ controller:
targetCPUUtilizationPercentage: 50
## The target memory utilization percentage.
targetMemoryUtilizationPercentage: 50
## Custom behavior policies
behavior: {}

## The resources of the Ingress Controller pods.
resources:
Expand Down

0 comments on commit e390768

Please sign in to comment.