---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: burnout-server
  labels:
    app.kubernetes.io/name: burnout
    app.kubernetes.io/instance: burnout-server
spec:
  replicas: 1
  selector:
    matchLabels:
      app.kubernetes.io/name: burnout
      app.kubernetes.io/instance: burnout-server
  template:
    metadata:
      labels:
        app.kubernetes.io/name: burnout
        app.kubernetes.io/instance: burnout-server
        aadpodidbinding: burnout
    spec:
      containers:
        - name: server
          image: sierrasoftworks/burnout:latest
          imagePullPolicy: IfNotPresent
          resources:
            requests:
              cpu: 50m
              memory: 20Mi
            limits:
              cpu: 500m
              memory: 50Mi
          env:
            - name: ENVIRONMENT
              valueFrom:
                fieldRef:
                  fieldPath: metadata.namespace
            - name: RUST_LOG
              value: info
            - name: TABLE_STORAGE_CONNECTION_STRING
              valueFrom:
                secretKeyRef:
                  key: connection-string
                  name: burnout-secrets
          ports:
            - name: http
              containerPort: 8000
              protocol: TCP
          readinessProbe:
            httpGet:
              port: http
              path: /api/v1/health
            initialDelaySeconds: 5
            periodSeconds: 1
            failureThreshold: 30
          livenessProbe:
            httpGet:
              port: http
              path: /api/v1/health
            initialDelaySeconds: 30
            periodSeconds: 1
            failureThreshold: 3