apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: ozone-isolated-follower
  labels:
    app: ozone
    component: isolated-follower
spec:
  selector:
    matchLabels:
      app: ozone
      component: isolated-follower
  serviceName: ozone-isolated-follower
  replicas: 3
  template:
    metadata:
      labels:
        app: ozone
        component: isolated-follower
      annotations:
        prometheus.io/scrape: "true"
        prometheus.io/port: "9882"
        prometheus.io/path: /prom
    spec:
      affinity:
        podAntiAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
          - labelSelector:
              matchExpressions:
              - key: component
                operator: In
                values:
                - isolated-follower
            topologyKey: kubernetes.io/hostname
      securityContext:
        fsGroup: 1000
      containers:
      - name: datanode
        image: elek/ozonedev:20200211-1
        args:
        - bash
        - -c
        - -x
        - "'rm -rf /data/storage/hdds && ozone datanode'"
        volumeMounts:
        - name: data
          mountPath: /data
        envFrom:
        - configMapRef:
            name: ozone-config
      - name: freon
        image: elek/ozonedev:20200211-1
        args:
         - /opt/tester/test.sh
        volumeMounts:
        - name: script
          mountPath: /opt/tester/test.sh
          subPath: test.sh
        - name: data
          mountPath: /data
        envFrom:
        - configMapRef:
            name: ozone-config
      volumes:
      - name: data
        emptyDir:
           medium: Memory
      - name: script
        configMap:
           name: ozone-testscript
           defaultMode: 0755
