titan-iac/services/health/endurain-deployment.yaml

148 lines
4.1 KiB
YAML

# services/health/endurain-deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: endurain
namespace: health
labels:
app: endurain
spec:
replicas: 1
selector:
matchLabels:
app: endurain
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 0
maxUnavailable: 1
template:
metadata:
labels:
app: endurain
spec:
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: hardware
operator: In
values: ["rpi5", "rpi4"]
- key: node-role.kubernetes.io/worker
operator: Exists
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 90
preference:
matchExpressions:
- key: hardware
operator: In
values: ["rpi5"]
- weight: 70
preference:
matchExpressions:
- key: hardware
operator: In
values: ["rpi4"]
securityContext:
runAsUser: 1000
runAsGroup: 1000
fsGroup: 1000
fsGroupChangePolicy: OnRootMismatch
initContainers:
- name: init-data
image: alpine:3.20
command: ["/bin/sh", "-c"]
args:
- |
set -e
mkdir -p /data
chown -R 1000:1000 /data
securityContext:
runAsUser: 0
runAsGroup: 0
volumeMounts:
- name: endurain-data
mountPath: /data
containers:
- name: endurain
image: ghcr.io/endurain-project/endurain:v0.16.6
imagePullPolicy: IfNotPresent
ports:
- name: http
containerPort: 8080
env:
- name: ENDURAIN_HOST
value: https://endurain.bstein.dev
- name: BEHIND_PROXY
value: "true"
- name: LOG_LEVEL
value: info
- name: TZ
value: Etc/UTC
- name: DB_HOST
valueFrom:
secretKeyRef:
name: endurain-db
key: DB_HOST
- name: DB_PORT
valueFrom:
secretKeyRef:
name: endurain-db
key: DB_PORT
- name: DB_USER
valueFrom:
secretKeyRef:
name: endurain-db
key: DB_USER
- name: DB_PASSWORD
valueFrom:
secretKeyRef:
name: endurain-db
key: DB_PASSWORD
- name: DB_DATABASE
valueFrom:
secretKeyRef:
name: endurain-db
key: DB_DATABASE
- name: SECRET_KEY
valueFrom:
secretKeyRef:
name: endurain-secrets
key: SECRET_KEY
- name: FERNET_KEY
valueFrom:
secretKeyRef:
name: endurain-secrets
key: FERNET_KEY
volumeMounts:
- name: endurain-data
mountPath: /app/backend/data
readinessProbe:
httpGet:
path: /api/v1/about
port: http
initialDelaySeconds: 15
periodSeconds: 10
timeoutSeconds: 3
failureThreshold: 6
livenessProbe:
httpGet:
path: /api/v1/about
port: http
initialDelaySeconds: 30
periodSeconds: 20
timeoutSeconds: 3
failureThreshold: 6
resources:
requests:
cpu: 200m
memory: 512Mi
limits:
cpu: "1"
memory: 2Gi
volumes:
- name: endurain-data
persistentVolumeClaim:
claimName: endurain-data