apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: diago
  labels:
    app.kubernetes.io/name: diago
    app.kubernetes.io/part-of: diago
    app.kubernetes.io/component: leader
spec:
  replicas: 1
  serviceName: diago
  selector:
    matchLabels:
      app.kubernetes.io/name: diago
  template:
    metadata:
      labels:
        app.kubernetes.io/name: diago
        app.kubernetes.io/part-of: diago
        app.kubernetes.io/component: leader
    spec:
      serviceAccountName: diago-sa
      containers:
      - name: leader
        image: tbfame/diago:latest
        volumeMounts:
        - name: diago-storage
          mountPath: "/storage"
        env:
        - name: "DIAGO_HOST"
          valueFrom:
              fieldRef:
                fieldPath: status.podIP
        - name: "DIAGO_DEFAULT_NAMESPACE"
          value: "diago"
        - name: "DIAGO_STORAGE_PATH"
          value: "/storage/diago.db"
        envFrom:
        - configMapRef:
            name: diago-cm
        - secretRef:
            name: diago-secret
      volumes:
        - name: diago-storage
          persistentVolumeClaim:
            claimName: diago-pvc
      terminationGracePeriodSeconds: 0
