---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: ingester
spec:
  replicas: 1
  selector:
    matchLabels:
      name: ingester

  # Ingesters are not ready for at least 1 min
  # after creation.  This has to be in sync with
  # the ring timeout value, as this will stop a
  # stampede of new ingesters if we should loose
  # some.
  minReadySeconds: 60

  # Having maxSurge 0 and maxUnavailable 1 means
  # the deployment will update one ingester at a time
  # as it will have to stop one (making one unavailable)
  # before it can start one (surge of zero)
  strategy:
    rollingUpdate:
      maxSurge: 0
      maxUnavailable: 1

  template:
    metadata:
      labels:
        name: ingester
    spec:
      # Give ingesters 40 minutes grace to flush chunks and exit cleanly.
      # Service is available during this time, as long as we don't stop
      # too many ingesters at once.
      terminationGracePeriodSeconds: 2400

      containers:
      - name: ingester
        image: quay.io/cortexproject/cortex:v1.3.0
        imagePullPolicy: IfNotPresent
        args:
        - -target=ingester
        - -ingester.join-after=0s
        - -ingester.min-ready-duration=0s
        - -consul.hostname=consul.default.svc.cluster.local:8500
        - -s3.url=s3://cortex:supersecret@s3.default.svc.cluster.local:9000/cortex
        - -s3.force-path-style=true
        - -dynamodb.url=dynamodb://user:pass@dynamodb.default.svc.cluster.local:8000
        - -schema-config-file=/etc/cortex/schema.yaml
        - -store.chunks-cache.memcached.hostname=memcached.default.svc.cluster.local
        - -store.chunks-cache.memcached.timeout=100ms
        - -store.chunks-cache.memcached.service=memcached
        ports:
        - containerPort: 80
        readinessProbe:
          httpGet:
            path: /ready
            port: 80
          initialDelaySeconds: 15
          timeoutSeconds: 1
        volumeMounts:
        - name: config-volume
          mountPath: /etc/cortex
      volumes:
        - name: config-volume
          configMap:
            name: schema-config
