Files
infra-k8/deploy/k8s/30-web.yaml
2026-11-14 14:17:10 +01:00

134 lines
3.6 KiB
YAML

apiVersion: apps/v1
kind: Deployment
metadata:
name: web
namespace: fch26-onemanarmy
labels:
app.kubernetes.io/name: web
app.kubernetes.io/component: frontend
app.kubernetes.io/part-of: pulsecast
spec:
replicas: 1
revisionHistoryLimit: 2
strategy:
type: RollingUpdate
rollingUpdate:
maxUnavailable: 0
maxSurge: 1
selector:
matchLabels:
app.kubernetes.io/name: web
template:
metadata:
labels:
app.kubernetes.io/name: web
app.kubernetes.io/component: frontend
app.kubernetes.io/part-of: pulsecast
spec:
automountServiceAccountToken: false
imagePullSecrets:
- name: gitea-regcred
securityContext:
seccompProfile:
type: RuntimeDefault
# Numeric UID: the web image must run as (or at least be readable by)
# 10001:10001. Do not rely on a named image user.
runAsUser: 10001
runAsGroup: 10001
fsGroup: 10001
containers:
- name: web
image: git.noelsabia.dev/noel/pulsecast-web:v1.3-cool
# Always makes a re-pushed image tag visible; switch to IfNotPresent once frozen.
imagePullPolicy: Always
ports:
- name: http
containerPort: 3000
protocol: TCP
envFrom:
- configMapRef:
name: web-config
- configMapRef:
name: pulsecast-shared
env:
- name: HOME
value: /tmp
# Nuxt/Nitro may use a temp dir; keep it on the writable emptyDir.
- name: NITRO_TEMP_DIR
value: /tmp
# The web server validates /control and POST /api/scenario itself
# and attaches these same credentials to Go control calls.
- name: CONTROL_USER
valueFrom:
secretKeyRef:
name: control-auth
key: CONTROL_USER
- name: CONTROL_PASS
valueFrom:
secretKeyRef:
name: control-auth
key: CONTROL_PASS
- name: CONTROL_TOKEN
valueFrom:
secretKeyRef:
name: control-auth
key: CONTROL_TOKEN
resources:
requests:
cpu: 100m
memory: 256Mi
limits:
cpu: 500m
memory: 512Mi
securityContext:
runAsNonRoot: true
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
capabilities:
drop:
- ALL
volumeMounts:
- name: tmp
mountPath: /tmp
startupProbe:
httpGet:
path: /
port: http
periodSeconds: 2
failureThreshold: 30
livenessProbe:
httpGet:
path: /
port: http
periodSeconds: 10
timeoutSeconds: 3
failureThreshold: 3
readinessProbe:
httpGet:
path: /
port: http
periodSeconds: 5
timeoutSeconds: 3
failureThreshold: 2
volumes:
- name: tmp
emptyDir: {}
---
apiVersion: v1
kind: Service
metadata:
name: web
namespace: fch26-onemanarmy
labels:
app.kubernetes.io/name: web
app.kubernetes.io/part-of: pulsecast
spec:
type: ClusterIP
selector:
app.kubernetes.io/name: web
ports:
- name: http
port: 3000
targetPort: http
protocol: TCP