Change mxnet

This commit is contained in:
tompizmor
2019-07-22 13:50:20 +02:00
parent 20d4f4b4b5
commit 292a178cbd
8 changed files with 190 additions and 74 deletions

View File

@@ -105,7 +105,7 @@ imagePullSecrets:
{{- range .Values.global.imagePullSecrets }}
- name: {{ . }}
{{- end }}
{{- else if or .Values.image.pullSecrets .Values.git.pullSecrets }}
{{- else if or .Values.image.pullSecrets .Values.git.pullSecrets .Values.volumePermissions.image.pullSecrets }}
imagePullSecrets:
{{- range .Values.image.pullSecrets }}
- name: {{ . }}
@@ -113,8 +113,11 @@ imagePullSecrets:
{{- range .Values.git.pullSecrets }}
- name: {{ . }}
{{- end }}
{{- range .Values.volumePermissions.image.pullSecrets }}
- name: {{ . }}
{{- end }}
{{- end -}}
{{- else if or .Values.image.pullSecrets .Values.git.pullSecrets }}
{{- else if or .Values.image.pullSecrets .Values.git.pullSecrets .Values.volumePermissions.image.pullSecrets }}
imagePullSecrets:
{{- range .Values.image.pullSecrets }}
- name: {{ . }}
@@ -122,6 +125,9 @@ imagePullSecrets:
{{- range .Values.git.pullSecrets }}
- name: {{ . }}
{{- end }}
{{- range .Values.volumePermissions.image.pullSecrets }}
- name: {{ . }}
{{- end }}
{{- end -}}
{{- end -}}
@@ -185,3 +191,26 @@ mxnet: serverCount
Please set a valid worker count size (--set serverCount=X)
{{- end -}}
{{- end -}}
{{/*
Return the proper image name (for the init container volume-permissions image)
*/}}
{{- define "mxnet.volumePermissions.image" -}}
{{- $registryName := .Values.volumePermissions.image.registry -}}
{{- $repositoryName := .Values.volumePermissions.image.repository -}}
{{- $tag := .Values.volumePermissions.image.tag | toString -}}
{{/*
Helm 2.11 supports the assignment of a value to a variable defined in a different scope,
but Helm 2.9 and 2.10 doesn't support it, so we need to implement this if-else logic.
Also, we can't use a single if because lazy evaluation is not an option
*/}}
{{- if .Values.global }}
{{- if .Values.global.imageRegistry }}
{{- printf "%s/%s:%s" .Values.global.imageRegistry $repositoryName $tag -}}
{{- else -}}
{{- printf "%s/%s:%s" $registryName $repositoryName $tag -}}
{{- end -}}
{{- else -}}
{{- printf "%s/%s:%s" $registryName $repositoryName $tag -}}
{{- end -}}
{{- end -}}

View File

