cloud/Gargantua/helm/templates/deployment.yaml
2024-10-14 09:51:55 +03:00

146 lines
5.9 KiB
YAML

apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "gargantua.fullname" . }}
labels:
{{- include "gargantua.labels" . | nindent 4 }}
spec:
{{- if not .Values.autoscaling.enabled }}
replicas: {{.Values.replicaCount }}
{{- end }}
selector:
matchLabels:
{{- include "gargantua.selectorLabels" . | nindent 6 }}
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "gargantua.labels" . | nindent 8 }}
{{- with .Values.podLabels }}
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "gargantua.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
{{/* TODO: initContainer to wait for the database to be available */}}
containers:
- name: {{.Chart.Name }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{.Values.image.repository }}:{{.Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{.Values.image.pullPolicy }}
env:
- name: SIATEL_JDBC_URL
{{- if .Values.database.jdbcUrl }}
value: "{{ .Values.database.jdbcUrl }}"
{{- else if eq .Values.database.type "postgresql" }}
value: "jdbc:postgresql://{{ .Release.Name }}-database.{{ .Release.Namespace }}.svc.cluster.local:5432/siatel"
{{- end }}
- name: SIATEL_JDBC_PASS
value: "{{ .Values.database.password.clearText }}" {{/* TODO manage secret */}}
- name: SIATEL_PLUGINS
value: "{{ join "," .Values.plugins }}"
ports:
- name: http
containerPort: {{ .Values.service.port }}
protocol: TCP
livenessProbe:
{{- toYaml .Values.livenessProbe | nindent 12 }}
readinessProbe:
{{- toYaml .Values.readinessProbe | nindent 12 }}
resources:
{{- toYaml .Values.resources | nindent 12 }}
volumeMounts:
- mountPath: /srv/siatel/home
name: {{ .Release.Name }}-home-pv
- mountPath: /srv/siatel/storage
name: {{ .Release.Name }}-storage-pv
- mountPath: /license
name: licence
{{- with .Values.volumeMounts }}
{{- toYaml . | nindent 12 }}
{{- end }}
{{- if .Values.start }}
{{- toYaml .Values.start | nindent 10 }}
{{- end }}
volumes:
- name: {{ .Release.Name }}-home-pv
{{- if and .Values.persistence.home.storageClass .Values.persistence.home.size }}
persistentVolumeClaim:
claimName: {{ .Release.Name }}-home-pvc
{{- else if .Values.persistence.home.existingClaim }}
persistentVolumeClaim:
claimName: {{ .Values.persistence.home.existingClaim }}
{{- else if .Values.persistence.home.hostPath }}
hostPath:
path: {{ .Values.persistence.home.hostPath }}
type: 'DirectoryOrCreate'
{{- else if .Values.profile }}
hostPath:
type: 'DirectoryOrCreate'
{{- if eq .Values.profile "localDev" }}
path: {{ .Values.localDev.volumesRoot }}/{{ .Release.Namespace }}/{{ .Release.Name }}/home
{{- else if eq .Values.profile "siatelRo" }}
path: {{ .Values.siatelRo.volumesRoot }}/{{ .Release.Namespace }}/{{ .Release.Name }}/home
{{- else if eq .Values.profile "siatelCom" }}
path: {{ .Values.siatelCom.volumesRoot }}/{{ .Release.Namespace }}/{{ .Release.Name }}/home
{{- end }}
{{- end }}
- name: {{ .Release.Name }}-storage-pv
{{- if and .Values.persistence.storage.storageClass .Values.persistence.storage.size }}
persistentVolumeClaim:
claimName: {{ .Release.Name }}-storage-pvc
{{- else if .Values.persistence.storage.existingClaim }}
persistentVolumeClaim:
claimName: {{ .Values.persistence.storage.existingClaim }}
{{- else if .Values.persistence.storage.hostPath }}
hostPath:
path: {{ .Values.persistence.storage.hostPath }}
type: 'DirectoryOrCreate'
{{- else if .Values.profile }}
hostPath:
type: 'DirectoryOrCreate'
{{- if eq .Values.profile "localDev" }}
path: {{ .Values.localDev.volumesRoot }}/{{ .Release.Namespace }}/{{ .Release.Name }}/storage
{{- else if eq .Values.profile "siatelRo" }}
path: {{ .Values.siatelRo.volumesRoot }}/{{ .Release.Namespace }}/{{ .Release.Name }}/storage
{{- else if eq .Values.profile "siatelCom" }}
path: {{ .Values.siatelCom.volumesRoot }}/{{ .Release.Namespace }}/{{ .Release.Name }}/storage
{{- end }}
{{- end }}
- name: licence
{{- if .Values.license.secretName }}
secret:
secretName: {{ .Values.license.secretName }}
{{- else if .Values.license.existingClaim }}
persistentVolumeClaim:
claimName: {{ .Values.license.existingClaim }}
{{- else if .Values.license.hostPath }}
hostPath:
path: {{ .Values.license.hostPath }}
type: 'Directory'
{{- end }}
{{- with .Values.volumes }}
{{- toYaml . | nindent 8 }}
{{- 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 }}