Newer
Older
kind: {{ .Values.stateful | ternary "StatefulSet" "Deployment" | quote }}
metadata:
name: {{ .Release.Name }}
labels:
app.kubernetes.io/name: {{ .Values.appName }}
app.kubernetes.io/instance: {{ .Release.Name }}
spec:
{{- if .Values.stateful }}
serviceName: {{ .Values.appName }}
{{ end }}
replicas: {{ .Values.replicas }}
selector:
matchLabels:
app.kubernetes.io/instance: {{ .Release.Name }}
template:
metadata:
labels:
app.kubernetes.io/name: {{ .Values.appName }}
app.kubernetes.io/instance: {{ .Release.Name }}
spec:
{{- with .Values.securityContext }}
securityContext:
{{- . | toYaml | nindent 8 }}
{{- end }}
{{- if .Values.registryCred }}
imagePullSecrets:
- name: {{ .Release.Name }}-regcred
{{- end }}
{{- if or .Values.volume .Values.mountConfigMaps}}
{{- if .Values.volume }}
- name: {{ .Values.volume.name }}
persistentVolumeClaim:
{{- end }}
{{- if .Values.mountConfigMaps }}
- name: config-files
configMap:
name: {{ .Release.Name}}-config-files
{{- end }}
{{- end}}
containers:
- image: {{ .Values.image.repo }}:{{ .Values.image.tag }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
name: {{ .Values.appName }}
{{- with .Values.command }}
command:
{{- . | toYaml | nindent 12 }}
{{- end }}
{{- with .Values.args }}
args:
{{- . | toYaml | nindent 12 }}
{{- end }}
{{- with .Values.env }}
env:
{{- range $name,$value := . }}
- name: {{ $name }}
value: {{ $value | quote }}
{{- end }}
{{- end }}
{{- if .Values.secretEnv }}
envFrom:
- secretRef:
name: {{ .Release.Name }}-env
{{- end }}
{{- if or .Values.volume .Values.mountConfigMaps}}
{{- if .Values.volume }}
- name: {{ .Values.volume.name }}
mountPath: {{ .Values.volume.mountPath }}
{{- end }}
{{- range $c := .Values.mountConfigMaps }}
- name: config-files
mountPath: {{ $c.mountPath }}
subPath: {{ $c.key }}
{{ end }}
{{- end }}
resources:
{{- toYaml .Values.resources | nindent 12 }}
{{- if .Values.readinessProbe.enabled }}
readinessProbe:
initialDelaySeconds: 5
periodSeconds: 10
timeoutSeconds: 5
failureThreshold: 20
httpGet:
path: {{ .Values.readinessProbe.path }}
{{- if .Values.readinessProbe.port }}
port: {{ .Values.readinessProbe.port }}
{{- else }}
{{- if .Values.livenessProbe.enabled }}
livenessProbe:
initialDelaySeconds: 5
periodSeconds: 10
httpGet:
path: {{ .Values.livenessProbe.path }}
{{- if .Values.livenessProbe.port }}
port: {{ .Values.livenessProbe.port }}
{{- else }}
port: {{ .Values.port }}
{{- end }}
{{- end }}