Hangar/chart/templates/deployment-backend.yaml
2023-04-21 16:00:45 +02:00

95 lines
3.2 KiB
YAML

apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "hangar.fullname" . }}-backend
labels:
{{- include "hangar.labels" . | nindent 4 }}
spec:
{{- if not .Values.backend.autoscaling.enabled }}
replicas: {{ .Values.backend.replicaCount }}
{{- end }}
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 1
maxUnavailable: 1
selector:
matchLabels:
{{- include "hangar.selectorLabels" . | nindent 6 }}
app.kubernetes.io/component: "backend"
template:
metadata:
annotations:
checksum/config: {{ include (print $.Template.BasePath "/secret-hangar-backend.yaml") . | sha256sum }}
{{- with .Values.backend.podAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "hangar.selectorLabels" . | nindent 8 }}
app.kubernetes.io/component: "backend"
app.kubernetes.io/jgroups: "true"
spec:
{{- with .Values.backend.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "hangar.backend.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.backend.podSecurityContext | nindent 8 }}
volumes:
- name: {{ include "hangar.fullname" . }}-backend-config-volume
secret:
secretName: {{ include "hangar.fullname" . }}-backend
containers:
- name: {{ .Chart.Name }}
securityContext:
{{- toYaml .Values.backend.securityContext | nindent 12 }}
image: "{{ .Values.backend.image.repository }}:{{ .Values.backend.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.backend.image.pullPolicy }}
ports:
- name: http
containerPort: 8080
protocol: TCP
- name: management
containerPort: 8081
protocol: TCP
env:
- name: spring.config.location
value: "classpath:/application.yml,/hangar/config/application.yaml"
- name: KUBERNETES_NAMESPACE
value: {{ .Values.base.namespace }}
- name: JSON_LOGS_ENABLED
value: "true"
volumeMounts:
- name: {{ include "hangar.fullname" . }}-backend-config-volume
mountPath: /hangar/config
readOnly: true
livenessProbe:
httpGet:
path: /actuator/health/liveness
port: management
initialDelaySeconds: 60
periodSeconds: 10
failureThreshold: 6
readinessProbe:
httpGet:
path: /actuator/health/readiness
port: management
initialDelaySeconds: 30
periodSeconds: 10
failureThreshold: 6
resources:
{{- toYaml .Values.backend.resources | nindent 12 }}
{{- with .Values.backend.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.backend.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.backend.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}