Update to autoscaling/v2beta1 syntax for hpa
This commit is contained in:
		
							parent
							
								
									efc58de740
								
							
						
					
					
						commit
						3077a1d304
					
				
					 3 changed files with 51 additions and 30 deletions
				
			
		| 
						 | 
				
			
			@ -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 }}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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 }}
 | 
			
		||||
  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 }}
 | 
			
		||||
							
								
								
									
										19
									
								
								values.yaml
									
										
									
									
									
								
							
							
						
						
									
										19
									
								
								values.yaml
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -23,11 +23,13 @@ environmentVariables:
 | 
			
		|||
 | 
			
		||||
web:
 | 
			
		||||
  replicaCount: 1
 | 
			
		||||
  hpa:
 | 
			
		||||
  autoscaling:
 | 
			
		||||
    enabled: false
 | 
			
		||||
    cputhreshold: 70
 | 
			
		||||
    minpods: 2
 | 
			
		||||
    maxpods: 4
 | 
			
		||||
    minReplicas: 1
 | 
			
		||||
    maxReplicas: 100
 | 
			
		||||
    targetCPUUtilizationPercentage: 80
 | 
			
		||||
    # targetMemoryUtilizationPercentage: 80
 | 
			
		||||
 | 
			
		||||
  # budget:
 | 
			
		||||
  #  minAvailable: 1
 | 
			
		||||
  resources:
 | 
			
		||||
| 
						 | 
				
			
			@ -52,11 +54,12 @@ web:
 | 
			
		|||
 | 
			
		||||
worker:
 | 
			
		||||
  replicaCount: 1
 | 
			
		||||
  hpa:
 | 
			
		||||
  autoscaling:
 | 
			
		||||
    enabled: false
 | 
			
		||||
    cputhreshold: 90
 | 
			
		||||
    minpods: 1
 | 
			
		||||
    maxpods: 4
 | 
			
		||||
    minReplicas: 1
 | 
			
		||||
    maxReplicas: 100
 | 
			
		||||
    targetCPUUtilizationPercentage: 90
 | 
			
		||||
    # targetMemoryUtilizationPercentage: 80
 | 
			
		||||
  resources:
 | 
			
		||||
    {}
 | 
			
		||||
    # limits:
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Reference in a new issue