apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: thanos-store
spec:
  serviceName: "thanos-store"
  replicas: 1
  selector:
    matchLabels:
      app: thanos
      thanos-peer: "true"
  template:
    metadata:
      labels:
        app: thanos
        thanos-peer: "true"
      annotations:
        prometheus.io/scrape: "true"
        prometheus.io/port: "10902"
    spec:
      containers:
      - name: thanos-store
        # Always use explicit image tags (release or master-<date>-sha) instead of ambigous `latest` or `master`.
        image: improbable/thanos:v0.1.0-rc.2
        env:
        - name: GOOGLE_APPLICATION_CREDENTIALS
          value: /creds/gcs-credentials.json
        args:
        - "store"
        - "--log.level=debug"
        - "--tsdb.path=/var/thanos/store"
        - "--cluster.peers=thanos-peers.default.svc.cluster.local:10900"
        # NOTE: This is required to be added in GCS prior startup of this.
        - "--gcs.bucket=<bucket-name>"
        ports:
        - name: http
          containerPort: 10902
        - name: grpc
          containerPort: 10901
        - name: cluster
          containerPort: 10900
        volumeMounts:
        - mountPath: /creds/
          name: gcs-credentials
          readOnly: true
        - name: data
          mountPath: /var/thanos/store
      volumes:
      - name: data
        emptyDir: {}
      - name: gcs-credentials
        secret:
          defaultMode: 420
          # NOTE: gcs-credentials secret with single file gcs-credentials.json is required.
          secretName: gcs-credentials
