---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: elasticsearch
  namespace: cloudflare
  labels:
    app: elasticsearch
    component: database
  annotations:
    reloader.stakater.com/auto: "true"
spec:
  replicas: 1
  selector:
    matchLabels:
      app: elasticsearch
      component: database
  strategy:
    type: Recreate
  template:
    metadata:
      labels:
        app: elasticsearch
        component: database
    spec:
      containers:
        - name: elasticsearch
          image: docker.elastic.co/elasticsearch/elasticsearch:7.16.3
          env:
            - name: network.host
              value: 0.0.0.0
            - name: ES_JAVA_OPTS
              value: "-Xmx128m -Xms128m"
            - name: bootstrap.memory_lock
              value: "true"
            - name: transport.host
              value: localhost
          ports:
            - name: elastic
              containerPort: 9200
          volumeMounts:
            - name: data
              mountPath: /usr/share/elasticsearch/data
            - name: config
              mountPath: /etc/elasticsearch/elasticsearch.yaml
              subPath: elasticsearch.yaml
          resources:
            limits:
              cpu: 1000m
              memory: 512M
            requests:
              cpu: 100m
              memory: 512M
      volumes:
        - name: data
          persistentVolumeClaim:
            claimName: elasticsearch-data
        - name: config
          configMap:
            name: elasticsearch-config
