apiVersion: apps/v1
kind: Deployment
metadata:
  name: portabase
spec:
  replicas: 1
  selector:
    matchLabels:
      app: portabase
  template:
    metadata:
      labels:
        app: portabase
    spec:
      containers:
        - name: portabase
          image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
          ports:
            - containerPort: 80
          env:
            - name: TZ
              value: {{ .Values.timezone }}
            - name: PROJECT_URL
              value: {{ .Values.project.url }}
            - name: PROJECT_SECRET
              value: {{ .Values.project.secret }}
            - name: TUSD_BEHIND_PROXY
              value: {{ .Values.project.behindProxy | quote }}
          volumeMounts:
            - name: data
              mountPath: /data
          startupProbe:
            httpGet:
              path: /api/health
              port: 80
            initialDelaySeconds: 10
            periodSeconds: 10
            failureThreshold: 12
            timeoutSeconds: 5
          livenessProbe:
            httpGet:
              path: /api/health
              port: 80
            initialDelaySeconds: 0
            periodSeconds: 30
            timeoutSeconds: 5
            failureThreshold: 3
          readinessProbe:
            httpGet:
              path: /api/health
              port: 80
            initialDelaySeconds: 0
            periodSeconds: 10
            timeoutSeconds: 5
            failureThreshold: 3
      volumes:
        - name: data
          persistentVolumeClaim:
            claimName: portabase-data