apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: druid-middlemanager
  namespace: druid
  labels:
    component: middlemanager
spec:
  serviceName: druid-middlemanager
  replicas: 8
  selector:
    matchLabels:
      component: middlemanager
  template:
    metadata:
      labels:
        component: middlemanager
      annotations:
        prometheus.io/scrape: "true"
        prometheus.io/port: "8000"
    spec:
      containers:
      - name: druid
        command:
          - /bin/bash
          - -c
          - ip=$(awk 'END{print $1}' /etc/hosts) && sed -ri 's/druid.host=.*/druid.host='${ip}'/g' /druid/conf/middleManager/runtime.properties && bin/run-druid middleManager /druid/conf
        image: gcr.io/zenatix-data-archiver/kube-druid:0.0.1
        imagePullPolicy: IfNotPresent
        ports:
        - containerPort: 8091
          name: http
        - containerPort: 8100
          name: peon-0
        - containerPort: 8101
          name: peon-1
        - containerPort: 8102
          name: peon-2
        - containerPort: 8103
          name: peon-3
        - containerPort: 8104
          name: peon-4
        - containerPort: 8105
          name: peon-5
        - containerPort: 8106
          name: peon-6
        - containerPort: 8107
          name: peon-7
        - containerPort: 8108
          name: peon-8
        - containerPort: 8109
          name: peon-9
        - containerPort: 8110
          name: peon-10
        - containerPort: 8111
          name: peon-11
        - containerPort: 8112
          name: peon-12
        - containerPort: 8113
          name: peon-13
        - containerPort: 8114
          name: peon-14
        - containerPort: 8115
          name: peon-15
        - containerPort: 8116
          name: peon-16
        - containerPort: 8117
          name: peon-17
        - containerPort: 8118
          name: peon-18
        - containerPort: 8119
          name: peon-19
        - containerPort: 8120
          name: peon-20
        volumeMounts:
        - mountPath: /var/druid/
          name: data
#        livenessProbe:
#          initialDelaySeconds: 60
#          httpGet:
#            path: /status/health
#            port: 8091
#        readinessProbe:
#          initialDelaySeconds: 30
#          httpGet:
#            path: /status/health
#            port: 8091
      - name: druid-exporter
        image: deepaksood619/druid-exporter:0.0.2
        imagePullPolicy: IfNotPresent
        ports:
          - name: http
            containerPort: 8000
            protocol: TCP
      volumes:
      - name: data
        persistentVolumeClaim:
          claimName: "druid-pvc"