#  Copyright (C) 2021 Intel Corporation
#  SPDX-License-Identifier: BSD-3-Clause

---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: aas-deployment
  namespace: isecl
  labels:
    env: demo
    app: aas
spec:
  replicas: 1
  selector:
    matchLabels:
      app: aas
  template:
    metadata:
      labels:
        app: aas
    spec:
      securityContext:
        fsGroup: 1001
      containers:
        - image: <image-name>:<image-tag>
          name: aas
          imagePullPolicy: Always
          securityContext:
            runAsUser: 1001
            runAsGroup: 1001
          envFrom:
            - configMapRef:
                name: aas-config
          ports:
            - containerPort: 8444
          volumeMounts:
            - name: aas-config-volume
              mountPath: /etc/authservice/
            - name: aas-logs-volume
              mountPath: /var/log/authservice/
            - name: aas-db-certs
              mountPath: /etc/postgresql/
            - mountPath: /etc/secrets/
              name: aas-secrets
              readOnly: true
      volumes:
        - name: aas-config-volume
          persistentVolumeClaim:
            claimName: aas-config-pvc
        - name: aas-logs-volume
          persistentVolumeClaim:
            claimName: aas-logs-pvc
        - name: aas-db-certs
          secret:
            secretName: aas-db-certs
            defaultMode: 0640
        - name: aas-secrets
          projected:
            sources:
              - secret:
                  name: aas-credentials
              - secret:
                  name: aas-bootstrap-token