# Copyright 2016 The Kubernetes Authors All rights reserved.
#
# 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: v1
kind: ReplicationController
metadata:
  labels:
    name: influxGrafana
    addonmanager.kubernetes.io/mode: Reconcile
    kubernetes.io/minikube-addons: heapster
  name: influxdb-grafana
  namespace: kube-system
spec:
  replicas: 1
  selector:
    addonmanager.kubernetes.io/mode: Reconcile
    name: influxGrafana
  template:
    metadata:
      labels:
        name: influxGrafana
        addonmanager.kubernetes.io/mode: Reconcile
    spec:
      containers:
      - name: influxdb
        image: gcr.io/google_containers/heapster_influxdb:v0.6
        imagePullPolicy: IfNotPresent
        volumeMounts:
        - mountPath: /data
          name: influxdb-storage
      - name: grafana
        image: gcr.io/google_containers/heapster_grafana:v2.6.0-2
        imagePullPolicy: IfNotPresent
        env:
          - name: INFLUXDB_SERVICE_URL
            value: http://localhost:8086
            # The following env variables are required to make Grafana accessible via
            # the kubernetes api-server proxy. On production clusters, we recommend
            # removing these env variables, setup auth for grafana, and expose the grafana
            # service using a LoadBalancer or a public IP.
          - name: GF_AUTH_BASIC_ENABLED
            value: "false"
          - name: GF_AUTH_ANONYMOUS_ENABLED
            value: "true"
          - name: GF_AUTH_ANONYMOUS_ORG_ROLE
            value: Admin
          - name: GF_SERVER_ROOT_URL
            value: /
        volumeMounts:
        - mountPath: /var
          name: grafana-storage
      volumes:
      - name: influxdb-storage
        emptyDir: {}
      - name: grafana-storage
        emptyDir: {}
