# TOP Dev / VKS — disposable, stateless HTTP demonstration.
# Apply only to an allocated workload cluster namespace coffee-demo.
# The namespace is created and governed separately by the platform team.
# Image digest resolved from stable-alpine on 2026-10-26; review before reuse.
apiVersion: v1
kind: ConfigMap
metadata:
  name: coffee-config
  namespace: coffee-demo
data:
  nginx.conf: |
    worker_processes 1;
    pid /tmp/nginx.pid;
    error_log /dev/stderr notice;
    events { worker_connections 128; }
    http {
      access_log /dev/stdout;
      client_body_temp_path /tmp/client_temp;
      proxy_temp_path /tmp/proxy_temp;
      fastcgi_temp_path /tmp/fastcgi_temp;
      uwsgi_temp_path /tmp/uwsgi_temp;
      scgi_temp_path /tmp/scgi_temp;
      server {
        listen 8080;
        location = /live { return 200 'alive\n'; }
        location = /ready { return 200 'ready\n'; }
        location = /menu {
          default_type application/json;
          return 200 '{"release":"v1","items":[{"sku":"coffee-beans","stock":0},{"sku":"filters","stock":24}]}\n';
        }
        location / { return 404; }
      }
    }
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: coffee
  namespace: coffee-demo
spec:
  replicas: 2
  selector:
    matchLabels: { app: coffee }
  template:
    metadata:
      labels: { app: coffee }
    spec:
      automountServiceAccountToken: false
      securityContext:
        runAsNonRoot: true
        runAsUser: 101
        runAsGroup: 101
        fsGroup: 101
        seccompProfile: { type: RuntimeDefault }
      containers:
        - name: http
          image: nginxinc/nginx-unprivileged@sha256:f5116ed4606f3eb015dd4a8e28cb9b351476dc0ad4bc6e9f93b19cec130cdf03
          command: [nginx]
          args: [-g, 'daemon off;']
          ports:
            - { name: http, containerPort: 8080 }
          resources:
            requests: { cpu: 100m, memory: 32Mi }
            limits: { cpu: 250m, memory: 64Mi }
          securityContext:
            allowPrivilegeEscalation: false
            readOnlyRootFilesystem: true
            capabilities: { drop: [ALL] }
          startupProbe:
            httpGet: { path: /live, port: http }
            periodSeconds: 2
            failureThreshold: 15
          readinessProbe:
            httpGet: { path: /ready, port: http }
            periodSeconds: 5
          livenessProbe:
            httpGet: { path: /live, port: http }
            periodSeconds: 10
          volumeMounts:
            - { name: config, mountPath: /etc/nginx/nginx.conf, subPath: nginx.conf, readOnly: true }
            - { name: temporary, mountPath: /tmp }
      volumes:
        - name: config
          configMap: { name: coffee-config }
        - name: temporary
          emptyDir: { sizeLimit: 32Mi }
---
apiVersion: v1
kind: Service
metadata:
  name: coffee
  namespace: coffee-demo
spec:
  selector: { app: coffee }
  ports:
    - { name: http, port: 80, targetPort: http }
