apiVersion: apps/v1
kind: Deployment
metadata:
  name: declarations-api
  namespace: apps
  labels:
    app: declarations-api
    #microk8s-application: nginx-ingress-microk8s
spec:
  replicas: 1
  selector:
    matchLabels:
      app: declarations-api
  template:
    metadata:
      namespace: apps
      labels:
        app: declarations-api
    spec:
      volumes:
      - name: declarations-data
        persistentVolumeClaim:
          claimName: declarations-pvc
      containers:
        - name: declarations-api
          image: localhost:32000/declarations-api:latest
          env:
            - name: DECLARATIONS_FILE
              value: /app/declarations/declarations
            - name: STATIC_DIR
              value: /app/static
          ports:
            - name: http
              containerPort: 8080
          readinessProbe:
            httpGet:
              path: /health
              port: http
            initialDelaySeconds: 10
            timeoutSeconds: 10
            periodSeconds: 5
          livenessProbe:
            httpGet:
              path: /health
              port: http
            initialDelaySeconds: 120
            timeoutSeconds: 10
            periodSeconds: 10
          volumeMounts:
            - name: declarations-data
              mountPath: /app/declarations
