Skip to content

Commit

Permalink
Merge pull request #37 from tomtom-international/feat/hpa-policy
Browse files Browse the repository at this point in the history
feat: PPIDP-435 add behaviour to HPA
  • Loading branch information
semihural-tomtom authored Oct 14, 2024
2 parents 4a1f374 + a4cde71 commit b61bb81
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 3 deletions.
2 changes: 1 addition & 1 deletion charts/tomtom-base-chart/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ apiVersion: v2
name: tomtom-base-chart
description: A base Helm chart for all TomTom product units
type: application
version: 0.0.15
version: 0.0.16
appVersion: "1.0.0"
26 changes: 26 additions & 0 deletions charts/tomtom-base-chart/templates/hpa.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,30 @@ spec:
type: Utilization
averageUtilization: {{ .Values.basicSettings.autoscaling.targetMemoryUtilizationPercentage }}
{{- end }}
{{- if .Values.basicSettings.autoscaling.behavior }} # Check if behavior exists
behavior:
{{- if .Values.basicSettings.autoscaling.behavior.scaleDown }}
scaleDown:
stabilizationWindowSeconds: {{ .Values.basicSettings.autoscaling.behavior.scaleDown.stabilizationWindowSeconds }}
policies:
{{- range .Values.basicSettings.autoscaling.behavior.scaleDown.policies }}
- type: {{ .type }}
value: {{ .value }}
periodSeconds: {{ .periodSeconds }}
{{- end }}
{{- end }}
{{- if .Values.basicSettings.autoscaling.behavior.scaleUp }}
scaleUp:
stabilizationWindowSeconds: {{ .Values.basicSettings.autoscaling.behavior.scaleUp.stabilizationWindowSeconds }}
policies:
{{- range .Values.basicSettings.autoscaling.behavior.scaleUp.policies }}
- type: {{ .type }}
value: {{ .value }}
periodSeconds: {{ .periodSeconds }}
{{- end }}
{{- if .Values.basicSettings.autoscaling.behavior.scaleUp.selectPolicy }}
selectPolicy: {{ .Values.basicSettings.autoscaling.behavior.scaleUp.selectPolicy }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
21 changes: 19 additions & 2 deletions charts/tomtom-base-chart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -153,11 +153,28 @@ basicSettings:
# Enabled by default, creates a HorizontalPodAutoscaler resource
# This resource scales the deployment based on CPU (set to 75% by default) or memory usage.
autoscaling:
enabled: false
enabled: true
minReplicas: 2
maxReplicas: 10
targetCPUUtilizationPercentage: 75
# targetMemoryUtilizationPercentage: 80
# behavior:
# scaleDown:
# stabilizationWindowSeconds: 300
# policies:
# - type: Percent
# value: 100
# periodSeconds: 60
# scaleUp:
# stabilizationWindowSeconds: 0
# policies:
# - type: Percent
# value: 100
# periodSeconds: 30
# - type: Pods
# value: 4
# periodSeconds: 30
# selectPolicy: Max

#
# ADVANCED SETTINGS
Expand Down Expand Up @@ -268,4 +285,4 @@ advancedSettings:
pdb:
enabled: false # Set to true to enable the PDB
minAvailable: 1 # Minimum number of pods that must be available
maxUnavailable: 2 # Maximum number of pods that can be unavailable
# maxUnavailable: 2 # Maximum number of pods that can be unavailable

0 comments on commit b61bb81

Please sign in to comment.