---
apiVersion: v1
kind: ReplicationController
metadata:
  name: es-client
  labels:
    service: elasticsearch
    role: client
spec:
  replicas: 2
  selector:
    service: elasticsearch
    role: client
  template:
    metadata:
      labels:
        service: elasticsearch
        role: client
    spec:
      containers:
        - name: elasticsearch
          image: quay.io/ukhomeofficedigital/elasticsearch:6.8.1-1
          imagePullPolicy: Always
          resources:
            limits:
              memory: "1000Mi"
          env:
            - name: ES_HEAP_SIZE
              value: "400m"
            - name: CLUSTER_NAME
              value: "elasticsearch"
            - name: NODE_MASTER
              value: "false"
            - name: NODE_DATA
              value: "false"
            - name: ES_INDEX_AUTO_EXPAND_REPLICAS
              value: "1-3"
            - name: KUBERNETES_TRUST_CERTIFICATES
              value: "true"
            - name: KUBERNETES_AUTH_TOKEN
              value: "99733c37-cbd8-4b03-a97b-5a2137c2f5bf"
            - name: KUBERNETES_SERVICE
              value: "elasticsearch-master"
            - name: KUBERNETES_NAMESPACE
              valueFrom:
                fieldRef:
                  fieldPath: metadata.namespace
          ports:
            - containerPort: 9200
              name: http
          volumeMounts:
            - mountPath: /data
              name: data
      volumes:
        - emptyDir: {}
          name: data
