improwised-charts/erpnext/templates/deployment-erpnext.yaml

169 lines
6.4 KiB
YAML

apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "erpnext.fullname" . }}-erpnext
labels:
{{- include "erpnext.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
app.kubernetes.io/name: {{ include "erpnext.name" . }}-backend
app.kubernetes.io/instance: {{ .Release.Name }}-backend
template:
metadata:
labels:
app.kubernetes.io/name: {{ include "erpnext.name" . }}-backend
app.kubernetes.io/instance: {{ .Release.Name }}-backend
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "erpnext.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
{{- if .Values.volumePermissions.enabled }}
initContainers:
- name: frappe-bench-ownership
image: quay.io/libpod/alpine:3.2
imagePullPolicy: {{ .Values.nginxImage.pullPolicy }}
command: ['sh', '-c']
args: ['chown -R 1000:1000 /home/frappe/frappe-bench']
securityContext:
{{- if .Values.securityContext }}
{{- toYaml .Values.securityContext | nindent 12 }}
{{- end }}
capabilities:
add: ["CAP_CHOWN"]
volumeMounts:
- name: sites-dir
mountPath: /home/frappe/frappe-bench/sites
- name: logs
mountPath: /home/frappe/frappe-bench/logs
{{- end }}
containers:
- name: {{ .Chart.Name }}-assets
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.nginxImage.repository }}:{{ .Values.nginxImage.tag }}"
volumeMounts:
- name: assets-cache
mountPath: /assets
- name: sites-dir
mountPath: /var/www/html/sites
imagePullPolicy: {{ .Values.nginxImage.pullPolicy }}
env:
- name: "FRAPPE_PY"
value: "0.0.0.0"
- name: "FRAPPE_PY_PORT"
value: {{ .Values.frappePyPort | quote }}
- name: "FRAPPE_SOCKETIO"
value: {{ template "erpnext.fullname" . }}-socketio
- name: "SOCKETIO_PORT"
value: {{ .Values.socketIOPort | quote }}
{{- if .Values.upstreamRealIPAddress }}
- name: "UPSTREAM_REAL_IP_ADDRESS"
value: "{{ .Values.upstreamRealIPAddress }}"
{{- end }}
{{- if .Values.upstreamRealIPRecursive }}
- name: "UPSTREAM_REAL_IP_RECURSIVE"
value: {{ .Values.upstreamRealIPRecursive }}
{{- end }}
{{- if .Values.upstreamRealIPHeader }}
- name: "UPSTREAM_REAL_IP_HEADER"
value: {{ .Values.upstreamRealIPHeader }}
{{- end }}
ports:
- name: http
containerPort: 80
protocol: TCP
resources:
{{- toYaml .Values.resources | nindent 12 }}
- name: {{ .Chart.Name }}-python
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.pythonImage.repository }}:{{ .Values.pythonImage.tag }}"
volumeMounts:
- name: assets-cache
mountPath: /home/frappe/frappe-bench/sites/assets
- name: sites-dir
mountPath: /home/frappe/frappe-bench/sites
- name: logs
mountPath: /home/frappe/frappe-bench/logs
imagePullPolicy: {{ .Values.pythonImage.pullPolicy }}
env:
- name: "MARIADB_HOST"
value: {{ required "A valid .Values.mariadbHost entry required!" (include "erpnext.mariadbHost" .) }}
- name: "REDIS_QUEUE"
{{- if eq (include "erpnext.redisQueueHost" .) "" }}
value: {{ include "erpnext.fullname" . }}-redis-queue:{{ .Values.redisQueueService.port }}
{{- else }}
value: {{ include "erpnext.redisQueueHost" . }}
{{- end }}
- name: "REDIS_CACHE"
{{- if eq (include "erpnext.redisCacheHost" .) "" }}
value: {{ include "erpnext.fullname" . }}-redis-cache:{{ .Values.redisCacheService.port }}
{{- else }}
value: {{ include "erpnext.redisCacheHost" . }}
{{- end }}
- name: "REDIS_SOCKETIO"
{{- if eq (include "erpnext.redisSocketIOHost" .) "" }}
value: {{ include "erpnext.fullname" . }}-redis-socketio:{{ .Values.redisSocketIOService.port }}
{{- else }}
value: {{ include "erpnext.redisSocketIOHost" . }}
{{- end }}
- name: "SOCKETIO_PORT"
value: {{ .Values.socketIOPort | quote }}
livenessProbe:
tcpSocket:
port: {{ .Values.frappePyPort }}
initialDelaySeconds: 5
periodSeconds: 10
readinessProbe:
tcpSocket:
port: {{ .Values.frappePyPort }}
initialDelaySeconds: 5
periodSeconds: 10
resources:
{{- toYaml .Values.resources | nindent 12 }}
volumes:
- name: assets-cache
emptyDir: {}
- name: sites-dir
{{- if .Values.persistence.worker.enabled }}
persistentVolumeClaim:
{{- if .Values.persistence.worker.existingClaim }}
claimName: {{ .Values.persistence.worker.existingClaim }}
{{- else }}
claimName: {{ template "erpnext.fullname" . }}
{{- end }}
readOnly: false
{{- else }}
emptyDir: {}
{{- end }}
- name: logs
{{- if .Values.persistence.logs.enabled }}
persistentVolumeClaim:
{{- if .Values.persistence.logs.existingClaim }}
claimName: {{ .Values.persistence.logs.existingClaim }}
{{- else }}
claimName: {{ template "erpnext.fullname" . }}-logs
{{- end }}
readOnly: false
{{- else }}
emptyDir: {}
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}