apiVersion: apps/v1
kind: Deployment
metadata:
  name: cuppa-web
  namespace: cuppa
  labels:
    app: cuppa-web
spec:
  replicas: 3
  selector:
    matchLabels:
      app: cuppa-web
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxSurge: 25%
      maxUnavailable: 0
  template:
    metadata:
      labels:
        app: cuppa-web
    spec:
      nodeSelector:
        role: web
      containers:
        - name: web
          image: ${WEB_IMAGE}
          imagePullPolicy: Always
          ports:
            - containerPort: 3000
              name: http
          envFrom:
            - configMapRef:
                name: cuppa-config
            - secretRef:
                name: cuppa-secrets
          resources:
            requests:
              cpu: 250m
              memory: 512Mi
            limits:
              cpu: "1"
              memory: 1Gi
          livenessProbe:
            httpGet:
              path: /api/live
              port: 3000
            initialDelaySeconds: 15
            periodSeconds: 15
          readinessProbe:
            httpGet:
              path: /api/ready
              port: 3000
            initialDelaySeconds: 10
            periodSeconds: 10
          startupProbe:
            httpGet:
              path: /api/live
              port: 3000
            failureThreshold: 30
            periodSeconds: 5
