Files
feedc0de 9933f9904a
Validate, publish and deploy Gramps Web / validate (push) Failing after 29m16s
Validate, publish and deploy Gramps Web / publish (push) Skipped
Validate, publish and deploy Gramps Web / deploy (push) Skipped
Introduce helm chart and CI and CD
2026-09-06 11:26:19 +02:00

115 lines
4.3 KiB
YAML

apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "gramps-web.fullname" . }}
labels:
{{- include "gramps-web.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
app: {{ include "gramps-web.fullname" . }}
template:
metadata:
labels:
app: {{ include "gramps-web.fullname" . }}
{{- include "gramps-web.labels" . | nindent 8 }}
{{- with .Values.podLabels }}
{{- toYaml . | nindent 8 }}
{{- end }}
annotations:
checksum/app-secret: {{ include (print $.Template.BasePath "/secret.yaml") . | sha256sum }}
{{- with .Values.podAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
serviceAccountName: {{ include "gramps-web.serviceAccountName" . }}
automountServiceAccountToken: {{ .Values.serviceAccount.automountServiceAccountToken }}
{{- with .Values.image.pullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- name: gramps-web
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
env:
{{- include "gramps-web.env" . | nindent 12 }}
ports:
- name: http
containerPort: 5000
protocol: TCP
{{- if .Values.livenessProbe.enabled }}
livenessProbe:
{{- omit .Values.livenessProbe "enabled" | toYaml | nindent 12 }}
{{- end }}
{{- if .Values.readinessProbe.enabled }}
readinessProbe:
{{- if .Values.readinessProbe.deep }}
exec:
command:
- python3
- -c
- |
import os
import urllib.request
import psycopg2
import redis
with urllib.request.urlopen("http://127.0.0.1:5000/ready", timeout=3) as response:
assert response.status == 200
if os.environ["PROBE_POSTGRES_ENABLED"] == "true":
connection = psycopg2.connect(
host=os.environ["GRAMPSWEB_POSTGRES_HOST"],
port=os.environ["GRAMPSWEB_POSTGRES_PORT"],
user=os.environ["GRAMPSWEB_POSTGRES_USER"],
password=os.environ["GRAMPSWEB_POSTGRES_PASSWORD"],
dbname=os.environ["PROBE_POSTGRES_DATABASE"],
connect_timeout=3,
)
with connection.cursor() as cursor:
cursor.execute("SELECT 1")
assert cursor.fetchone() == (1,)
connection.close()
assert redis.Redis.from_url(
os.environ["GRAMPSWEB_RATELIMIT_STORAGE_URI"],
socket_connect_timeout=3,
socket_timeout=3,
).ping()
{{- end }}
{{- omit .Values.readinessProbe "enabled" "deep" | toYaml | nindent 12 }}
{{- end }}
{{- if .Values.startupProbe.enabled }}
startupProbe:
{{- omit .Values.startupProbe "enabled" | toYaml | nindent 12 }}
{{- end }}
resources:
{{- toYaml .Values.resources | nindent 12 }}
volumeMounts:
{{- include "gramps-web.volumeMounts" . | nindent 12 }}
volumes:
- name: data
{{- if .Values.persistence.enabled }}
persistentVolumeClaim:
claimName: {{ default (printf "%s-data" (include "gramps-web.fullname" .)) .Values.persistence.existingClaim }}
{{- else }}
emptyDir: {}
{{- end }}
- name: tmp
emptyDir: {}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}