Skip to content

Commit

Permalink
MAJOR: kubernetes-ingress: Support to specify HPA behavior
Browse files Browse the repository at this point in the history
Signed-off-by: Philipp Hossner <[email protected]>
  • Loading branch information
phihos committed Dec 20, 2024
1 parent 4733b8f commit a56c8bc
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
12 changes: 12 additions & 0 deletions kubernetes-ingress/ci/deployment-hpa-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,18 @@ controller:
minReplicas: 1
maxReplicas: 5
targetCPUUtilizationPercentage: 80
behavior:
scaleUp:
policies:
- type: Percent
value: 900
periodSeconds: 60
scaleDown:
stabilizationWindowSeconds: 600
policies:
- type: Pods
value: 1
periodSeconds: 600

defaultBackend:
autoscaling:
Expand Down
3 changes: 3 additions & 0 deletions kubernetes-ingress/templates/controller-hpa.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ spec:
name: {{ include "kubernetes-ingress.fullname" . }}
minReplicas: {{ .Values.controller.autoscaling.minReplicas }}
maxReplicas: {{ .Values.controller.autoscaling.maxReplicas }}
{{- if .Values.controller.autoscaling.behavior }}
behavior: {{- toYaml .Values.controller.autoscaling.behavior | nindent 4 }}
{{- end }}
metrics:
{{- if .Values.controller.autoscaling.targetCPUUtilizationPercentage }}
- type: Resource
Expand Down
6 changes: 6 additions & 0 deletions kubernetes-ingress/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,12 @@ controller:
annotations: {}
# annotationKey: value

## Behavior
## ref: https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/#configurable-scaling-behavior
# behavior:
# scaleDown:
# stabilizationWindowSeconds: 3600

## Custom metrics (example)
## ref: https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale-walkthrough/#autoscaling-on-multiple-metrics-and-custom-metrics
# custom:
Expand Down

0 comments on commit a56c8bc

Please sign in to comment.