- build and push v1.1 images from the service main worktrees - switch manifests to :v1.1; add web control Secret refs - configure API BOOTSTRAP_REFRESH=60s and remove unused DATA_DIR - add k6 presenter scenario with a mid-run control POST - require control credentials in make load; update runbook and drills
132 lines
3.7 KiB
YAML
132 lines
3.7 KiB
YAML
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
name: api
|
|
namespace: fch26-onemanarmy
|
|
labels:
|
|
app.kubernetes.io/name: api
|
|
app.kubernetes.io/component: backend
|
|
app.kubernetes.io/part-of: pulsecast
|
|
spec:
|
|
# Scenario state and the SSE hub live in memory. One replica is intentional.
|
|
replicas: 1
|
|
revisionHistoryLimit: 2
|
|
strategy:
|
|
type: Recreate
|
|
selector:
|
|
matchLabels:
|
|
app.kubernetes.io/name: api
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app.kubernetes.io/name: api
|
|
app.kubernetes.io/component: backend
|
|
app.kubernetes.io/part-of: pulsecast
|
|
spec:
|
|
automountServiceAccountToken: false
|
|
imagePullSecrets:
|
|
- name: gitea-regcred
|
|
securityContext:
|
|
seccompProfile:
|
|
type: RuntimeDefault
|
|
# distroless static:nonroot is UID/GID 65532. Keep it numeric so
|
|
# runAsNonRoot never depends on the image's user name.
|
|
runAsUser: 65532
|
|
runAsGroup: 65532
|
|
fsGroup: 65532
|
|
containers:
|
|
- name: api
|
|
image: git.noelsabia.dev/noel/pulsecast-api:v1.1
|
|
# v1.1 may be re-pushed during the demo run-up; Always makes a re-push visible.
|
|
# Switch back to IfNotPresent once the tag is frozen.
|
|
imagePullPolicy: Always
|
|
ports:
|
|
- name: http
|
|
containerPort: 8080
|
|
protocol: TCP
|
|
envFrom:
|
|
- configMapRef:
|
|
name: api-config
|
|
- configMapRef:
|
|
name: pulsecast-shared
|
|
env:
|
|
- name: HOME
|
|
value: /tmp
|
|
# Created by the human; see docs/deploy.md. Never commit real credentials.
|
|
- name: CONTROL_USER
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: control-auth
|
|
key: CONTROL_USER
|
|
- name: CONTROL_PASS
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: control-auth
|
|
key: CONTROL_PASS
|
|
# Forwarded as a Bearer token to FastAPI's internal /train routes.
|
|
- name: CONTROL_TOKEN
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: control-auth
|
|
key: CONTROL_TOKEN
|
|
resources:
|
|
requests:
|
|
cpu: 100m
|
|
memory: 128Mi
|
|
limits:
|
|
cpu: 500m
|
|
memory: 256Mi
|
|
securityContext:
|
|
runAsNonRoot: true
|
|
allowPrivilegeEscalation: false
|
|
readOnlyRootFilesystem: true
|
|
capabilities:
|
|
drop:
|
|
- ALL
|
|
volumeMounts:
|
|
- name: tmp
|
|
mountPath: /tmp
|
|
startupProbe:
|
|
httpGet:
|
|
path: /api/healthz
|
|
port: http
|
|
periodSeconds: 2
|
|
failureThreshold: 30
|
|
livenessProbe:
|
|
httpGet:
|
|
path: /api/healthz
|
|
port: http
|
|
periodSeconds: 10
|
|
timeoutSeconds: 3
|
|
failureThreshold: 3
|
|
readinessProbe:
|
|
httpGet:
|
|
path: /api/readyz
|
|
port: http
|
|
periodSeconds: 5
|
|
timeoutSeconds: 3
|
|
failureThreshold: 2
|
|
# SSE clients reconnect with retry: 3000; give them a moment on shutdown.
|
|
terminationGracePeriodSeconds: 20
|
|
volumes:
|
|
- name: tmp
|
|
emptyDir: {}
|
|
---
|
|
apiVersion: v1
|
|
kind: Service
|
|
metadata:
|
|
name: api
|
|
namespace: fch26-onemanarmy
|
|
labels:
|
|
app.kubernetes.io/name: api
|
|
app.kubernetes.io/part-of: pulsecast
|
|
spec:
|
|
type: ClusterIP
|
|
selector:
|
|
app.kubernetes.io/name: api
|
|
ports:
|
|
- name: http
|
|
port: 8080
|
|
targetPort: http
|
|
protocol: TCP
|