Skip to content

Commit

Permalink
add git tasks to helm
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandrvb committed Apr 11, 2024
1 parent 6c7d810 commit 2e870b5
Show file tree
Hide file tree
Showing 4 changed files with 104 additions and 0 deletions.
7 changes: 7 additions & 0 deletions charts/datalore/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,13 @@ Create the name of the database secret to use
{{- .Values.dataloreVersion | default .Chart.AppVersion }}
{{- end }}
{{- end }}
{{- define "datalore.gitTaskImage.version" -}}
{{- if .Values.gitTaskImage.versionOverride }}
{{- .Values.gitTaskImage.versionOverride }}
{{- else }}
{{- .Values.dataloreVersion | default .Chart.AppVersion }}
{{- end }}
{{- end }}
{{- define "datalore.agentImage.version" -}}
{{- if .Values.agentImage.versionOverride }}
{{- .Values.agentImage.versionOverride }}
Expand Down
81 changes: 81 additions & 0 deletions charts/datalore/templates/git-config-configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "datalore.fullname" . }}-git-config
labels:
{{- include "datalore.labels" . | nindent 4 }}
data:
fetch_job.yaml: |-
{{- if .Values.gitFetch }}
{{- tpl (toYaml .Values.gitFetch) . | nindent 4 }}
{{- else }}
apiVersion: batch/v1
kind: Job
metadata:
name: fetch
labels:
datalore-git-task: fetch
spec:
backoffLimit: 1
activeDeadlineSeconds: 120
ttlSecondsAfterFinished: 600
template:
metadata:
labels:
datalore-git-task: fetch
spec:
restartPolicy: Never
containers:
- name: fetch
image: {{ .Values.gitTaskImage.repository }}:{{ include "datalore.gitTaskImage.version" . }}
imagePullPolicy: {{ .Values.gitTaskImage.pullPolicy }}
{{- with .Values.agentsNodeSelector }}
nodeSelector:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.agentsAffinity }}
affinity:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.agentsTolerations }}
tolerations:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- end }}
clone_job.yaml: |-
{{- if .Values.gitClone }}
{{- tpl (toYaml .Values.gitClone) . | nindent 4 }}
{{- else }}
apiVersion: batch/v1
kind: Job
metadata:
name: clone
labels:
datalore-git-task: clone
spec:
backoffLimit: 1
activeDeadlineSeconds: 300
ttlSecondsAfterFinished: 600
template:
metadata:
labels:
datalore-git-task: clone
spec:
restartPolicy: Never
containers:
- name: clone
image: {{ .Values.gitTaskImage.repository }}:{{ include "datalore.gitTaskImage.version" . }}
imagePullPolicy: {{ .Values.gitTaskImage.pullPolicy }}
{{- with .Values.agentsNodeSelector }}
nodeSelector:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.agentsAffinity }}
affinity:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.agentsTolerations }}
tolerations:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- end }}
9 changes: 9 additions & 0 deletions charts/datalore/templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ spec:
value: file:///opt/datalore/configs/databases/namespaces_loader.yaml
- name: SQL_SESSION_K8S_YAML
value: file:///opt/datalore/configs/databases/sql_session.yaml
- name: GIT_FETCH_TASK_K8S_YAML
value: file:///opt/datalore/configs/git/fetch_job.yaml
- name: GIT_CLONE_TASK_K8S_YAML
value: file:///opt/datalore/configs/git/clone_job.yaml
- name: DATALORE_NAMESPACE
value: {{ .Release.Namespace }}
- name: DATALORE_POD_NAME
Expand Down Expand Up @@ -100,6 +104,8 @@ spec:
subPath: agents-config.yaml
- mountPath: /opt/datalore/configs/databases
name: databases-configs
- mountPath: /opt/datalore/configs/git
name: git-configs
{{- if .Values.logbackConfig }}
- mountPath: /opt/datalore/tomcat/conf/logback.xml
name: logback-config
Expand Down Expand Up @@ -162,6 +168,9 @@ spec:
- name: databases-configs
configMap:
name: {{ include "datalore.fullname" . }}-databases-config
- name: git-configs
configMap:
name: {{ include "datalore.fullname" . }}-git-config
{{- if .Values.volumes }}
{{- toYaml .Values.volumes | nindent 8 }}
{{- end }}
Expand Down
7 changes: 7 additions & 0 deletions charts/datalore/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ databaseCommandImage:
repository: jetbrains/datalore-database-command
pullPolicy: IfNotPresent
versionOverride: ""
gitTaskImage:
repository: jetbrains/datalore-git-task
pullPolicy: IfNotPresent
versionOverride: ""
agentImage:
repository: jetbrains/datalore-agent
pullPolicy: IfNotPresent
Expand Down Expand Up @@ -120,6 +124,9 @@ introspection: {}
namespacesLoader: {}
sqlSession: {}
sqlSessionService: {}
gitFetch: {}
gitClone: {}

plansConfig: []
logbackConfig: ""
customEnvs: {}
Expand Down

0 comments on commit 2e870b5

Please sign in to comment.