Update to autoscaling/v2beta1 syntax for hpa

This commit is contained in:
David Burke 2021-02-07 16:48:32 -05:00
parent efc58de740
commit 3077a1d304
3 changed files with 51 additions and 30 deletions

View file

@ -1,19 +1,28 @@
{{- if .Values.web.hpa.enabled -}}
apiVersion: autoscaling/v1
{{- if .Values.web.autoscaling.enabled -}}
apiVersion: autoscaling/v2beta1
kind: HorizontalPodAutoscaler
metadata:
name: {{ template "glitchtip.fullname" . }}
labels:
app: {{ template "glitchtip.fullname" . }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
{{- include "glitchtip.labels" . | nindent 4 }}
spec:
scaleTargetRef:
kind: Deployment
apiVersion: apps/v1
kind: Deployment
name: {{ template "glitchtip.fullname" . }}
minReplicas: {{ .Values.web.hpa.minpods }}
maxReplicas: {{ .Values.web.hpa.maxpods }}
targetCPUUtilizationPercentage: {{ .Values.web.hpa.cputhreshold }}
minReplicas: {{ .Values.web.autoscaling.minReplicas }}
maxReplicas: {{ .Values.web.autoscaling.maxReplicas }}
metrics:
{{- if .Values.web.autoscaling.targetCPUUtilizationPercentage }}
- type: Resource
resource:
name: cpu
targetAverageUtilization: {{ .Values.web.autoscaling.targetCPUUtilizationPercentage }}
{{- end }}
{{- if .Values.web.autoscaling.targetMemoryUtilizationPercentage }}
- type: Resource
resource:
name: memory
targetAverageUtilization: {{ .Values.web.autoscaling.targetMemoryUtilizationPercentage }}
{{- end }}
{{- end }}

View file

@ -1,19 +1,28 @@
{{- if .Values.worker.hpa.enabled -}}
apiVersion: autoscaling/v1
{{- if .Values.worker.autoscaling.enabled -}}
apiVersion: autoscaling/v2beta1
kind: HorizontalPodAutoscaler
metadata:
name: {{ template "glitchtip.fullname" . }}-worker
name: {{ template "glitchtip.fullname" . }}
labels:
app: {{ template "glitchtip.fullname" . }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
{{- include "glitchtip.labels" . | nindent 4 }}
spec:
scaleTargetRef:
kind: Deployment
apiVersion: apps/v1
kind: Deployment
name: {{ template "glitchtip.fullname" . }}-worker
minReplicas: {{ .Values.worker.hpa.minpods }}
maxReplicas: {{ .Values.worker.hpa.maxpods }}
targetCPUUtilizationPercentage: {{ .Values.worker.hpa.cputhreshold }}
{{- end }}
minReplicas: {{ .Values.worker.autoscaling.minReplicas }}
maxReplicas: {{ .Values.worker.autoscaling.maxReplicas }}
metrics:
{{- if .Values.worker.autoscaling.targetCPUUtilizationPercentage }}
- type: Resource
resource:
name: cpu
targetAverageUtilization: {{ .Values.worker.autoscaling.targetCPUUtilizationPercentage }}
{{- end }}
{{- if .Values.worker.autoscaling.targetMemoryUtilizationPercentage }}
- type: Resource
resource:
name: memory
targetAverageUtilization: {{ .Values.worker.autoscaling.targetMemoryUtilizationPercentage }}
{{- end }}
{{- end }}