---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: bggappv1-deployment
  labels:
    name: bggappv1-deployment
    app: bggapp
    tier: backend
spec:
  replicas: 2
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxSurge: 1
      maxUnavailable: 0
  selector:
    matchLabels:
      name: bggappv1-pod
      app: bggapp
      tier: backend
  template:
    metadata:
      name: bggappv1-pod
      labels:
        name: bggappv1-pod
        app: bggapp
        tier: backend
    spec:
      containers:
      - name: bggappv1-container
        image: stackupiss/bgg-backend:v1
        args: 
        - --prefix
        - /v1
        imagePullPolicy: IfNotPresent
        ports:
        - name: app-port
          containerPort: 3000
        env:
        - name: BGG_DB_USER
          value: root
        - name: BGG_DB_HOST
          value: bggdb-svc.bggns.svc.cluster.local
        envFrom:
        - secretRef:
            name: bggdb-secret
        readinessProbe:
          httpGet:
            path: /v1/healthz
            port: app-port
          timeoutSeconds: 5
          failureThreshold: 1
        livenessProbe:
          httpGet:
            path: /v1/healthz
            port: app-port
          timeoutSeconds: 5
          failureThreshold: 3
          successThreshold: 1
        resources:
          requests:
            cpu: 100m
            memory: 128Mi
          
        