@@ -41,8 +41,8 @@ spec:
{{- with .Values.affinity }}
affinity: {{ tpl (toYaml .) $ | nindent 8 }}
{{- end }}
{{- if .Values.cloneFilesFromGit.enabled }}
initContainers:
{{- if .Values.cloneFilesFromGit.enabled }}
- name: git-clone-repository
image: {{ include "git.image" . }}
imagePullPolicy: {{ .Values.git.pullPolicy | quote }}
@@ -55,6 +55,18 @@ spec:
- name: git-cloned-files
mountPath: /app
{{- end }}
{{- if and .Values.volumePermissions.enabled .Values.persistence.enabled }}
- name: volume-permissions
image: "{{ template "mxnet.volumePermissions.image" . }}"
imagePullPolicy: {{ default "" .Values.volumePermissions.image.pullPolicy | quote }}
command: ["chown", "-R", "{{ .Values.securityContext.runAsUser }}:{{ .Values.securityContext.fsGroup }}", "{{ .Values.persistence.mountPath }}"]
securityContext:
runAsUser: 0
resources: {{ toYaml .Values.volumePermissions.resources | nindent 10 -}}
volumeMounts:
- name: data
mountPath: {{ .Values.persistence.mountPath }}
{{- end }}
{{- if .Values.initContainers }}
{{- toYaml .Values.initContainers | nindent 6 }}
{{- end }}
@@ -63,7 +75,7 @@ spec:
workingDir: {{ .Values.entrypoint.workDir }}
image: {{ include "mxnet.image" . }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
command:
command:
- bash
- -c
- |
@@ -88,7 +100,7 @@ spec:
value: {{ .Values.schedulerPort | quote }}
{{- if .Values.commonExtraEnvVars }}
{{- include "mxnet.parseEnvVars" .Values.commonExtraEnvVars | nindent 8 }}
{{- end }}
{{- end }}
{{- if .Values.serverExtraEnvVars }}
{{- include "mxnet.parseEnvVars" .Values.serverExtraVars | nindent 8 }}
{{- end }}

View File

@@ -40,8 +40,8 @@ spec:
{{- with .Values.affinity }}
affinity: {{ tpl (toYaml .) $ | nindent 8 }}
{{- end }}
{{- if .Values.cloneFilesFromGit.enabled }}
initContainers:
{{- if .Values.cloneFilesFromGit.enabled }}
- name: git-clone-repository
image: {{ include "git.image" . }}
imagePullPolicy: {{ .Values.git.pullPolicy | quote }}
@@ -54,6 +54,18 @@ spec:
- name: git-cloned-files
mountPath: /app
{{- end }}
{{- if and .Values.volumePermissions.enabled .Values.persistence.enabled }}
- name: volume-permissions
image: "{{ template "mxnet.volumePermissions.image" . }}"
imagePullPolicy: {{ default "" .Values.volumePermissions.image.pullPolicy | quote }}
command: ["chown", "-R", "{{ .Values.securityContext.runAsUser }}:{{ .Values.securityContext.fsGroup }}", "{{ .Values.persistence.mountPath }}"]
securityContext:
runAsUser: 0
resources: {{ toYaml .Values.volumePermissions.resources | nindent 10 -}}
volumeMounts:
- name: data
mountPath: {{ .Values.persistence.mountPath }}
{{- end }}
{{- if .Values.initContainers }}
{{- toYaml .Values.initContainers | nindent 6 }}
{{- end }}
@@ -62,7 +74,7 @@ spec:
workingDir: {{ .Values.entrypoint.workDir }}
image: {{ include "mxnet.image" . }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
command:
command:
- bash
- -c
- |
@@ -70,7 +82,7 @@ spec:
env:
{{- if .Values.commonExtraEnvVars }}
{{- include "mxnet.parseEnvVars" .Values.commonExtraEnvVars | nindent 8 }}
{{- end }}
{{- end }}
ports:
- name: mxnet
containerPort: {{ .Values.schedulerPort }}

View File

@@ -41,8 +41,8 @@ spec:
{{- with .Values.affinity }}
affinity: {{ tpl (toYaml .) $ | nindent 8 }}
{{- end }}
{{- if .Values.cloneFilesFromGit.enabled }}
initContainers:
{{- if .Values.cloneFilesFromGit.enabled }}
- name: git-clone-repository
image: {{ include "git.image" . }}
imagePullPolicy: {{ .Values.git.pullPolicy | quote }}
@@ -55,6 +55,18 @@ spec:
- name: git-cloned-files
mountPath: /app
{{- end }}
{{- if and .Values.volumePermissions.enabled .Values.persistence.enabled }}
- name: volume-permissions
image: "{{ template "mxnet.volumePermissions.image" . }}"
imagePullPolicy: {{ default "" .Values.volumePermissions.image.pullPolicy | quote }}
command: ["chown", "-R", "{{ .Values.securityContext.runAsUser }}:{{ .Values.securityContext.fsGroup }}", "{{ .Values.persistence.mountPath }}"]
securityContext:
runAsUser: 0
resources: {{ toYaml .Values.volumePermissions.resources | nindent 10 -}}
volumeMounts:
- name: data
mountPath: {{ .Values.persistence.mountPath }}
{{- end }}
{{- if .Values.initContainers }}
{{- toYaml .Values.initContainers | nindent 6 }}
{{- end }}
@@ -63,7 +75,7 @@ spec:
workingDir: {{ .Values.entrypoint.workDir }}
image: {{ include "mxnet.image" . }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
command:
command:
- bash
- -c
- |
@@ -88,7 +100,7 @@ spec:
value: {{ .Values.schedulerPort | quote }}
{{- if .Values.commonExtraEnvVars }}
{{- include "mxnet.parseEnvVars" .Values.commonExtraEnvVars | nindent 8 }}
{{- end }}
{{- end }}
{{- if .Values.workerExtraEnvVars }}
{{- include "mxnet.parseEnvVars" .Values.workerExtraVars | nindent 8 }}
{{- end }}