feat: harden Gate 1 manifests and runbook

- add read-only make gate1-check: permissions, guardrails, dry-run, Secret keys
- set numeric runAsUser/runAsGroup (SKE non-numeric user caveat), pin cloudflared and use HTTP/2
- align ML env with PULSECAST_* and wire CONTROL_TOKEN for API/ML training proxy
- fix service worktree paths and smoke.sh executable bit
- pin k6 v2.0.0 for xk6-sse, fix closed-connection metric and initial scenario latency
- rewrite docs/deploy.md as an exact copy-paste Gate 1 checklist
This commit is contained in:
Noel Sabia committed 2026-11-14 05:10:41 +01:00
1 parent 55dfe8b616
commit 5b199f8fe3
13 files changed
+1231 -235

No files matched your search

+10 -3
View File
@@ -27,6 +27,7 @@ data:
HOST: "0.0.0.0"
PORT: "3000"
NUXT_TELEMETRY_DISABLED: "1"
TMPDIR: "/tmp"
NUXT_PUBLIC_API_BASE: "https://api.pulse.noelsabia.dev"
NUXT_API_INTERNAL_BASE: "http://api:8080"
NUXT_PUBLIC_SSE_URL: "https://api.pulse.noelsabia.dev/api/stream"
@@ -45,7 +46,6 @@ data:
FASTAPI_URL: "http://ml:8000"
ML_TIMEOUT: "1.5s"
SSE_HEARTBEAT: "15s"
CORS_ALLOWED_ORIGINS: "https://pulse.noelsabia.dev,http://localhost:3000"
---
apiVersion: v1
kind: ConfigMap
@@ -56,8 +56,15 @@ metadata:
app.kubernetes.io/name: ml
app.kubernetes.io/part-of: pulsecast
data:
# The image CMD binds 0.0.0.0:8000; PORT documents the contract.
PORT: "8000"
DATA_DIR: "/app/data"
MODEL_PATH: "/app/model/model.joblib"
# These are the names pulsecast.config actually reads. The model and JSON
# artifacts are baked into the image; only models/uploads are writable.
PULSECAST_ROOT: "/app"
PULSECAST_ARTIFACTS: "/app/artifacts"
PULSECAST_WEATHER: "/app/artifacts"
PULSECAST_MODELS: "/tmp/pulsecast/models"
PULSECAST_UPLOADS: "/tmp/pulsecast/uploads"
TMPDIR: "/tmp"
PYTHONDONTWRITEBYTECODE: "1"
PYTHONUNBUFFERED: "1"
+13 -1
View File
@@ -28,10 +28,16 @@ spec:
securityContext:
seccompProfile:
type: RuntimeDefault
# Numeric UID is required: a non-numeric image user breaks runAsNonRoot
# (verified on SKE with curlimages/curl, 2026-11-14).
runAsUser: 10001
runAsGroup: 10001
containers:
- name: ml
image: git.noelsabia.dev/noelsabia/pulsecast-ml:gate1
imagePullPolicy: IfNotPresent
# Gate 1 reuses the `gate1` tag while iterating; Always makes a re-push visible.
# Switch to an immutable tag + IfNotPresent at deploy freeze.
imagePullPolicy: Always
ports:
- name: http
containerPort: 8000
@@ -46,6 +52,12 @@ spec:
value: /tmp
- name: MPLCONFIGDIR
value: /tmp
# Required by FastAPI /train; returns 503 when it is unset.
- name: CONTROL_TOKEN
valueFrom:
secretKeyRef:
name: control-auth
key: CONTROL_TOKEN
resources:
requests:
cpu: 200m
+13 -1
View File
@@ -29,10 +29,16 @@ spec:
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
containers:
- name: api
image: git.noelsabia.dev/noelsabia/pulsecast-api:gate1
imagePullPolicy: IfNotPresent
# Gate 1 reuses the `gate1` tag while iterating; Always makes a re-push visible.
# Switch to an immutable tag + IfNotPresent at deploy freeze.
imagePullPolicy: Always
ports:
- name: http
containerPort: 8080
@@ -56,6 +62,12 @@ spec:
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
+7 -1
View File
@@ -31,11 +31,17 @@ spec:
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
containers:
- name: web
# Replace owner/package only if your Gitea layout differs. Keep the tag in sync with `make build`.
image: git.noelsabia.dev/noelsabia/pulsecast-web:gate1
imagePullPolicy: IfNotPresent
# Gate 1 reuses the `gate1` tag while iterating; Always makes a re-push visible.
# Switch to an immutable tag + IfNotPresent at deploy freeze.
imagePullPolicy: Always
ports:
- name: http
containerPort: 3000
+9 -1
View File
@@ -31,14 +31,22 @@ spec:
securityContext:
seccompProfile:
type: RuntimeDefault
# cloudflared's image user is 65532:65532; set it numerically.
runAsUser: 65532
runAsGroup: 65532
containers:
- name: cloudflared
# Public Docker Hub image; no Gitea pull secret needed for this pod.
image: cloudflare/cloudflared:latest
# Pinned rather than :latest so a surprise upstream change cannot break Gate 1.
image: cloudflare/cloudflared:2026.11.0
imagePullPolicy: IfNotPresent
args:
- tunnel
- --no-autoupdate
# SKE smoke confirmed TCP/443 to Cloudflare but did not test
# UDP/7844 (QUIC). HTTP/2 avoids depending on untested UDP.
- --protocol
- http2
- --metrics
- 0.0.0.0:2000
- run