Commit a0daa00d authored by Subbu's avatar Subbu Committed by Hordur Freyr Yngvason
Browse files

feat: add support for scaling on custom metrics

parent 9c1d950c
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
apiVersion: v1
description: GitLab's Auto-deploy Helm Chart
name: auto-deploy-app
version: 2.14.0
version: 2.15.0
icon: https://gitlab.com/gitlab-com/gitlab-artwork/raw/master/logo/logo-square.png
+2 −1
Original line number Diff line number Diff line
@@ -34,7 +34,8 @@
| hpa.enabled                   | If true, enables horizontal pod autoscaler. A resource request is also required to be set, such as `resources.requests.cpu: 200m`.| `false` |
| hpa.minReplicas               |             | `1`                                |
| hpa.maxReplicas               |             | `5`                                |
| hpa.targetCPUUtilizationPercentage | Percentage threshold when HPA begins scaling out pods | `80` |
| hpa.targetCPUUtilizationPercentage | Percentage threshold when HPA begins scaling out pods | `nil` |
| hpa.metrics                   | Resource/custom metric configuration when HPA begins scaling out pods | `nil` |
| gitlab.app                    | GitLab project slug. | `nil` |
| gitlab.env                    | GitLab environment slug. | `nil` |
| gitlab.envName                | GitLab environment name. | `nil` |
+11 −2
Original line number Diff line number Diff line
{{- if and .Values.hpa.enabled .Values.resources.requests -}}
{{- if .Values.hpa.metrics }}
apiVersion: autoscaling/v2beta1
{{- else }}
apiVersion: autoscaling/v1
{{- end }}
kind: HorizontalPodAutoscaler
metadata:
  name: {{ template "fullname" . }}
@@ -7,10 +11,15 @@ metadata:
{{ include "sharedlabels" . | indent 4 }}
spec:
  scaleTargetRef:
    apiVersion: apps/v1
    kind: Deployment
    name: {{ template "appname" . }}
    apiVersion: apps/v1
  minReplicas: {{ .Values.hpa.minReplicas }}
  maxReplicas: {{ .Values.hpa.maxReplicas }}
{{- if .Values.hpa.metrics }}
  metrics:
{{ toYaml .Values.hpa.metrics | indent 2 }}
{{- else }}
  targetCPUUtilizationPercentage: {{ .Values.hpa.targetCPUUtilizationPercentage }}
{{- end -}}
{{- end }}
{{- end}}
+11 −1
Original line number Diff line number Diff line
@@ -35,7 +35,17 @@ hpa:
  enabled: false
  minReplicas: 1
  maxReplicas: 5
  targetCPUUtilizationPercentage: 80
  # Choose `targetCPUUtilizationPercentage` or `metrics` based on your use case
  # targetCPUUtilizationPercentage: 80
  # metrics:
  # - type: Object
  #   object:
  #     target:
  #       kind: Service
  #       name: production-auto-deploy
  #     metricName: nginx_ingress_controller_requests_per_second
  #     targetValue: 40

gitlab:
  app:
  env: