51 lines
1.5 KiB
YAML
51 lines
1.5 KiB
YAML
{{- if .Values.autoscaling.enabled }}
|
|
{{- $apiVersion := "autoscaling/v2" }}
|
|
{{- if .Values.autoscaling.apiVersionOverride -}}
|
|
{{- $apiVersion = .Values.autoscaling.apiVersionOverride }}
|
|
{{- else if .Capabilities.APIVersions.Has "autoscaling/v2beta1" }}
|
|
{{- $apiVersion = "autoscaling/v2beta1" }}
|
|
{{- end }}
|
|
apiVersion: {{ $apiVersion }}
|
|
kind: HorizontalPodAutoscaler
|
|
metadata:
|
|
name: {{ template "fullname" . }}
|
|
labels:
|
|
{{- include "athens.metaLabels" . | nindent 4 }}
|
|
spec:
|
|
scaleTargetRef:
|
|
apiVersion: apps/v1
|
|
kind: Deployment
|
|
name: {{ template "fullname" . }}
|
|
minReplicas: {{ .Values.autoscaling.minReplicas }}
|
|
maxReplicas: {{ .Values.autoscaling.maxReplicas }}
|
|
metrics:
|
|
{{- with .Values.autoscaling.targetMemoryUtilizationPercentage }}
|
|
- type: Resource
|
|
resource:
|
|
name: memory
|
|
{{- if eq $apiVersion "autoscaling/v2beta1" }}
|
|
targetAverageUtilization: {{ . }}
|
|
{{- else }}
|
|
target:
|
|
averageUtilization: {{ . }}
|
|
type: Utilization
|
|
{{- end }}
|
|
{{- end }}
|
|
{{- with .Values.autoscaling.targetCPUUtilizationPercentage }}
|
|
- type: Resource
|
|
resource:
|
|
name: cpu
|
|
{{- if eq $apiVersion "autoscaling/v2beta1" }}
|
|
targetAverageUtilization: {{ . }}
|
|
{{- else }}
|
|
target:
|
|
averageUtilization: {{ . }}
|
|
type: Utilization
|
|
{{- end }}
|
|
{{- end }}
|
|
{{- with .Values.autoscaling.behavior }}
|
|
behavior:
|
|
{{- toYaml . | nindent 4 }}
|
|
{{- end }}
|
|
{{- end }}
|