|
1 | 1 | apiVersion: batch/v1
|
2 |
| -kind: Job |
| 2 | +kind: CronJob |
3 | 3 | metadata:
|
4 | 4 | name: studio-datachain-worker-template
|
5 | 5 | labels:
|
6 | 6 | {{- include "studio-datachain-worker.labels" . | nindent 4 }}
|
7 | 7 | spec:
|
8 |
| - suspend: true # this Job will never run; it's a template to create new Jobs |
9 |
| - activeDeadlineSeconds: {{ (.Values.studioDatachainWorkerJobTemplate).activeDeadlineSeconds }} |
10 |
| - ttlSecondsAfterFinished: {{ (.Values.studioDatachainWorkerJobTemplate).ttlSecondsAfterFinished }} |
11 |
| - backoffLimit: {{ (.Values.studioDatachainWorkerJobTemplate).backoffLimit }} |
12 |
| - template: |
13 |
| - metadata: |
14 |
| - annotations: |
15 |
| - {{- with (.Values.studioDatachainWorkerJobTemplate).podAnnotations }} |
16 |
| - {{- toYaml . | nindent 8 }} |
17 |
| - {{- end }} |
| 8 | + suspend: true # this CronJob will never run; it's just a Job template |
| 9 | + schedule: "* * * * *" |
| 10 | + jobTemplate: |
18 | 11 | spec:
|
19 |
| - restartPolicy: Never |
20 |
| - {{- with .Values.imagePullSecrets }} |
21 |
| - imagePullSecrets: |
22 |
| - {{- toYaml . | nindent 8 }} |
23 |
| - {{- end }} |
24 |
| - serviceAccountName: {{ include "studio-datachain-worker.serviceAccountName" . }} |
25 |
| - runtimeClassName: {{ (.Values.studioDatachainWorkerJobTemplate).runtimeClassName }} |
26 |
| - securityContext: |
27 |
| - fsGroup: 103 |
28 |
| - fsGroupChangePolicy: "OnRootMismatch" |
29 |
| - {{- with (.Values.studioDatachainWorkerJobTemplate).podSecurityContext }} |
30 |
| - {{- toYaml . | nindent 8 }} |
31 |
| - {{- end }} |
32 |
| - containers: |
33 |
| - - name: studio-datachain-worker |
| 12 | + activeDeadlineSeconds: {{ (.Values.studioDatachainWorkerJobTemplate).activeDeadlineSeconds }} |
| 13 | + ttlSecondsAfterFinished: {{ (.Values.studioDatachainWorkerJobTemplate).ttlSecondsAfterFinished }} |
| 14 | + backoffLimit: {{ (.Values.studioDatachainWorkerJobTemplate).backoffLimit }} |
| 15 | + template: |
| 16 | + metadata: |
| 17 | + annotations: |
| 18 | + {{- with (.Values.studioDatachainWorkerJobTemplate).podAnnotations }} |
| 19 | + {{- toYaml . | nindent 12 }} |
| 20 | + {{- end }} |
| 21 | + spec: |
| 22 | + restartPolicy: Never |
| 23 | + {{- with .Values.imagePullSecrets }} |
| 24 | + imagePullSecrets: |
| 25 | + {{- toYaml . | nindent 12 }} |
| 26 | + {{- end }} |
| 27 | + serviceAccountName: {{ include "studio-datachain-worker.serviceAccountName" . }} |
| 28 | + runtimeClassName: {{ (.Values.studioDatachainWorkerJobTemplate).runtimeClassName }} |
34 | 29 | securityContext:
|
35 |
| - {{- toYaml (.Values.studioDatachainWorkerJobTemplate).securityContext | nindent 12 }} |
36 |
| - image: "{{ (.Values.studioDatachainWorkerJobTemplate).image.repository }}:{{ (.Values.studioDatachainWorkerJobTemplate).image.tag | default .Chart.AppVersion }}" |
37 |
| - imagePullPolicy: {{ (.Values.studioDatachainWorkerJobTemplate).image.pullPolicy }} |
38 |
| - args: ["/app/bin/run_celery.sh", "datachain-worker"] |
39 |
| - resources: |
40 |
| - {{- toYaml (.Values.studioDatachainWorkerJobTemplate).resources | nindent 12 }} |
41 |
| - env: |
42 |
| - - name: "NO_MIGRATE_DB" |
43 |
| - value: "1" |
44 |
| - - name: "WAIT_FOR_MIGRATIONS" |
45 |
| - value: "0" |
46 |
| - - name: "CELERY_WORKER_SINGLE_TASK_MODE" |
47 |
| - value: "True" |
48 |
| - - name: "CELERY_WORKER_IDLE_TIMEOUT" |
49 |
| - value: {{ (.Values.studioDatachainWorkerJobTemplate).idleTimeout | quote }} |
50 |
| - volumeMounts: |
| 30 | + fsGroup: 103 |
| 31 | + fsGroupChangePolicy: "OnRootMismatch" |
| 32 | + {{- with (.Values.studioDatachainWorkerJobTemplate).podSecurityContext }} |
| 33 | + {{- toYaml . | nindent 12 }} |
| 34 | + {{- end }} |
| 35 | + containers: |
| 36 | + - name: studio-datachain-worker |
| 37 | + securityContext: |
| 38 | + {{- toYaml (.Values.studioDatachainWorkerJobTemplate).securityContext | nindent 16 }} |
| 39 | + image: "{{ (.Values.studioDatachainWorkerJobTemplate).image.repository }}:{{ (.Values.studioDatachainWorkerJobTemplate).image.tag | default .Chart.AppVersion }}" |
| 40 | + imagePullPolicy: {{ (.Values.studioDatachainWorkerJobTemplate).image.pullPolicy }} |
| 41 | + args: ["/app/bin/run_celery.sh", "datachain-worker"] |
| 42 | + resources: |
| 43 | + {{- toYaml (.Values.studioDatachainWorkerJobTemplate).resources | nindent 16 }} |
| 44 | + env: |
| 45 | + - name: "NO_MIGRATE_DB" |
| 46 | + value: "1" |
| 47 | + - name: "WAIT_FOR_MIGRATIONS" |
| 48 | + value: "0" |
| 49 | + - name: "CELERY_WORKER_SINGLE_TASK_MODE" |
| 50 | + value: "True" |
| 51 | + - name: "CELERY_WORKER_IDLE_TIMEOUT" |
| 52 | + value: {{ (.Values.studioDatachainWorkerJobTemplate).idleTimeout | quote }} |
| 53 | + envFrom: |
| 54 | + - configMapRef: |
| 55 | + name: studio |
| 56 | + - configMapRef: |
| 57 | + name: {{ .Release.Name }}-datachain-worker |
| 58 | + - secretRef: |
| 59 | + name: studio |
| 60 | + {{- if .Values.global.envFromSecret }} |
| 61 | + - secretRef: |
| 62 | + name: {{ .Values.global.envFromSecret }} |
| 63 | + {{- end }} |
| 64 | + {{- if .Values.studioDatachainWorker.envFromSecret }} |
| 65 | + - secretRef: |
| 66 | + name: {{ .Values.studioDatachainWorker.envFromSecret }} |
| 67 | + {{- end }} |
| 68 | + volumeMounts: |
| 69 | + - name: studio-ca-certificates |
| 70 | + mountPath: /usr/local/share/ca-certificates |
| 71 | + - name: tmp-ephemeral |
| 72 | + mountPath: /tmp/shared |
| 73 | + {{- if (.Values.studioDatachainWorkerJobTemplate).localStorage }} |
| 74 | + - name: tmp-local |
| 75 | + mountPath: /tmp/local |
| 76 | + {{- end }} |
| 77 | + volumes: |
51 | 78 | - name: studio-ca-certificates
|
52 |
| - mountPath: /usr/local/share/ca-certificates |
| 79 | + configMap: |
| 80 | + name: studio-ca-certificates |
53 | 81 | - name: tmp-ephemeral
|
54 |
| - mountPath: /tmp/shared |
55 |
| - {{- if (.Values.studioDatachainWorkerJobTemplate).localStorage }} |
| 82 | + {{- if eq (.Values.studioDatachainWorkerJobTemplate).ephemeralStorage.type "ephemeral" }} |
| 83 | + ephemeral: |
| 84 | + volumeClaimTemplate: |
| 85 | + metadata: |
| 86 | + labels: |
| 87 | + type: {{.Release.Name}}-{{ (.Values.studioDatachainWorkerJobTemplate).ephemeralStorage.persistentVolumeClaim.claimName }} |
| 88 | + spec: |
| 89 | + accessModes: [ "ReadWriteOnce" ] |
| 90 | + {{- if (.Values.studioDatachainWorkerJobTemplate).ephemeralStorage.persistentVolumeClaim.storageClass }} |
| 91 | + storageClassName: {{ (.Values.studioDatachainWorkerJobTemplate).ephemeralStorage.persistentVolumeClaim.storageClass }} |
| 92 | + {{- end }} |
| 93 | + resources: |
| 94 | + requests: |
| 95 | + storage: {{ (.Values.studioDatachainWorkerJobTemplate).ephemeralStorage.size }} |
| 96 | + {{- else if eq (.Values.studioDatachainWorkerJobTemplate).ephemeralStorage.type "pvc" }} |
| 97 | + persistentVolumeClaim: |
| 98 | + claimName: {{ (.Values.studioDatachainWorkerJobTemplate).ephemeralStorage.persistentVolumeClaim.claimName }} |
| 99 | + {{- else if eq (.Values.studioDatachainWorkerJobTemplate).ephemeralStorage.type "pvcRWX" }} |
| 100 | + persistentVolumeClaim: |
| 101 | + claimName: {{.Release.Name}}-studio-datachain-worker-ephemeral-rwx |
| 102 | + {{- else if eq (.Values.studioDatachainWorkerJobTemplate).ephemeralStorage.type "emptyDir"}} |
| 103 | + emptyDir: |
| 104 | + sizeLimit: {{ (.Values.studioDatachainWorkerJobTemplate).ephemeralStorage.size }} |
| 105 | + {{- end }} |
| 106 | + {{- with (.Values.studioDatachainWorkerJobTemplate).localStorage }} |
56 | 107 | - name: tmp-local
|
57 |
| - mountPath: /tmp/local |
| 108 | + {{- if eq .type "ephemeral" }} |
| 109 | + ephemeral: |
| 110 | + volumeClaimTemplate: |
| 111 | + metadata: |
| 112 | + labels: |
| 113 | + type: {{ $.Release.Name }}-{{ .persistentVolumeClaim.claimName }} |
| 114 | + spec: |
| 115 | + accessModes: [ "ReadWriteOnce" ] |
| 116 | + {{- if .persistentVolumeClaim.storageClass }} |
| 117 | + storageClassName: {{ .persistentVolumeClaim.storageClass }} |
| 118 | + {{- end }} |
| 119 | + resources: |
| 120 | + requests: |
| 121 | + storage: {{ .size }} |
| 122 | + {{- else if eq .type "pvc" }} |
| 123 | + persistentVolumeClaim: |
| 124 | + claimName: {{ .persistentVolumeClaim.claimName }} |
| 125 | + {{- else if eq .type "emptyDir"}} |
| 126 | + emptyDir: |
| 127 | + sizeLimit: {{ .size }} |
| 128 | + {{- end }} |
58 | 129 | {{- end }}
|
59 |
| - volumes: |
60 |
| - - name: studio-ca-certificates |
61 |
| - configMap: |
62 |
| - name: studio-ca-certificates |
63 |
| - - name: tmp-ephemeral |
64 |
| - {{- if eq (.Values.studioDatachainWorkerJobTemplate).ephemeralStorage.type "ephemeral" }} |
65 |
| - ephemeral: |
66 |
| - volumeClaimTemplate: |
67 |
| - metadata: |
68 |
| - labels: |
69 |
| - type: {{.Release.Name}}-{{ (.Values.studioDatachainWorkerJobTemplate).ephemeralStorage.persistentVolumeClaim.claimName }} |
70 |
| - spec: |
71 |
| - accessModes: [ "ReadWriteOnce" ] |
72 |
| - {{- if (.Values.studioDatachainWorkerJobTemplate).ephemeralStorage.persistentVolumeClaim.storageClass }} |
73 |
| - storageClassName: {{ (.Values.studioDatachainWorkerJobTemplate).ephemeralStorage.persistentVolumeClaim.storageClass }} |
74 |
| - {{- end }} |
75 |
| - resources: |
76 |
| - requests: |
77 |
| - storage: {{ (.Values.studioDatachainWorkerJobTemplate).ephemeralStorage.size }} |
78 |
| - {{- else if eq (.Values.studioDatachainWorkerJobTemplate).ephemeralStorage.type "pvc" }} |
79 |
| - persistentVolumeClaim: |
80 |
| - claimName: {{ (.Values.studioDatachainWorkerJobTemplate).ephemeralStorage.persistentVolumeClaim.claimName }} |
81 |
| - {{- else if eq (.Values.studioDatachainWorkerJobTemplate).ephemeralStorage.type "pvcRWX" }} |
82 |
| - persistentVolumeClaim: |
83 |
| - claimName: {{.Release.Name}}-studio-datachain-worker-ephemeral-rwx |
84 |
| - {{- else if eq (.Values.studioDatachainWorkerJobTemplate).ephemeralStorage.type "emptyDir"}} |
85 |
| - emptyDir: |
86 |
| - sizeLimit: {{ (.Values.studioDatachainWorkerJobTemplate).ephemeralStorage.size }} |
| 130 | + {{- with (.Values.studioDatachainWorkerJobTemplate).nodeSelector }} |
| 131 | + nodeSelector: |
| 132 | + {{- toYaml . | nindent 12 }} |
87 | 133 | {{- end }}
|
88 |
| - {{- with (.Values.studioDatachainWorkerJobTemplate).localStorage }} |
89 |
| - - name: tmp-local |
90 |
| - {{- if eq .type "ephemeral" }} |
91 |
| - ephemeral: |
92 |
| - volumeClaimTemplate: |
93 |
| - metadata: |
94 |
| - labels: |
95 |
| - type: {{ $.Release.Name }}-{{ .persistentVolumeClaim.claimName }} |
96 |
| - spec: |
97 |
| - accessModes: [ "ReadWriteOnce" ] |
98 |
| - {{- if .persistentVolumeClaim.storageClass }} |
99 |
| - storageClassName: {{ .persistentVolumeClaim.storageClass }} |
100 |
| - {{- end }} |
101 |
| - resources: |
102 |
| - requests: |
103 |
| - storage: {{ .size }} |
104 |
| - {{- else if eq .type "pvc" }} |
105 |
| - persistentVolumeClaim: |
106 |
| - claimName: {{ .persistentVolumeClaim.claimName }} |
107 |
| - {{- else if eq .type "emptyDir"}} |
108 |
| - emptyDir: |
109 |
| - sizeLimit: {{ .size }} |
| 134 | + {{- with (.Values.studioDatachainWorkerJobTemplate).affinity }} |
| 135 | + affinity: |
| 136 | + {{- toYaml . | nindent 12 }} |
| 137 | + {{- end }} |
| 138 | + {{- with (.Values.studioDatachainWorkerJobTemplate).tolerations }} |
| 139 | + tolerations: |
| 140 | + {{- toYaml . | nindent 12 }} |
110 | 141 | {{- end }}
|
111 |
| - {{- end }} |
112 |
| - {{- with (.Values.studioDatachainWorkerJobTemplate).nodeSelector }} |
113 |
| - nodeSelector: |
114 |
| - {{- toYaml . | nindent 8 }} |
115 |
| - {{- end }} |
116 |
| - {{- with (.Values.studioDatachainWorkerJobTemplate).affinity }} |
117 |
| - affinity: |
118 |
| - {{- toYaml . | nindent 8 }} |
119 |
| - {{- end }} |
120 |
| - {{- with (.Values.studioDatachainWorkerJobTemplate).tolerations }} |
121 |
| - tolerations: |
122 |
| - {{- toYaml . | nindent 8 }} |
123 |
| - {{- end }} |
|
0 commit comments