forked from ClickHouse/code-interpreter
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpackage-init-job.yaml
More file actions
82 lines (82 loc) · 3.53 KB
/
Copy pathpackage-init-job.yaml
File metadata and controls
82 lines (82 loc) · 3.53 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
{{/*
Package Init Job
Populates the packages PVC (Python, Node, Bun, Bash runtimes for the NsJail
sandbox) once. Ordered before the sandbox-runner by Argo CD sync-wave -5.
Managed resource, NOT a Sync hook: an unchanged sync is an apply no-op that
does NOT re-run the Job or wake the (scale-to-zero) sandbox node pool. No TTL,
so the completed Job persists and stays a no-op across syncs. Its spec is
immutable: to re-run it (forceRebuild or a runtime-version bump), delete the Job
first, then sync (see values.yaml initJob.forceRebuild).
*/}}
{{- if and .Values.workerSandbox.enabled .Values.workerSandbox.packages.initJob.enabled }}
{{- $packageInitNodeSelector := .Values.workerSandbox.sandboxRunner.nodeSelector }}
{{- $packageInitTolerations := .Values.workerSandbox.sandboxRunner.tolerations }}
{{- if .Values.workerSandbox.sandboxRunner.inheritSharedScheduling }}
{{- $packageInitNodeSelector = default .Values.nodeSelector $packageInitNodeSelector }}
{{- $packageInitTolerations = default .Values.tolerations $packageInitTolerations }}
{{- end }}
apiVersion: batch/v1
kind: Job
metadata:
{{- with .Values.workerSandbox.sandboxRunner.namespaceOverride }}
namespace: {{ . }}
{{- end }}
name: {{ include "codeapi.fullname" . }}-package-init
labels:
{{- include "codeapi.labels" . | nindent 4 }}
app.kubernetes.io/component: package-init
annotations:
"argocd.argoproj.io/sync-wave": "-5"
spec:
backoffLimit: {{ .Values.workerSandbox.packages.initJob.backoffLimit }}
template:
metadata:
labels:
{{- include "codeapi.labels" . | nindent 8 }}
app.kubernetes.io/component: package-init
spec:
{{- with .Values.global.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
restartPolicy: Never
containers:
- name: package-init
image: "{{ .Values.workerSandbox.packages.initJob.image.repository }}:{{ .Values.workerSandbox.packages.initJob.image.tag }}"
imagePullPolicy: {{ .Values.workerSandbox.packages.initJob.image.pullPolicy }}
env:
- name: PYTHON_VERSION
value: {{ .Values.workerSandbox.packages.initJob.pythonVersion | quote }}
- name: NODE_VERSION
value: {{ .Values.workerSandbox.packages.initJob.nodeVersion | quote }}
- name: BUN_VERSION
value: {{ .Values.workerSandbox.packages.initJob.bunVersion | quote }}
- name: BASH_PACKAGE_VERSION
value: {{ .Values.workerSandbox.packages.initJob.bashPackageVersion | quote }}
- name: FORCE_REBUILD
value: {{ .Values.workerSandbox.packages.initJob.forceRebuild | quote }}
volumeMounts:
- name: packages
mountPath: /pkgs
resources:
{{- toYaml .Values.workerSandbox.packages.initJob.resources | nindent 12 }}
volumes:
- name: packages
{{- if .Values.workerSandbox.packages.persistence.existingClaim }}
persistentVolumeClaim:
claimName: {{ .Values.workerSandbox.packages.persistence.existingClaim }}
{{- else if .Values.workerSandbox.packages.persistence.enabled }}
persistentVolumeClaim:
claimName: {{ include "codeapi.fullname" . }}-packages
{{- else }}
emptyDir: {}
{{- end }}
{{- with $packageInitNodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with $packageInitTolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- end }}