blob: 7de5c067791dc9eae68e253579ff6d2ac5a4aaaf [file] [log] [blame]
Giorgi Lekveishviliec6b3cc2023-12-01 16:30:04 +04001{{- if and (.Values.autoscaler.enabled) (not .Values.hpa.enabled) }}
2---
3apiVersion: apps/v1
4kind: Deployment
5metadata:
6 name: {{ template "coredns.fullname" . }}-autoscaler
7 namespace: {{ .Release.Namespace }}
8 labels: {{- include "coredns.labels.autoscaler" . | nindent 4 }}
9{{- if .Values.customLabels }}
10{{ toYaml .Values.customLabels | indent 4 }}
11{{- end }}
12{{- with .Values.customAnnotations }}
13 annotations:
14{{- toYaml . | nindent 4 }}
15{{- end }}
16spec:
17 selector:
18 matchLabels:
19 app.kubernetes.io/instance: {{ .Release.Name | quote }}
20 {{- if .Values.isClusterService }}
21 k8s-app: {{ template "coredns.k8sapplabel" . }}-autoscaler
22 {{- end }}
23 app.kubernetes.io/name: {{ template "coredns.name" . }}-autoscaler
24 template:
25 metadata:
26 labels:
27 {{- if .Values.isClusterService }}
28 {{- if not (hasKey .Values.customLabels "k8s-app")}}
29 k8s-app: {{ template "coredns.k8sapplabel" . }}-autoscaler
30 {{- end }}
31 {{- end }}
32 app.kubernetes.io/name: {{ template "coredns.name" . }}-autoscaler
33 app.kubernetes.io/instance: {{ .Release.Name | quote }}
34 {{- if .Values.customLabels }}
35 {{ toYaml .Values.customLabels | nindent 8 }}
36 {{- end }}
37 annotations:
38 checksum/configmap: {{ include (print $.Template.BasePath "/configmap-autoscaler.yaml") . | sha256sum }}
39 {{- if .Values.isClusterService }}
40 scheduler.alpha.kubernetes.io/tolerations: '[{"key":"CriticalAddonsOnly", "operator":"Exists"}]'
41 {{- end }}
42 {{- with .Values.autoscaler.podAnnotations }}
43 {{- toYaml . | nindent 8 }}
44 {{- end }}
45 spec:
46 serviceAccountName: {{ template "coredns.fullname" . }}-autoscaler
47 {{- $priorityClassName := default .Values.priorityClassName .Values.autoscaler.priorityClassName }}
48 {{- if $priorityClassName }}
49 priorityClassName: {{ $priorityClassName | quote }}
50 {{- end }}
51 {{- if .Values.autoscaler.affinity }}
52 affinity:
53{{ toYaml .Values.autoscaler.affinity | indent 8 }}
54 {{- end }}
55 {{- if .Values.autoscaler.tolerations }}
56 tolerations:
57{{ toYaml .Values.autoscaler.tolerations | indent 8 }}
58 {{- end }}
59 {{- if .Values.autoscaler.nodeSelector }}
60 nodeSelector:
61{{ toYaml .Values.autoscaler.nodeSelector | indent 8 }}
62 {{- end }}
63 {{- if not (empty .Values.autoscaler.image.pullSecrets) }}
64 imagePullSecrets:
65{{ toYaml .Values.autoscaler.image.pullSecrets | indent 8 }}
66 {{- end }}
67 containers:
68 - name: autoscaler
69 image: "{{ .Values.autoscaler.image.repository }}:{{ .Values.autoscaler.image.tag }}"
70 imagePullPolicy: {{ .Values.autoscaler.image.pullPolicy }}
71 resources:
72{{ toYaml .Values.autoscaler.resources | indent 10 }}
73 {{- if .Values.autoscaler.livenessProbe.enabled }}
74 livenessProbe:
75 httpGet:
76 path: /healthz
77 port: 8080
78 scheme: HTTP
79 initialDelaySeconds: {{ .Values.autoscaler.livenessProbe.initialDelaySeconds }}
80 periodSeconds: {{ .Values.autoscaler.livenessProbe.periodSeconds }}
81 timeoutSeconds: {{ .Values.autoscaler.livenessProbe.timeoutSeconds }}
82 successThreshold: {{ .Values.autoscaler.livenessProbe.successThreshold }}
83 failureThreshold: {{ .Values.autoscaler.livenessProbe.failureThreshold }}
84 {{- end }}
85 command:
86 - /cluster-proportional-autoscaler
87 - --namespace={{ .Release.Namespace }}
88 - --configmap={{ template "coredns.fullname" . }}-autoscaler
89 - --target=Deployment/{{ default (include "coredns.fullname" .) .Values.deployment.name }}
90 - --logtostderr=true
91 - --v=2
92 {{- if .Values.autoscaler.customFlags }}
93{{ toYaml .Values.autoscaler.customFlags | indent 10 }}
94 {{- end }}
95{{- if .Values.autoscaler.extraContainers }}
96{{ toYaml .Values.autoscaler.extraContainers | indent 6 }}
97{{- end }}
98{{- end }}