Skip to content

Commit

Permalink
Autoscaling template (#62)
Browse files Browse the repository at this point in the history
Co-authored-by: Moty Fux <[email protected]>
  • Loading branch information
FZambia and Moty Fux authored Aug 8, 2023
1 parent aa7ff83 commit 168e01a
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 21 deletions.
2 changes: 1 addition & 1 deletion charts/centrifugo/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: v1
name: centrifugo
description: Centrifugo is a scalable real-time messaging server in language-agnostic way
version: 10.0.2
version: 10.0.3
appVersion: 5.0.2
home: https://centrifugal.dev
icon: https://centrifugal.dev/img/favicon.png
Expand Down
47 changes: 27 additions & 20 deletions charts/centrifugo/templates/hpa.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,28 +18,35 @@ spec:
minReplicas: {{ .Values.autoscaling.minReplicas }}
maxReplicas: {{ .Values.autoscaling.maxReplicas }}
metrics:
{{- with .Values.autoscalingTemplate }}
{{- toYaml . | nindent 2 }}
{{- end }}
{{- if .Values.autoscaling.targetCPUUtilizationPercentage }}
- type: Resource
resource:
name: cpu
{{- if .Capabilities.APIVersions.Has "autoscaling/v2" }}
target:
type: Utilization
averageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }}
{{- else }}
targetAverageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }}
{{- end }}
- type: Resource
resource:
name: cpu
{{- if .Capabilities.APIVersions.Has "autoscaling/v2" }}
target:
type: Utilization
averageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }}
{{- else }}
targetAverageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }}
{{- end }}
{{- end }}
{{- if .Values.autoscaling.targetMemoryUtilizationPercentage }}
- type: Resource
resource:
name: memory
{{- if .Capabilities.APIVersions.Has "autoscaling/v2" }}
target:
type: Utilization
averageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }}
{{- else }}
targetAverageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }}
{{- end }}
- type: Resource
resource:
name: memory
{{- if .Capabilities.APIVersions.Has "autoscaling/v2" }}
target:
type: Utilization
averageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }}
{{- else }}
targetAverageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }}
{{- end }}
{{- end }}
{{- with .Values.autoscaling.behavior }}
behavior:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
12 changes: 12 additions & 0 deletions charts/centrifugo/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,18 @@ autoscaling:
maxReplicas: 100
targetCPUUtilizationPercentage: 80
# targetMemoryUtilizationPercentage: 80
behavior: {}

autoscalingTemplate: []
# Custom or additional autoscaling metrics
# ref: https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/#support-for-custom-metrics
# - type: Pods
# pods:
# metric:
# name: centrifugo_node_num_clients
# target:
# type: AverageValue
# averageValue: 10k

podDisruptionBudget:
enabled: false
Expand Down

0 comments on commit 168e01a

Please sign in to comment.