---

# This file is part of the k8s-gluster-heketi-ansible project,
# an ansible collection to install glusterfs and heketi into
# kubernetes to provide dynamic persistent volumes.
#
# (c) 2020 Andreas Florath, Deutsche Telekom AG
#
# By default all files of this project are licensed under the Apache-2.0
# license. For details see the file 'LICENSE' in the top directory.
# https://opensource.org/licenses/Apache-2.0
#
# SPDX-License-Identifier: Apache-2.0

kind: Deployment
apiVersion: apps/v1
metadata:
  name: heketi
  namespace: "{{ heketi_namespace }}"
  labels:
    glusterfs: heketi-deployment
    heketi: deployment
  annotations:
    description: Defines how to deploy Heketi
spec:
  replicas: 1
  selector:
    matchLabels:
      name: heketi
  template:
    metadata:
      name: heketi
      labels:
        name: heketi
        glusterfs: heketi-pod
    spec:
      serviceAccountName: heketi-service-account
      containers:
      - image: heketi/heketi:dev
        imagePullPolicy: IfNotPresent
        name: heketi
        env:
          - name: HEKETI_EXECUTOR
            value: "{{ heketi_executor }}"
          - name: HEKETI_KUBE_NAMESPACE
            value: "{{ heketi_namespace }}"
          - name: HEKETI_FSTAB
            value: /var/lib/heketi/fstab
          - name: HEKETI_SNAPSHOT_LIMIT
            value: "14"
          - name: HEKETI_KUBE_GLUSTER_DAEMONSET
            value: "n"
          - name: HEKETI_USER_KEY
            value: "{{ heketi_user_key }}"
          - name: HEKETI_ADMIN_KEY
            value: "{{ heketi_admin_key }}"
        ports:
          - containerPort: 8080
        volumeMounts:
          - name: db
            mountPath: "/var/lib/heketi"
          - name: config
            mountPath: /etc/heketi
        readinessProbe:
          timeoutSeconds: 3
          initialDelaySeconds: 3
          httpGet:
            path: /hello
            port: 8080
        livenessProbe:
          timeoutSeconds: 3
          initialDelaySeconds: 30
          httpGet:
            path: /hello
            port: 8080
      volumes:
        - name: db
          glusterfs:
            endpoints: heketi-storage-endpoints
            path: heketidbstorage
        - name: config
          secret:
            secretName: heketi-config-secret
