# Copyright (c) 2019 Two Sigma Investments, LP
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: prom-ss
  namespace: kube-system
spec:
  selector:
    matchLabels:
      app: prom-ss
  replicas: 1
  serviceName: "prom-ss"
  template:
    metadata:
      labels:
        app: prom-ss
    spec:
      securityContext:
        runAsUser: 1000
        fsGroup: 1000
      serviceAccountName: prometheus
      containers:
      - name: prometheus
        image: prom/prometheus:v2.8.0
        args:
        - "--config.file=/etc/prometheus/prometheus.yml"
        - "--storage.tsdb.path=/prometheus/"
        - "--storage.tsdb.retention.time=1d"
        ports:
        - containerPort: 9090
        volumeMounts:
        - name: prometheus-storage
          mountPath: /prometheus/
        - name: prometheus-config
          mountPath: /etc/prometheus/
      volumes:
      - name: prometheus-config
        configMap:
          defaultMode: 420
          name: prom-server-config
  volumeClaimTemplates:
  - metadata:
      name: prometheus-storage
    spec:
      accessModes: [ "ReadWriteOnce" ]
      resources:
        requests:
          storage: 8Gi
