-
Notifications
You must be signed in to change notification settings - Fork 94
/
deployment.yaml
133 lines (133 loc) · 4.81 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
{{- if .Values.agent.enabled -}}
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "prefect-server.nameField" (merge (dict "component" "agent") .) }}
labels:
{{- include "prefect-server.commonLabels" . | nindent 4 }}
app.kubernetes.io/component: agent
annotations:
{{- merge .Values.agent.annotations .Values.annotations | toYaml | nindent 4 }}
spec:
replicas: {{ .Values.agent.replicas }}
{{- with .Values.agent.strategy }}
strategy:
{{- toYaml . | nindent 4 }}
{{- end }}
selector:
matchLabels:
{{- include "prefect-server.matchLabels" . | nindent 6 }}
app.kubernetes.io/component: agent
template:
metadata:
labels:
{{- include "prefect-server.matchLabels" . | nindent 8 }}
app.kubernetes.io/component: agent
{{- with .Values.agent.podAnnotations }}
annotations: {{- toYaml . | nindent 8 }}
{{- end }}
spec:
{{- if .Values.agent.image.pullSecrets }}
imagePullSecrets:
{{- toYaml .Values.agent.image.pullSecrets | nindent 8 }}
{{- else if .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml .Values.imagePullSecrets | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "prefect-server.serviceAccountName" . }}
{{- with .Values.agent.podSecurityContext }}
securityContext:
{{- toYaml . | nindent 8 }}
{{- end }}
containers:
- name: agent
{{- with .Values.agent.podSecurityContext }}
securityContext:
{{- toYaml . | nindent 8 }}
{{- end }}
image: "{{ .Values.agent.image.name }}:{{ .Values.agent.image.tag | default .Values.prefectVersionTag }}"
imagePullPolicy: {{ .Values.agent.image.pullPolicy }}
command:
- bash
- "-c"
{{- if .Values.agent.jobTemplateFilePath }}
- "prefect agent kubernetes start --job-template {{ .Values.agent.jobTemplateFilePath }}"
{{- else }}
- "prefect agent kubernetes start"
{{- end }}
env:
- name: PREFECT__CLOUD__API
value: {{ include "prefect-server.apollo-api-url" . }}
- name: NAMESPACE
value: {{ .Release.Namespace }}
{{- if .Values.agent.job.imagePullSecrets }}
- name: IMAGE_PULL_SECRETS
value: {{ .Values.agent.job.imagePullSecrets | join "," | quote }}
{{- end }}
- name: PREFECT__CLOUD__AGENT__LABELS
value: {{ .Values.agent.prefectLabels | toJson | quote }}
{{- if .Values.agent.job.resources.requests.memory }}
- name: JOB_MEM_REQUEST
value: {{ .Values.agent.job.resources.requests.memory | quote }}
{{- end }}
{{- if .Values.agent.job.resources.limits.memory }}
- name: JOB_MEM_LIMIT
value: {{ .Values.agent.job.resources.limits.memory | quote }}
{{- end }}
{{- if .Values.agent.job.resources.requests.cpu }}
- name: JOB_CPU_REQUEST
value: {{ .Values.agent.job.resources.requests.cpu | quote }}
{{- end }}
{{- if .Values.agent.job.resources.limits.cpu }}
- name: JOB_CPU_LIMIT
value: {{ .Values.agent.job.resources.limits.cpu | quote }}
{{- end }}
{{- if .Values.agent.job.imagePullPolicy }}
- name: IMAGE_PULL_POLICY
value: {{ .Values.agent.job.imagePullPolicy | quote }}
{{- end }}
- name: SERVICE_ACCOUNT_NAME
value: {{ include "prefect-server.serviceAccountName" . }}
- name: PREFECT__BACKEND
value: server
- name: PREFECT__CLOUD__AGENT__AGENT_ADDRESS
value: http://0.0.0.0:8080
{{- with .Values.agent.env }}
{{- toYaml . | nindent 10 }}
{{- end }}
{{- if .Values.agent.jobTemplateFileConfigMap }}
volumeMounts:
- mountPath: {{ .Values.agent.jobTemplateFilePath }}
name: job-template
subPath: {{ base .Values.agent.jobTemplateFilePath }}
{{- end }}
livenessProbe:
failureThreshold: 2
httpGet:
path: /api/health
port: 8080
initialDelaySeconds: 40
periodSeconds: 40
{{- with .Values.agent.resources }}
resources:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.agent.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- if .Values.agent.jobTemplateFileConfigMap }}
volumes:
- configMap:
name: {{ .Values.agent.jobTemplateFileConfigMap }}
name: job-template
{{- end }}
{{- with .Values.agent.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.agent.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- end }}