titan-iac/services/veles/backend-deployment.yaml
2026-07-22 09:14:13 -03:00

140 lines
4.5 KiB
YAML

# services/veles/backend-deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: veles-backend
namespace: veles
labels:
app: veles-backend
spec:
replicas: 1
revisionHistoryLimit: 2
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 0
maxUnavailable: 1
selector:
matchLabels:
app: veles-backend
template:
metadata:
labels:
app: veles-backend
annotations:
veles.bstein.dev/redeploy: "2026-07-22-0.7.49-life-payment-fallback"
vault.hashicorp.com/agent-inject: "true"
vault.hashicorp.com/agent-init-first: "true"
vault.hashicorp.com/agent-pre-populate-only: "true"
vault.hashicorp.com/role: "veles"
vault.hashicorp.com/agent-inject-secret-veles-env.sh: "kv/data/atlas/veles/veles-db"
vault.hashicorp.com/agent-inject-template-veles-env.sh: |
{{- with secret "kv/data/atlas/veles/veles-db" }}
unset DATABASE_URL
export VELES_DATABASE_HOST="{{ .Data.data.POSTGRES_HOST }}"
export VELES_DATABASE_PORT="{{ .Data.data.POSTGRES_PORT }}"
export VELES_DATABASE_NAME="{{ .Data.data.POSTGRES_DB }}"
export VELES_DATABASE_USER="{{ .Data.data.POSTGRES_USER }}"
export VELES_DATABASE_PASSWORD="{{ .Data.data.POSTGRES_PASSWORD }}"
export VELES_DATABASE_SSLMODE="disable"
{{- end }}
{{- with secret "kv/data/atlas/veles/veles-oidc" }}
export VELES_OIDC_CLIENT_SECRET="{{ .Data.data.client_secret }}"
{{- end }}
{{- with secret "kv/data/atlas/veles/app-secrets" }}
export VELES_SESSION_SECRET="{{ .Data.data.VELES_SESSION_SECRET }}"
export VELES_BYOK_ENCRYPTION_KEY="{{ .Data.data.VELES_BYOK_ENCRYPTION_KEY }}"
{{- end }}
spec:
serviceAccountName: veles-backend
priorityClassName: veles-core
nodeSelector:
veles.bstein.dev/node-pool: oceanus
kubernetes.io/arch: amd64
tolerations:
- key: veles.bstein.dev/simulation
operator: Equal
value: "true"
effect: NoSchedule
securityContext:
fsGroup: 10001
fsGroupChangePolicy: OnRootMismatch
seccompProfile:
type: RuntimeDefault
initContainers:
- name: database-init
image: registry.bstein.dev/veles/veles-backend:0.7.49 # {"$imagepolicy": "veles:veles-backend"}
imagePullPolicy: Always
command: ["/bin/sh", "-c"]
args:
- |
set -eu
if [ -f /vault/secrets/veles-env.sh ]; then
. /vault/secrets/veles-env.sh
fi
exec veles-db --init --wait-seconds 120
envFrom:
- configMapRef:
name: veles-config
resources:
requests:
cpu: 50m
memory: 128Mi
limits:
cpu: 250m
memory: 512Mi
containers:
- name: backend
image: registry.bstein.dev/veles/veles-backend:0.7.49 # {"$imagepolicy": "veles:veles-backend"}
imagePullPolicy: Always
command: ["/bin/sh", "-c"]
args:
- |
set -eu
if [ -f /vault/secrets/veles-env.sh ]; then
. /vault/secrets/veles-env.sh
fi
exec veles-web --host 0.0.0.0 --port 8796 --no-resume-queued
ports:
- name: http
containerPort: 8796
protocol: TCP
envFrom:
- configMapRef:
name: veles-config
readinessProbe:
httpGet:
path: /api/v1/ready
port: http
initialDelaySeconds: 5
periodSeconds: 10
timeoutSeconds: 3
livenessProbe:
httpGet:
path: /api/v1/live
port: http
initialDelaySeconds: 20
periodSeconds: 20
timeoutSeconds: 3
resources:
requests:
cpu: 250m
memory: 2Gi
limits:
cpu: "1"
memory: 8Gi
securityContext:
runAsNonRoot: true
runAsUser: 10001
runAsGroup: 10001
allowPrivilegeEscalation: false
capabilities:
drop: ["ALL"]
volumeMounts:
- name: artifacts
mountPath: /data/veles-artifacts
volumes:
- name: artifacts
persistentVolumeClaim:
claimName: veles-artifacts