# Rubis Web — nginx + SPA static + reverse proxy /api/* → rubis-api ClusterIP.
# Seul service exposé via Traefik (NodePort 30110 → app.rubis.pro).
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: rubis-web
  namespace: rubis
spec:
  replicas: 1
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxSurge: 1
      maxUnavailable: 0
  selector:
    matchLabels:
      app: rubis-web
  template:
    metadata:
      labels:
        app: rubis-web
    spec:
      imagePullSecrets:
        - name: gitea-registry
      containers:
        - name: web
          image: git.arthurbarre.fr/ordinarthur/rubis-web:latest
          imagePullPolicy: Always
          ports:
            - containerPort: 80
              name: http
          resources:
            requests:
              cpu: 50m
              memory: 32Mi
            limits:
              cpu: 200m
              memory: 128Mi
          livenessProbe:
            httpGet: { path: /index.html, port: http }
            periodSeconds: 30
            timeoutSeconds: 3
            failureThreshold: 3
          readinessProbe:
            httpGet: { path: /index.html, port: http }
            periodSeconds: 10
            timeoutSeconds: 2
            failureThreshold: 3
---
# NodePort 30110 — exposé par Traefik sur la gateway VM (cf.
# ansible/roles/traefik/templates/rubis-app.yml.j2).
apiVersion: v1
kind: Service
metadata:
  name: rubis-web
  namespace: rubis
spec:
  type: NodePort
  selector:
    app: rubis-web
  ports:
    - port: 80
      targetPort: http
      nodePort: 30110
      name: http
