From 10cdc225ec01288be877da631660594bac55623a Mon Sep 17 00:00:00 2001 From: Yury Muski Date: Sun, 13 Aug 2023 19:16:59 +0400 Subject: [PATCH] improve hpa config (#64) --- charts/centrifugo/Chart.yaml | 2 +- charts/centrifugo/templates/hpa.yaml | 4 ++-- charts/centrifugo/values.yaml | 17 ++++++++++++----- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/charts/centrifugo/Chart.yaml b/charts/centrifugo/Chart.yaml index 4539fb7..10c7fa7 100644 --- a/charts/centrifugo/Chart.yaml +++ b/charts/centrifugo/Chart.yaml @@ -1,7 +1,7 @@ apiVersion: v1 name: centrifugo description: Centrifugo is a scalable real-time messaging server in language-agnostic way -version: 10.0.3 +version: 11.0.0 appVersion: 5.0.2 home: https://centrifugal.dev icon: https://centrifugal.dev/img/favicon.png diff --git a/charts/centrifugo/templates/hpa.yaml b/charts/centrifugo/templates/hpa.yaml index 6304f33..81988ac 100644 --- a/charts/centrifugo/templates/hpa.yaml +++ b/charts/centrifugo/templates/hpa.yaml @@ -21,7 +21,7 @@ spec: {{- with .Values.autoscalingTemplate }} {{- toYaml . | nindent 2 }} {{- end }} - {{- if .Values.autoscaling.targetCPUUtilizationPercentage }} + {{- if .Values.autoscaling.cpu.enabled }} - type: Resource resource: name: cpu @@ -33,7 +33,7 @@ spec: targetAverageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} {{- end }} {{- end }} - {{- if .Values.autoscaling.targetMemoryUtilizationPercentage }} + {{- if .Values.autoscaling.memory.enabled }} - type: Resource resource: name: memory diff --git a/charts/centrifugo/values.yaml b/charts/centrifugo/values.yaml index d42d45d..9c561cd 100644 --- a/charts/centrifugo/values.yaml +++ b/charts/centrifugo/values.yaml @@ -159,20 +159,27 @@ autoscaling: enabled: false minReplicas: 1 maxReplicas: 100 - targetCPUUtilizationPercentage: 80 - # targetMemoryUtilizationPercentage: 80 + cpu: + enabled: false + targetCPUUtilizationPercentage: 80 + memory: + enabled: false + targetMemoryUtilizationPercentage: 80 + # ref: https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/#default-behavior behavior: {} autoscalingTemplate: [] # Custom or additional autoscaling metrics - # ref: https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/#support-for-custom-metrics + # ref: https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/#support-for-metrics-apis + # ref: https://github.com/kubernetes-sigs/prometheus-adapter/ # - type: Pods # pods: # metric: - # name: centrifugo_node_num_clients + # # kubectl get --raw "/apis/custom.metrics.k8s.io/v1beta1/namespaces/default/pods/*/hpa_custom_metric_centrifugo_node_num_clients" | jq . + # name: hpa_custom_metric_centrifugo_node_num_clients # target: # type: AverageValue - # averageValue: 10k + # averageValue: 10000m # NOTE: # 10000m = 10 actual metric value (10 clients) podDisruptionBudget: enabled: false