-
Notifications
You must be signed in to change notification settings - Fork 842
/
deployment.yaml
241 lines (241 loc) · 8.32 KB
/
deployment.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "karpenter.fullname" . }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "karpenter.labels" . | nindent 4 }}
{{- with .Values.additionalAnnotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
replicas: {{ .Values.replicas }}
revisionHistoryLimit: {{ .Values.revisionHistoryLimit }}
{{- with .Values.strategy }}
strategy:
{{- toYaml . | nindent 4 }}
{{- end }}
selector:
matchLabels:
{{- include "karpenter.selectorLabels" . | nindent 6 }}
template:
metadata:
labels:
{{- include "karpenter.selectorLabels" . | nindent 8 }}
{{- with .Values.podLabels }}
{{- toYaml . | nindent 8 }}
{{- end }}
annotations:
{{- with .Values.podAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "karpenter.serviceAccountName" . }}
{{- with .Values.podSecurityContext }}
securityContext:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.priorityClassName }}
priorityClassName: {{ . | quote }}
{{- end }}
{{- with .Values.terminationGracePeriodSeconds }}
terminationGracePeriodSeconds: {{ . }}
{{- end }}
{{- with .Values.dnsPolicy }}
dnsPolicy: {{ . }}
{{- end }}
{{- with .Values.dnsConfig }}
dnsConfig:
{{- toYaml . | nindent 8}}
{{- end }}
{{- if .Values.hostNetwork }}
hostNetwork: true
{{- end }}
containers:
- name: controller
securityContext:
runAsUser: 65532
runAsGroup: 65532
runAsNonRoot: true
seccompProfile:
type: RuntimeDefault
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
readOnlyRootFilesystem: true
image: {{ include "karpenter.controller.image" . }}
imagePullPolicy: {{ .Values.imagePullPolicy }}
env:
- name: KUBERNETES_MIN_VERSION
value: "1.19.0-0"
- name: KARPENTER_SERVICE
value: {{ include "karpenter.fullname" . }}
{{- if .Values.webhook.enabled }}
- name: WEBHOOK_PORT
value: "{{ .Values.webhook.port }}"
- name: WEBHOOK_METRICS_PORT
value: "{{ .Values.webhook.metrics.port }}"
- name: DISABLE_WEBHOOK
value: "false"
{{- end }}
{{- with .Values.logLevel }}
- name: LOG_LEVEL
value: "{{ . }}"
{{- end }}
- name: METRICS_PORT
value: "{{ .Values.controller.metrics.port }}"
- name: HEALTH_PROBE_PORT
value: "{{ .Values.controller.healthProbe.port }}"
- name: SYSTEM_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: MEMORY_LIMIT
valueFrom:
resourceFieldRef:
containerName: controller
divisor: "0"
resource: limits.memory
- name: FEATURE_GATES
value: "Drift={{ .Values.settings.featureGates.drift }},SpotToSpotConsolidation={{ .Values.settings.featureGates.spotToSpotConsolidation }}"
{{- with .Values.settings.batchMaxDuration }}
- name: BATCH_MAX_DURATION
value: "{{ . }}"
{{- end }}
{{- with .Values.settings.batchIdleDuration }}
- name: BATCH_IDLE_DURATION
value: "{{ . }}"
{{- end }}
{{- with .Values.settings.assumeRoleARN }}
- name: ASSUME_ROLE_ARN
value: "{{ . }}"
{{- end }}
{{- with .Values.settings.assumeRoleDuration }}
- name: ASSUME_ROLE_DURATION
value: "{{ . }}"
{{- end }}
{{- with .Values.settings.clusterCABundle }}
- name: CLUSTER_CA_BUNDLE
value: "{{ . }}"
{{- end }}
{{- with .Values.settings.clusterName }}
- name: CLUSTER_NAME
value: "{{ . }}"
{{- end }}
{{- with .Values.settings.clusterEndpoint }}
- name: CLUSTER_ENDPOINT
value: "{{ . }}"
{{- end }}
{{- with .Values.settings.isolatedVPC }}
- name: ISOLATED_VPC
value: "{{ . }}"
{{- end }}
{{- with .Values.settings.vmMemoryOverheadPercent }}
- name: VM_MEMORY_OVERHEAD_PERCENT
value: "{{ . }}"
{{- end }}
{{- with .Values.settings.interruptionQueue }}
- name: INTERRUPTION_QUEUE
value: "{{ . }}"
{{- end }}
{{- with .Values.settings.reservedENIs }}
- name: RESERVED_ENIS
value: "{{ . }}"
{{- end }}
{{- with .Values.controller.env }}
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.controller.envFrom }}
envFrom:
{{- toYaml . | nindent 12 }}
{{- end }}
ports:
- name: http-metrics
containerPort: {{ .Values.controller.metrics.port }}
protocol: TCP
{{- if .Values.webhook.enabled }}
- name: webhook-metrics
containerPort: {{ .Values.webhook.metrics.port }}
protocol: TCP
- name: https-webhook
containerPort: {{ .Values.webhook.port }}
protocol: TCP
{{- end }}
- name: http
containerPort: {{ .Values.controller.healthProbe.port }}
protocol: TCP
livenessProbe:
initialDelaySeconds: 30
timeoutSeconds: 30
httpGet:
path: /healthz
port: http
readinessProbe:
initialDelaySeconds: 5
timeoutSeconds: 30
httpGet:
path: /readyz
port: http
{{- with .Values.controller.resources }}
resources:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- if or (.Values.logConfig.enabled) (.Values.controller.extraVolumeMounts) }}
volumeMounts:
{{- if .Values.logConfig.enabled }}
- name: config-logging
mountPath: /etc/karpenter/logging
{{- end }}
{{- with .Values.controller.extraVolumeMounts }}
{{- toYaml . | nindent 12 }}
{{- end }}
{{- end }}
{{- with .Values.controller.sidecarContainer }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- if and (.Values.controller.sidecarContainer) (or .Values.controller.extraVolumeMounts .Values.controller.sidecarVolumeMounts) }}
volumeMounts:
{{- with .Values.controller.extraVolumeMounts }}
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.controller.sidecarVolumeMounts }}
{{- toYaml . | nindent 12 }}
{{- end }}
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
# The template below patches the .Values.affinity to add a default label selector where not specificed
{{- $_ := include "karpenter.patchAffinity" $ }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.topologySpreadConstraints }}
# The template below patches the .Values.topologySpreadConstraints to add a default label selector where not specificed
{{- $_ := include "karpenter.patchTopologySpreadConstraints" $ }}
topologySpreadConstraints:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- if or (.Values.logConfig.enabled) (.Values.extraVolumes) }}
volumes:
{{- if .Values.logConfig.enabled }}
- name: config-logging
configMap:
name: config-logging
{{- end }}
{{- with .Values.extraVolumes }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- end }}