Files
charts/bitnami/mxnet/templates/standalone/deployment.yaml
Orgad Shaneh 2b90a296bf [bitnami/mxnet] Use custom probes if given (#12531)
Without this change, in order to use a custom probe, the user has to
specify the probe parameters, and also must specify for the original
probe "enabled: false".

Issue: #12354
Signed-off-by: Orgad Shaneh <orgad.shaneh@audiocodes.com>

Signed-off-by: Orgad Shaneh <orgad.shaneh@audiocodes.com>
2022-09-19 16:06:38 +02:00

234 lines
12 KiB
YAML

{{- if eq .Values.mode "standalone" }}
apiVersion: {{ include "common.capabilities.deployment.apiVersion" . }}
kind: Deployment
metadata:
name: {{ include "common.names.fullname" . }}
namespace: {{ include "common.names.namespace" . | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
app.kubernetes.io/component: standalone
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
spec:
replicas: 1
{{- if .Values.standalone.updateStrategy }}
strategy: {{- toYaml .Values.standalone.updateStrategy | nindent 6 }}
{{- end }}
selector:
matchLabels: {{- include "common.labels.matchLabels" . | nindent 6 }}
app.kubernetes.io/component: standalone
template:
metadata:
{{- if .Values.standalone.podAnnotations }}
annotations: {{- include "common.tplvalues.render" (dict "value" .Values.standalone.podAnnotations "context" $) | nindent 8 }}
{{- end }}
labels: {{- include "common.labels.standard" . | nindent 8 }}
app.kubernetes.io/component: standalone
{{- if .Values.standalone.podLabels }}
{{- include "common.tplvalues.render" (dict "value" .Values.standalone.podLabels "context" $) | nindent 8 }}
{{- end }}
spec:
{{- include "mxnet.imagePullSecrets" . | nindent 6 }}
{{- if .Values.standalone.hostAliases }}
hostAliases: {{- include "common.tplvalues.render" (dict "value" .Values.standalone.hostAliases "context" $) | nindent 8 }}
{{- end }}
{{- if .Values.standalone.affinity }}
affinity: {{- include "common.tplvalues.render" ( dict "value" .Values.standalone.affinity "context" $) | nindent 8 }}
{{- else }}
affinity:
podAffinity: {{- include "common.affinities.pods" (dict "type" .Values.standalone.podAffinityPreset "context" $) | nindent 10 }}
podAntiAffinity: {{- include "common.affinities.pods" (dict "type" .Values.standalone.podAntiAffinityPreset "context" $) | nindent 10 }}
nodeAffinity: {{- include "common.affinities.nodes" (dict "type" .Values.standalone.nodeAffinityPreset.type "key" .Values.standalone.nodeAffinityPreset.key "values" .Values.standalone.nodeAffinityPreset.values) | nindent 10 }}
{{- end }}
{{- if .Values.standalone.nodeSelector }}
nodeSelector: {{- include "common.tplvalues.render" ( dict "value" .Values.standalone.nodeSelector "context" $) | nindent 8 }}
{{- end }}
{{- if .Values.standalone.tolerations }}
tolerations: {{- include "common.tplvalues.render" (dict "value" .Values.standalone.tolerations "context" .) | nindent 8 }}
{{- end }}
{{- if .Values.standalone.priorityClassName }}
priorityClassName: {{ .Values.standalone.priorityClassName | quote }}
{{- end }}
{{- if .Values.standalone.schedulerName }}
schedulerName: {{ .Values.standalone.schedulerName | quote }}
{{- end }}
{{- if .Values.standalone.topologySpreadConstraints }}
topologySpreadConstraints: {{- include "common.tplvalues.render" (dict "value" .Values.standalone.topologySpreadConstraints "context" .) | nindent 8 }}
{{- end }}
{{- if .Values.standalone.podSecurityContext.enabled }}
securityContext: {{- omit .Values.standalone.podSecurityContext "enabled" | toYaml | nindent 8 }}
{{- end }}
{{- if .Values.standalone.terminationGracePeriodSeconds }}
terminationGracePeriodSeconds: {{ .Values.standalone.terminationGracePeriodSeconds }}
{{- end }}
initContainers:
{{- if .Values.cloneFilesFromGit.enabled }}
- name: git-clone-repository
image: {{ include "git.image" . }}
imagePullPolicy: {{ .Values.git.pullPolicy | quote }}
command:
- /bin/sh
args:
- -c
- |
[[ -f "/opt/bitnami/scripts/git/entrypoint.sh" ]] && source "/opt/bitnami/scripts/git/entrypoint.sh"
git clone {{ .Values.cloneFilesFromGit.repository }} --branch {{ .Values.cloneFilesFromGit.revision }} /app
volumeMounts:
- name: git-cloned-files
mountPath: /app
{{- if .Values.cloneFilesFromGit.extraVolumeMounts }}
{{- include "common.tplvalues.render" (dict "value" .Values.cloneFilesFromGit.extraVolumeMounts "context" $) | nindent 12 }}
{{- end }}
{{- 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:
- /bin/bash
args:
- -ec
- |
mkdir -p {{ .Values.persistence.mountPath }}
chown {{ .Values.standalone.containerSecurityContext.runAsUser }}:{{ .Values.standalone.podSecurityContext.fsGroup }} {{ .Values.persistence.mountPath }}
find {{ .Values.persistence.mountPath }} -mindepth 1 -maxdepth 1 -not -name ".snapshot" -not -name "lost+found" | xargs chown -R {{ .Values.standalone.containerSecurityContext.runAsUser }}:{{ .Values.standalone.podSecurityContext.fsGroup }}
securityContext:
runAsUser: 0
{{- if .Values.volumePermissions.resources }}
resources: {{- toYaml .Values.volumePermissions.resources | nindent 12 }}
{{- end }}
volumeMounts:
- name: data
mountPath: {{ .Values.persistence.mountPath }}
{{- end }}
{{- if .Values.initContainers }}
{{- include "common.tplvalues.render" ( dict "value" .Values.initContainers "context" $) | nindent 8 }}
{{- end }}
{{- if .Values.standalone.initContainers }}
{{- include "common.tplvalues.render" ( dict "value" .Values.standalone.initContainers "context" $) | nindent 8 }}
{{- end }}
containers:
- name: mxnet
workingDir: {{ .Values.entrypoint.workDir }}
image: {{ include "mxnet.image" . }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
{{- if .Values.standalone.containerSecurityContext.enabled }}
securityContext: {{- omit .Values.standalone.containerSecurityContext "enabled" | toYaml | nindent 12 }}
{{- end }}
{{- if .Values.diagnosticMode.enabled }}
command: {{- include "common.tplvalues.render" (dict "value" .Values.diagnosticMode.command "context" $) | nindent 12 }}
{{- else if .Values.standalone.command }}
command: {{- include "common.tplvalues.render" (dict "value" .Values.standalone.command "context" $) | nindent 12 }}
{{- else }}
command:
- bash
- -c
- |
{{- include "mxnet.entrypoint" . | nindent 14 }}
{{- end }}
{{- if .Values.diagnosticMode.enabled }}
args: {{- include "common.tplvalues.render" (dict "value" .Values.diagnosticMode.args "context" $) | nindent 12 }}
{{- else if .Values.standalone.args }}
args: {{- include "common.tplvalues.render" (dict "value" .Values.standalone.args "context" $) | nindent 12 }}
{{- end }}
{{- if .Values.standalone.lifecycleHooks }}
lifecycle: {{- include "common.tplvalues.render" (dict "value" .Values.standalone.lifecycleHooks "context" $) | nindent 12 }}
{{- end }}
env:
{{- if .Values.extraEnvVars }}
{{- include "common.tplvalues.render" (dict "value" .Values.extraEnvVars "context" $) | nindent 12 }}
{{- end }}
{{- if .Values.standalone.extraEnvVars }}
{{- include "common.tplvalues.render" (dict "value" .Values.standalone.extraEnvVars "context" $) | nindent 12 }}
{{- end }}
envFrom:
{{- if .Values.extraEnvVarsCM }}
- configMapRef:
name: {{ include "common.tplvalues.render" (dict "value" .Values.extraEnvVarsCM "context" $) }}
{{- end }}
{{- if .Values.extraEnvVarsSecret }}
- secretRef:
name: {{ include "common.tplvalues.render" (dict "value" .Values.extraEnvVarsSecret "context" $) }}
{{- end }}
{{- if .Values.standalone.extraEnvVarsCM }}
- configMapRef:
name: {{ include "common.tplvalues.render" (dict "value" .Values.standalone.extraEnvVarsCM "context" $) }}
{{- end }}
{{- if .Values.standalone.extraEnvVarsSecret }}
- secretRef:
name: {{ include "common.tplvalues.render" (dict "value" .Values.standalone.extraEnvVarsSecret "context" $) }}
{{- end }}
ports:
- name: mxnet
containerPort: {{ .Values.standalone.containerPorts.mxnet }}
{{- if not .Values.diagnosticMode.enabled }}
{{- if .Values.standalone.customLivenessProbe }}
livenessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.standalone.customLivenessProbe "context" $) | nindent 12 }}
{{- else if .Values.standalone.livenessProbe.enabled }}
livenessProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.standalone.livenessProbe "enabled") "context" $) | nindent 12 }}
exec:
command:
- python3
- -c
- import mxnet; print(mxnet.__version__)
{{- end }}
{{- if .Values.standalone.customReadinessProbe }}
readinessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.standalone.customReadinessProbe "context" $) | nindent 12 }}
{{- else if .Values.standalone.readinessProbe.enabled }}
readinessProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.standalone.readinessProbe "enabled") "context" $) | nindent 12 }}
exec:
command:
- python3
- -c
- import mxnet; print(mxnet.__version__)
{{- end }}
{{- if .Values.standalone.customStartupProbe }}
startupProbe: {{- include "common.tplvalues.render" (dict "value" .Values.standalone.customStartupProbe "context" $) | nindent 12 }}
{{- else if .Values.standalone.startupProbe.enabled }}
startupProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.standalone.startupProbe "enabled") "context" $) | nindent 12 }}
exec:
command:
- python3
- -c
- import mxnet; print(mxnet.__version__)
{{- end }}
{{- end }}
{{- if .Values.standalone.resources }}
resources: {{- toYaml .Values.standalone.resources | nindent 12 }}
{{- end }}
volumeMounts:
{{ include "mxnet.volumeMounts" . | nindent 12 }}
- name: data
mountPath: {{ .Values.persistence.mountPath }}
{{- if .Values.extraVolumeMounts }}
{{- include "common.tplvalues.render" ( dict "value" .Values.extraVolumeMounts "context" $) | nindent 12 }}
{{- end }}
{{- if .Values.standalone.extraVolumeMounts }}
{{- include "common.tplvalues.render" ( dict "value" .Values.standalone.extraVolumeMounts "context" $) | nindent 12 }}
{{- end }}
{{- if .Values.sidecars }}
{{- include "common.tplvalues.render" ( dict "value" .Values.sidecars "context" $) | nindent 8 }}
{{- end }}
{{- if .Values.standalone.sidecars }}
{{- include "common.tplvalues.render" ( dict "value" .Values.standalone.sidecars "context" $) | nindent 8 }}
{{- end }}
volumes:
{{ include "mxnet.volumes" . | nindent 8 }}
{{- if .Values.extraVolumes }}
{{- include "common.tplvalues.render" ( dict "value" .Values.extraVolumes "context" $) | nindent 8 }}
{{- end }}
{{- if .Values.standalone.extraVolumes }}
{{- include "common.tplvalues.render" ( dict "value" .Values.standalone.extraVolumes "context" $) | nindent 8 }}
{{- end }}
- name: data
{{- if .Values.persistence.enabled }}
persistentVolumeClaim:
claimName: {{ default (include "common.names.fullname" .) .Values.persistence.existingClaim }}
{{- else }}
emptyDir: {}
{{- end }}
{{- end }}