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

---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: ihub-deployment
  namespace: isecl
  labels:
    env: test
    app: ihub
spec:
  replicas: 1
  selector:
    matchLabels:
      app: ihub
  template:
    metadata:
      labels:
        app: ihub
    spec:
      securityContext:
        fsGroup: 1001
      containers:
        - name: ihub
          image: <image-name>:<image-tag>
          imagePullPolicy: Always
          securityContext:
            runAsUser: 1001
            runAsGroup: 1001
          envFrom:
            - configMapRef:
                name: ihub-config
          env:
            - name: IHUB_SERVICE_USERNAME
              valueFrom:
                secretKeyRef:
                  name: ihub-service-credentials
                  key: IHUB_SERVICE_USERNAME
            - name: IHUB_SERVICE_PASSWORD
              valueFrom:
                secretKeyRef:
                  name: ihub-service-credentials
                  key: IHUB_SERVICE_PASSWORD
          volumeMounts:
            - name: ihub-config-volume
              mountPath: /etc/ihub/
            - name: ihub-k8s-certs
              mountPath: /apiserver.crt
              subPath: apiserver.crt
            - name: ihub-logs-volume
              mountPath: /var/log/ihub/
      volumes:
        - name: ihub-k8s-certs
          secret:
            secretName: ihub-k8s-certs
            defaultMode: 0640
        - name: ihub-logs-volume
          persistentVolumeClaim:
            claimName: ihub-logs-pvc
        - name: ihub-config-volume
          persistentVolumeClaim:
            claimName: ihub-config-pvc
