Skip to content

Commit 874c5c1

Browse files
committed
feat(oauth2-proxy): Support HPA spec.behavior for fine-grained scaling policy
* Reference (k8s docs): https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/\#configurable-scaling-behavior Signed-off-by: younsl <[email protected]>
1 parent cd33585 commit 874c5c1

File tree

2 files changed

+32
-1
lines changed

2 files changed

+32
-1
lines changed

helm/oauth2-proxy/templates/hpa.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,15 @@ spec:
3535
type: Utilization
3636
averageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }}
3737
{{- end }}
38+
{{- if .Values.autoscaling.behavior }}
39+
behavior:
40+
{{- with .Values.autoscaling.behavior.scaleDown }}
41+
scaleDown:
42+
{{- toYaml . | nindent 6 }}
43+
{{- end }}
44+
{{- with .Values.autoscaling.behavior.scaleUp }}
45+
scaleUp:
46+
{{- toYaml . | nindent 6 }}
47+
{{- end }}
48+
{{- end }}
3849
{{- end }}

helm/oauth2-proxy/values.yaml

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,8 +319,28 @@ autoscaling:
319319
minReplicas: 1
320320
maxReplicas: 10
321321
targetCPUUtilizationPercentage: 80
322-
# targetMemoryUtilizationPercentage: 80
322+
# targetMemoryUtilizationPercentage: 80
323323
annotations: {}
324+
# Configure HPA behavior policies for scaling if needed
325+
# Ref: https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/#configuring-scaling-behavior
326+
behavior: {}
327+
# scaleDown:
328+
# stabilizationWindowSeconds: 300
329+
# policies:
330+
# - type: Percent
331+
# value: 100
332+
# periodSeconds: 15
333+
# selectPolicy: Min
334+
# scaleUp:
335+
# stabilizationWindowSeconds: 0
336+
# policies:
337+
# - type: Percent
338+
# value: 100
339+
# periodSeconds: 15
340+
# - type: Pods
341+
# value: 4
342+
# periodSeconds: 15
343+
# selectPolicy: Max
324344

325345
# Configure Kubernetes security context for pod
326346
# Ref: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/

0 commit comments

Comments
 (0)