gcp-hockey-results/motm_app/helm-chart/motm-app/templates/deployment.yaml

165 lines
6.0 KiB
YAML

apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "motm-app.fullname" . }}
labels:
{{- include "motm-app.labels" . | nindent 4 }}
spec:
{{- if not .Values.autoscaling.enabled }}
replicas: {{ .Values.replicaCount | default 1 }}
{{- end }}
selector:
matchLabels:
{{- include "motm-app.selectorLabels" . | nindent 6 }}
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "motm-app.selectorLabels" . | nindent 8 }}
{{- with .Values.podLabels }}
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "motm-app.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- name: {{ .Chart.Name }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- name: http
containerPort: 5000
protocol: TCP
env:
# Application environment variables
{{- range $key, $value := .Values.env }}
- name: {{ $key }}
value: {{ $value | quote }}
{{- end }}
# Database configuration
- name: DB_HOST
value: {{ .Values.database.host | quote }}
- name: DB_PORT
value: {{ .Values.database.port | quote }}
- name: DB_NAME
value: {{ .Values.database.name | quote }}
- name: DB_USER
value: {{ .Values.database.username | quote }}
- name: DB_PASSWORD
valueFrom:
secretKeyRef:
{{- if .Values.secrets.useExternalSecret }}
name: {{ .Values.secrets.externalSecretName | quote }}
{{- else }}
name: {{ include "motm-app.fullname" . }}-secrets
{{- end }}
key: {{ .Values.secrets.dbPasswordKey }}
# S3/MinIO configuration
{{- if .Values.s3.enabled }}
- name: S3_ENABLED
value: "true"
- name: S3_STORAGE_PROVIDER
value: {{ .Values.s3.storageProvider | quote }}
- name: S3_ENDPOINT
value: {{ .Values.s3.endpoint | quote }}
- name: S3_REGION
value: {{ .Values.s3.region | quote }}
- name: S3_BUCKET
value: {{ .Values.s3.bucket | quote }}
- name: S3_BUCKET_PREFIX
value: {{ .Values.s3.bucketPrefix | quote }}
- name: S3_USE_SIGNED_URLS
value: {{ .Values.s3.useSignedUrls | quote }}
- name: S3_SIGNED_URL_EXPIRY
value: {{ .Values.s3.signedUrlExpiry | quote }}
- name: S3_FALLBACK_TO_STATIC
value: {{ .Values.s3.fallbackToStatic | quote }}
- name: S3_USE_SSL
value: {{ .Values.s3.useSSL | quote }}
- name: S3_ACCESS_KEY_ID
valueFrom:
secretKeyRef:
{{- if .Values.secrets.useExternalSecret }}
name: {{ .Values.secrets.externalSecretName | quote }}
{{- else }}
name: {{ include "motm-app.fullname" . }}-secrets
{{- end }}
key: {{ .Values.secrets.s3AccessKeyKey }}
- name: S3_SECRET_ACCESS_KEY
valueFrom:
secretKeyRef:
{{- if .Values.secrets.useExternalSecret }}
name: {{ .Values.secrets.externalSecretName | quote }}
{{- else }}
name: {{ include "motm-app.fullname" . }}-secrets
{{- end }}
key: {{ .Values.secrets.s3SecretKeyKey }}
{{- else }}
- name: S3_ENABLED
value: "false"
{{- end }}
livenessProbe:
httpGet:
path: {{ .Values.healthCheck.path }}
port: http
initialDelaySeconds: {{ .Values.healthCheck.initialDelaySeconds }}
periodSeconds: {{ .Values.healthCheck.periodSeconds }}
timeoutSeconds: {{ .Values.healthCheck.timeoutSeconds }}
failureThreshold: {{ .Values.healthCheck.failureThreshold }}
readinessProbe:
httpGet:
path: {{ .Values.healthCheck.path }}
port: http
initialDelaySeconds: 5
periodSeconds: 5
timeoutSeconds: 3
failureThreshold: 3
resources:
{{- toYaml .Values.resources | nindent 12 }}
volumeMounts:
- name: config-volume
mountPath: /app/database_config.ini
subPath: database_config.ini
- name: s3-config-volume
mountPath: /app/s3_config.json
subPath: s3_config.json
{{- if .Values.persistence.enabled }}
- name: data-volume
mountPath: /app/data
{{- end }}
volumes:
- name: config-volume
configMap:
name: {{ include "motm-app.fullname" . }}-config
- name: s3-config-volume
configMap:
name: {{ include "motm-app.fullname" . }}-s3-config
{{- if .Values.persistence.enabled }}
- name: data-volume
persistentVolumeClaim:
claimName: {{ include "motm-app.fullname" . }}-pvc
{{- 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 }}