-
Notifications
You must be signed in to change notification settings - Fork 75
Expand file tree
/
Copy pathdeployment_code_executor.yaml
More file actions
164 lines (162 loc) · 5.39 KB
/
deployment_code_executor.yaml
File metadata and controls
164 lines (162 loc) · 5.39 KB
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
{{- if include "retool.workflows.enabled" . }}
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ template "retool.codeExecutor.name" . }}
labels:
{{- include "retool.codeExecutor.selectorLabels" . | nindent 4 }}
{{- include "retool.codeExecutor.labels" . | nindent 4 }}
{{- include "retool.labels" . | nindent 4 }}
{{- if .Values.deployment.annotations }}
annotations:
{{ toYaml .Values.deployment.annotations | indent 4 }}
{{- end }}
spec:
replicas: {{ .Values.codeExecutor.replicaCount }}
selector:
matchLabels:
{{- include "retool.codeExecutor.selectorLabels" . | nindent 6 }}
revisionHistoryLimit: {{ .Values.revisionHistoryLimit }}
template:
metadata:
annotations:
{{- if .Values.podAnnotations }}
{{ toYaml .Values.podAnnotations | indent 8 }}
{{- end }}
{{- if .Values.codeExecutor.annotations }}
{{ toYaml .Values.codeExecutor.annotations | indent 8 }}
{{- end }}
labels:
{{- include "retool.codeExecutor.selectorLabels" . | nindent 8 }}
{{- include "retool.codeExecutor.labels" . | nindent 8 }}
{{- include "retool.labels" . | nindent 8 }}
{{- if .Values.podLabels }}
{{ toYaml .Values.podLabels | indent 8 }}
{{- end }}
{{- if .Values.codeExecutor.labels }}
{{ toYaml .Values.codeExecutor.labels | indent 8 }}
{{- end }}
spec:
serviceAccountName: {{ template "retool.serviceAccountName" . }}
{{- if .Values.priorityClassName }}
priorityClassName: "{{ .Values.priorityClassName }}"
{{- end }}
{{- if .Values.initContainers }}
initContainers:
{{- range $key, $value := .Values.initContainers }}
- name: "{{ $key }}"
{{ toYaml $value | indent 8 }}
{{- end }}
{{- end }}
containers:
- name: code-executor
image: "{{ .Values.codeExecutor.image.repository }}:{{ include "retool.codeExecutor.image.tag" . }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
securityContext:
{{ if .Values.codeExecutor.securityContext }}
{{ toYaml .Values.codeExecutor.securityContext | indent 10 }}
{{ else }}
privileged: true
{{ end }}
env:
- name: DEPLOYMENT_TEMPLATE_TYPE
value: {{ template "retool.deploymentTemplateType" . }}
- name: DEPLOYMENT_TEMPLATE_VERSION
value: {{ template "retool.deploymentTemplateVersion" . }}
- name: NODE_ENV
value: production
- name: NODE_OPTIONS
value: {{(.Values.codeExecutor.config).nodeOptions | default "--max_old_space_size=1024" }}
{{- include "retool.telemetry.includeEnvVars" . | nindent 10 }}
{{- range $key, $value := .Values.env }}
- name: "{{ $key }}"
value: "{{ $value }}"
{{- end }}
{{- range .Values.environmentSecrets }}
- name: {{ .name }}
valueFrom:
secretKeyRef:
name: {{ .secretKeyRef.name }}
key: {{ .secretKeyRef.key }}
{{- end }}
{{- with .Values.environmentVariables }}
{{ toYaml . | indent 10 }}
{{- end }}
ports:
- containerPort: 3004
name: http-server
protocol: TCP
{{- if .Values.livenessProbe.enabled }}
livenessProbe:
httpGet:
path: {{ .Values.livenessProbe.path }}
port: 3004
initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }}
timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }}
failureThreshold: {{ .Values.livenessProbe.failureThreshold }}
{{- end }}
{{- if .Values.readinessProbe.enabled }}
readinessProbe:
httpGet:
path: {{ .Values.readinessProbe.path }}
port: 3004
initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }}
timeoutSeconds: {{ .Values.readinessProbe.timeoutSeconds }}
successThreshold: {{ .Values.readinessProbe.successThreshold }}
periodSeconds: {{ .Values.readinessProbe.periodSeconds }}
{{- end }}
resources:
{{ toYaml .Values.codeExecutor.resources | indent 10 }}
volumeMounts:
{{- if .Values.codeExecutor.volumeMounts }}
{{ toYaml .Values.codeExecutor.volumeMounts | indent 10 }}
{{- end }}
volumes:
{{- if .Values.codeExecutor.volumes }}
{{ toYaml .Values.codeExecutor.volumes | indent 8 }}
{{- end }}
{{- if .Values.image.pullSecrets }}
imagePullSecrets:
{{ toYaml .Values.image.pullSecrets | indent 8 }}
{{- end }}
{{- if .Values.codeExecutor.affinity }}
affinity:
{{ toYaml .Values.codeExecutor.affinity | indent 8 }}
{{- end }}
{{- if .Values.nodeSelector }}
nodeSelector:
{{ toYaml .Values.nodeSelector | indent 8 }}
{{- end }}
tolerations:
{{ toYaml .Values.tolerations | indent 8 }}
---
apiVersion: v1
kind: Service
metadata:
name: {{ template "retool.codeExecutor.name" . }}
spec:
selector:
{{- include "retool.codeExecutor.selectorLabels" . | nindent 4 }}
ports:
- protocol: TCP
port: 80
targetPort: 3004
name: http-server
---
{{- if .Values.podDisruptionBudget }}
{{- if semverCompare ">=1.21-0" .Capabilities.KubeVersion.Version -}}
apiVersion: policy/v1
{{- else -}}
apiVersion: policy/v1beta1
{{- end }}
kind: PodDisruptionBudget
metadata:
name: {{ template "retool.codeExecutor.name" . }}
spec:
{{- toYaml .Values.podDisruptionBudget | nindent 2 }}
selector:
matchLabels:
{{- include "retool.codeExecutor.selectorLabels" . | nindent 6 }}
{{- end }}
---
{{- end }}