---
kind: Template
apiVersion: v1
metadata:
  name: heketi
  labels:
    glusterfs: heketi-template
    heketi: template
  annotations:
    description: Heketi service deployment template
    tags: glusterfs,heketi
objects:
- kind: Service
  apiVersion: v1
  metadata:
    name: heketi
    labels:
      glusterfs: heketi-service
      heketi: service
    annotations:
      description: Exposes Heketi service
  spec:
    ports:
    - name: heketi
      port: 8080
      targetPort: 8080
    selector:
      heketi: pod
- kind: Route
  apiVersion: v1
  metadata:
    name: heketi
    labels:
      glusterfs: heketi-route
      heketi: route
  spec:
    to:
      kind: Service
      name: heketi
- kind: DeploymentConfig
  apiVersion: v1
  metadata:
    name: heketi
    labels:
      glusterfs: heketi-dc
      heketi: dc
    annotations:
      description: Defines how to deploy Heketi
  spec:
    replicas: 1
    selector:
      heketi: pod
    triggers:
    - type: ConfigChange
    strategy:
      type: Recreate
    template:
      metadata:
        name: heketi
        labels:
          glusterfs: heketi-pod
          heketi: pod
      spec:
        serviceAccountName: heketi-service-account
        containers:
        - name: heketi
          image: heketi/heketi:dev
          imagePullPolicy: IfNotPresent
          env:
          - name: HEKETI_USER_KEY
            value: ${HEKETI_USER_KEY}
          - name: HEKETI_ADMIN_KEY
            value: ${HEKETI_ADMIN_KEY}
          - name: HEKETI_EXECUTOR
            value: ${HEKETI_EXECUTOR}
          - name: HEKETI_FSTAB
            value: ${HEKETI_FSTAB}
          - name: HEKETI_SNAPSHOT_LIMIT
            value: '14'
          - name: HEKETI_KUBE_GLUSTER_DAEMONSET
            value: "y"
          - name: HEKETI_IGNORE_STALE_OPERATIONS
            value: "true"
          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
parameters:
- name: HEKETI_USER_KEY
  displayName: Heketi User Secret
  description: Set secret for those creating volumes as type _user_
- name: HEKETI_ADMIN_KEY
  displayName: Heketi Administrator Secret
  description: Set secret for administration of the Heketi service as user _admin_
- name: HEKETI_EXECUTOR
  displayName: heketi executor type
  description: Set the executor type, kubernetes or ssh
  value: kubernetes
- name: HEKETI_FSTAB
  displayName: heketi fstab path
  description: Set the fstab path, file that is populated with bricks that heketi creates
  value: /var/lib/heketi/fstab
- name: HEKETI_IGNORE_STALE_OPERATIONS
  displayName: Whether to ignore stale operations at startup
  description: This allows to control whether heketi should start up when there are stale pending operation entries present in the database. Setting this to true lets heketi ignore existing pending operations at startup. Setting it to false causes heketi to refuse to start if pending operations are found in the database.
