From 64ca8f2e7cc539f6f03ec19dae658d0959e0920c Mon Sep 17 00:00:00 2001 From: zanhsieh Date: Fri, 16 Dec 2016 07:07:31 +0800 Subject: [PATCH] modify grafana chart as prometheus like format (#292) * modify grafana chart as prometheus like format * fix per @viglesiasce requested * mv to stable repo per @viglesiasce request --- incubator/grafana/Chart.yaml | 3 - incubator/grafana/README.md | 26 -- incubator/grafana/templates/_helpers.tpl | 4 - incubator/grafana/templates/deployment.yaml | 38 --- incubator/grafana/templates/pvc.yaml | 19 -- incubator/grafana/templates/svc.yaml | 16 - incubator/grafana/values.yaml | 11 - stable/grafana/Chart.yaml | 10 + stable/grafana/README.md | 42 +++ stable/grafana/templates/NOTES.txt | 39 +++ stable/grafana/templates/_helpers.tpl | 24 ++ stable/grafana/templates/configmap.yaml | 25 ++ stable/grafana/templates/deployment.yaml | 70 +++++ stable/grafana/templates/ingress.yaml | 33 ++ stable/grafana/templates/job.yaml | 35 +++ stable/grafana/templates/pvc.yaml | 29 ++ stable/grafana/templates/secret.yaml | 17 + stable/grafana/templates/svc.yaml | 21 ++ stable/grafana/values.yaml | 328 ++++++++++++++++++++ 19 files changed, 673 insertions(+), 117 deletions(-) delete mode 100755 incubator/grafana/Chart.yaml delete mode 100644 incubator/grafana/README.md delete mode 100644 incubator/grafana/templates/_helpers.tpl delete mode 100644 incubator/grafana/templates/deployment.yaml delete mode 100644 incubator/grafana/templates/pvc.yaml delete mode 100644 incubator/grafana/templates/svc.yaml delete mode 100644 incubator/grafana/values.yaml create mode 100755 stable/grafana/Chart.yaml create mode 100644 stable/grafana/README.md create mode 100644 stable/grafana/templates/NOTES.txt create mode 100644 stable/grafana/templates/_helpers.tpl create mode 100644 stable/grafana/templates/configmap.yaml create mode 100644 stable/grafana/templates/deployment.yaml create mode 100644 stable/grafana/templates/ingress.yaml create mode 100644 stable/grafana/templates/job.yaml create mode 100644 stable/grafana/templates/pvc.yaml create mode 100644 stable/grafana/templates/secret.yaml create mode 100644 stable/grafana/templates/svc.yaml create mode 100644 stable/grafana/values.yaml diff --git a/incubator/grafana/Chart.yaml b/incubator/grafana/Chart.yaml deleted file mode 100755 index 4b53bb11d8..0000000000 --- a/incubator/grafana/Chart.yaml +++ /dev/null @@ -1,3 +0,0 @@ -description: A Helm chart for Kubernetes -name: grafana -version: 0.1.3 diff --git a/incubator/grafana/README.md b/incubator/grafana/README.md deleted file mode 100644 index 06eb7d633b..0000000000 --- a/incubator/grafana/README.md +++ /dev/null @@ -1,26 +0,0 @@ -# Grafana Helm Chart - -* Installs the web dashboarding system [Grafana](http://grafana.org/) - -## Installing the Chart - -To install the chart with the release name `my-release`: - -```bash -$ helm repo add incubator http://storage.googleapis.com/kubernetes-charts-incubator -$ helm install --name my-release incubator/grafana -``` - -## Configuration - -| Parameter | Description | Default | -|----------------------------|---------------------------------------------------|--------------------------| -| `imageName` | Container image to run | grafana/grafana | -| `adminUser` | Admin user username | admin | -| `adminPassword` | Admin user password | admin | -| `persistence.enabled` | Create a volume to store data | true | -| `persistence.size` | Size of persistent volume claim | 1Gi RW | -| `persistence.storageClass` | Type of persistent volume claim | generic | -| `persistence.accessMode` | ReadWriteOnce or ReadOnly | ReadWriteOnce | -| `cpu` | Container requested cpu | 100m | -| `memory` | Container requested memory | 100M | diff --git a/incubator/grafana/templates/_helpers.tpl b/incubator/grafana/templates/_helpers.tpl deleted file mode 100644 index ac0475a931..0000000000 --- a/incubator/grafana/templates/_helpers.tpl +++ /dev/null @@ -1,4 +0,0 @@ -{{define "fullname"}} -{{- $name := default "grafana" .Values.nameOverride -}} -{{printf "%s-%s" .Release.Name $name | trunc 24 -}} -{{end}} diff --git a/incubator/grafana/templates/deployment.yaml b/incubator/grafana/templates/deployment.yaml deleted file mode 100644 index 16ca416975..0000000000 --- a/incubator/grafana/templates/deployment.yaml +++ /dev/null @@ -1,38 +0,0 @@ -apiVersion: extensions/v1beta1 -kind: Deployment -metadata: - name: {{template "fullname" .}} - labels: - heritage: {{.Release.Service | quote}} - release: {{.Release.Name | quote}} - chart: "{{.Chart.Name}}-{{.Chart.Version}}" -spec: - replicas: 1 - template: - metadata: - labels: - app: {{template "fullname" .}} - release: {{.Release.Name | quote}} - spec: - containers: - - name: grafana - image: "{{.Values.imageName}}:{{default "latest" .Values.imageTag}}" - imagePullPolicy: {{default "Always" .Values.pullPolicy}} - env: - - name: GF_SECURITY_ADMIN_USER - value: "{{.Values.adminUser}}" - - name: GF_SECURITY_ADMIN_PASSWORD - value: "{{.Values.adminPassword}}" - ports: - - containerPort: 3000 - resources: - requests: - cpu: {{default "100m" .Values.Cpu}} - memory: {{default "100M" .Values.Memory}} - volumeMounts: - - mountPath: /var/lib/grafana - name: storage-volume - volumes: - - name: storage-volume - persistentVolumeClaim: - claimName: {{template "fullname" .}} diff --git a/incubator/grafana/templates/pvc.yaml b/incubator/grafana/templates/pvc.yaml deleted file mode 100644 index e9a3417ec5..0000000000 --- a/incubator/grafana/templates/pvc.yaml +++ /dev/null @@ -1,19 +0,0 @@ -{{- if .Values.persistence.enabled }} -kind: PersistentVolumeClaim -apiVersion: v1 -metadata: - name: {{template "fullname" .}} - labels: - app: {{ template "fullname" . }} - chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" - release: "{{ .Release.Name }}" - heritage: "{{ .Release.Service }}" - annotations: - volume.alpha.kubernetes.io/storage-class: {{ .Values.persistence.storageClass | quote }} -spec: - accessModes: - - ReadWriteOnce - resources: - requests: - storage: {{ .Values.persistence.size | quote }} -{{- end }} diff --git a/incubator/grafana/templates/svc.yaml b/incubator/grafana/templates/svc.yaml deleted file mode 100644 index cf0756b272..0000000000 --- a/incubator/grafana/templates/svc.yaml +++ /dev/null @@ -1,16 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: {{ template "fullname" . }} - labels: - app: {{ template "fullname" . }} - chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" - release: "{{ .Release.Name }}" - heritage: "{{ .Release.Service }}" -spec: - ports: - - name: http - port: 80 - targetPort: 3000 - selector: - app: {{ template "fullname" . }} diff --git a/incubator/grafana/values.yaml b/incubator/grafana/values.yaml deleted file mode 100644 index dfc19bbfe4..0000000000 --- a/incubator/grafana/values.yaml +++ /dev/null @@ -1,11 +0,0 @@ -imageName: "grafana/grafana" -adminUser: "admin" -adminPassword: "admin" - -# Persist data to a persitent volume -persistence: - enabled: true - storageClass: generic - accessMode: ReadWriteOnce - size: "1Gi" - diff --git a/stable/grafana/Chart.yaml b/stable/grafana/Chart.yaml new file mode 100755 index 0000000000..b51a08d7f6 --- /dev/null +++ b/stable/grafana/Chart.yaml @@ -0,0 +1,10 @@ +name: grafana +version: 0.2.0 +description: A Helm chart for Kubernetes +home: https://grafana.net +sources: + - https://github.com/grafana/grafana +maintainers: + - name: Ming Hsieh + email: zanhsieh@gmail.com +engine: gotpl diff --git a/stable/grafana/README.md b/stable/grafana/README.md new file mode 100644 index 0000000000..5a0ce0e5db --- /dev/null +++ b/stable/grafana/README.md @@ -0,0 +1,42 @@ +# Grafana Helm Chart + +* Installs the web dashboarding system [Grafana](http://grafana.org/) + +## TL;DR; + +```console +$ helm install incubator/grafana +``` + +## Installing the Chart + +To install the chart with the release name `my-release`: + +```console +$ helm repo add incubator http://storage.googleapis.com/kubernetes-charts-incubator +$ helm install --name my-release incubator/grafana +``` + +## Uninstalling the Chart + +To uninstall/delete the my-release deployment: + +```console +$ helm delete my-release +``` + +The command removes all the Kubernetes components associated with the chart and deletes the release. + + +## Configuration + +| Parameter | Description | Default | +|---------------------------------------|-------------------------------------|---------------------------------------------------| +| `server.image` | Container image to run | grafana/grafana | +| `server.adminUser` | Admin user username | admin | +| `server.adminPassword` | Admin user password | admin | +| `server.persistentVolume.enabled` | Create a volume to store data | true | +| `server.persistentVolume.size` | Size of persistent volume claim | 1Gi RW | +| `server.persistentVolume.storageClass`| Type of persistent volume claim | volume.alpha.kubernetes.io/storage-class: default | +| `server.persistentVolume.accessMode` | ReadWriteOnce or ReadOnly | [ReadWriteOnce] | +| `server.resources` | Server resource requests and limits | requests: {cpu: 100m, memory: 100Mi} | diff --git a/stable/grafana/templates/NOTES.txt b/stable/grafana/templates/NOTES.txt new file mode 100644 index 0000000000..18ef318317 --- /dev/null +++ b/stable/grafana/templates/NOTES.txt @@ -0,0 +1,39 @@ +1. Get your '{{ .Values.server.adminUser }}' user password by running: + + printf $(printf '\%o' `kubectl get secret --namespace {{ .Release.Namespace }} {{ template "server.fullname" . }} -o jsonpath="{.data.grafana-admin-password[*]}"`);echo + +2. The Grafana server can be accessed via port {{ .Values.server.httpPort }} on the following DNS name from within your cluster: + + {{ template "server.fullname" . }}.{{ .Release.Namespace }}.svc.cluster.local +{{ if .Values.server.ingress.enabled }} + From outside the cluster, the server URL(s) are: +{{- range .Values.server.ingress.hosts }} + http://{{ . }} +{{- end }} +{{ else }} + Get the Grafana URL to visit by running these commands in the same shell: +{{ if contains "NodePort" .Values.server.serviceType -}} + export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ template "server.fullname" . }}) + export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") + echo http://$NODE_IP:$NODE_PORT +{{ else if contains "LoadBalancer" .Values.server.serviceType -}} + NOTE: It may take a few minutes for the LoadBalancer IP to be available. + You can watch the status of by running 'kubectl get svc --namespace {{ .Release.Namespace }} -w {{ template "server.fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "server.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}') + echo http://$SERVICE_IP:{{ .Values.server.httpPort -}} +{{ else if contains "ClusterIP" .Values.server.serviceType }} + export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ template "fullname" . }},component={{ .Values.server.name }}" -o jsonpath="{.items[0].metadata.name}") + kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 3000 +{{- end }} +{{- end }} + +3. Login with the password from step 1 and the username: {{ .Values.server.adminUser }} + +{{- if .Values.server.persistentVolume.enabled }} +{{- else }} +################################################################################# +###### WARNING: Persistence is disabled!!! You will lose your data when ##### +###### the Grafana pod is terminated. ##### +################################################################################# +{{- end }} + diff --git a/stable/grafana/templates/_helpers.tpl b/stable/grafana/templates/_helpers.tpl new file mode 100644 index 0000000000..439d36295e --- /dev/null +++ b/stable/grafana/templates/_helpers.tpl @@ -0,0 +1,24 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Expand the name of the chart. +*/}} +{{- define "name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 -}} +{{- end -}} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +*/}} +{{- define "fullname" -}} +{{- $name := default "grafana" .Values.nameOverride -}} +{{- printf "%s-%s" .Release.Name $name | trunc 63 -}} +{{- end -}} + +{{/* +Create a fully qualified server name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +*/}} +{{- define "server.fullname" -}} +{{- printf "%s-%s" .Release.Name "grafana" | trunc 63 -}} +{{- end -}} \ No newline at end of file diff --git a/stable/grafana/templates/configmap.yaml b/stable/grafana/templates/configmap.yaml new file mode 100644 index 0000000000..6283a05731 --- /dev/null +++ b/stable/grafana/templates/configmap.yaml @@ -0,0 +1,25 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + labels: + app: {{ template "fullname" . }} + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" + component: "{{ .Values.server.name }}" + heritage: "{{ .Release.Service }}" + release: "{{ .Release.Name }}" + name: {{ template "server.fullname" . }}-config +data: +{{ toYaml .Values.serverConfigFile | indent 2 }} +--- +apiVersion: v1 +kind: ConfigMap +metadata: + labels: + app: {{ template "fullname" . }} + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" + component: "{{ .Values.server.name }}" + heritage: "{{ .Release.Service }}" + release: "{{ .Release.Name }}" + name: {{ template "server.fullname" . }}-dashs +data: +{{ toYaml .Values.serverDashboardFiles | indent 2 }} \ No newline at end of file diff --git a/stable/grafana/templates/deployment.yaml b/stable/grafana/templates/deployment.yaml new file mode 100644 index 0000000000..41f85ed009 --- /dev/null +++ b/stable/grafana/templates/deployment.yaml @@ -0,0 +1,70 @@ +apiVersion: extensions/v1beta1 +kind: Deployment +metadata: + labels: + app: {{ template "fullname" . }} + chart: "{{.Chart.Name}}-{{.Chart.Version}}" + component: "{{ .Values.server.name }}" + heritage: "{{ .Release.Service }}" + release: "{{ .Release.Name }}" + name: {{ template "server.fullname" . }} +spec: + replicas: 1 + template: + metadata: + annotations: + {{- range $key, $value := .Values.server.annotations }} + {{ $key }}: {{ $value }} + {{- end }} + labels: + app: {{ template "fullname" . }} + component: "{{ .Values.server.name }}" + release: "{{ .Release.Name }}" + spec: + containers: + - name: {{ template "name" . }} + image: "{{ .Values.server.image }}" + imagePullPolicy: {{ default "Always" .Values.server.imagePullPolicy }} + env: + - name: GF_SECURITY_ADMIN_USER + valueFrom: + secretKeyRef: + name: {{ template "server.fullname" . }} + key: grafana-admin-user + - name: GF_SECURITY_ADMIN_PASSWORD + valueFrom: + secretKeyRef: + name: {{ template "server.fullname" . }} + key: grafana-admin-password + ports: + - containerPort: 3000 + readinessProbe: + httpGet: + path: /login + port: 3000 + initialDelaySeconds: 30 + timeoutSeconds: 30 + resources: +{{ toYaml .Values.server.resources | indent 12 }} + volumeMounts: + - name: config-volume + mountPath: {{ default "/etc/grafana" .Values.server.configLocalPath | quote }} + - name: dashboard-volume + mountPath: {{ default "/var/lib/grafana/dashboards" .Values.server.dashboardLocalPath | quote }} + - name: storage-volume + mountPath: {{ default "/var/lib/grafana/data" .Values.server.storageLocalPath | quote }} + terminationGracePeriodSeconds: {{ default 300 .Values.server.terminationGracePeriodSeconds }} + volumes: + - name: config-volume + configMap: + name: {{ template "server.fullname" . }}-config + - name: dashboard-volume + configMap: + name: {{ template "server.fullname" . }}-dashs + - name: storage-volume + {{- if .Values.server.persistentVolume.enabled }} + persistentVolumeClaim: + claimName: {{ template "server.fullname" . }} + {{- else }} + emptyDir: {} + {{- end -}} diff --git a/stable/grafana/templates/ingress.yaml b/stable/grafana/templates/ingress.yaml new file mode 100644 index 0000000000..6de2c56c1d --- /dev/null +++ b/stable/grafana/templates/ingress.yaml @@ -0,0 +1,33 @@ +{{- if .Values.server.ingress.enabled -}} +{{- $releaseName := .Release.Name -}} +{{- $servicePort := .Values.server.httpPort -}} +apiVersion: extensions/v1beta1 +kind: Ingress +metadata: + annotations: + {{- range $key, $value := .Values.server.ingress.annotations }} + {{ $key }}: {{ $value | quote }} + {{- end }} + labels: + app: {{ template "fullname" . }} + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" + component: "{{ .Values.server.name }}" + heritage: "{{ .Release.Service }}" + release: "{{ .Release.Name }}" + name: {{ template "server.fullname" . }} +spec: + rules: + {{- range .Values.server.ingress.hosts }} + - host: {{ . }} + http: + paths: + - path: / + backend: + serviceName: {{ printf "%s-%s" $releaseName "grafana" | trunc 63 }} + servicePort: {{ $servicePort }} + {{- end -}} + {{- if .Values.server.ingress.tls }} + tls: +{{ toYaml .Values.server.ingress.tls | indent 4 }} + {{- end -}} +{{- end -}} diff --git a/stable/grafana/templates/job.yaml b/stable/grafana/templates/job.yaml new file mode 100644 index 0000000000..7232d3229a --- /dev/null +++ b/stable/grafana/templates/job.yaml @@ -0,0 +1,35 @@ +{{- if .Values.server.setDatasource.enabled -}} +apiVersion: batch/v1 +kind: Job +metadata: + labels: + app: {{ template "fullname" . }} + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" + component: "{{ .Values.server.name }}" + heritage: "{{ .Release.Service }}" + release: "{{ .Release.Name }}" + name: {{ template "server.fullname" . }}-set-datasource +spec: + activeDeadlineSeconds: {{ default 300 .Values.server.setDatasource.activeDeadlineSeconds }} + template: + metadata: + labels: + app: {{ template "fullname" . }} + component: "{{ .Values.server.name }}" + release: "{{ .Release.Name }}" + spec: + containers: + - name: {{ template "server.fullname" . }}-set-datasource + image: "{{ .Values.server.setDatasource.image }}" + args: + - "http://{{ .Values.server.adminUser }}:{{ .Values.server.adminPassword }}@{{ template "fullname" . }}:{{ .Values.server.httpPort }}/api/datasources" + - "-X" + - POST + - "-H" + - "Content-Type: application/json;charset=UTF-8" + - "--data-binary" + {{- with .Values.server.setDatasource.datasource }} + - "{\"name\":\"{{ .name }}\",\"type\":\"{{ .type }}\",\"url\":\"{{ .url }}\",\"access\":\"{{ .access }}\",\"isDefault\":{{ .isDefault }}}" + {{- end }} + restartPolicy: {{ .Values.server.setDatasource.restartPolicy }} +{{- end -}} \ No newline at end of file diff --git a/stable/grafana/templates/pvc.yaml b/stable/grafana/templates/pvc.yaml new file mode 100644 index 0000000000..62eafdceaf --- /dev/null +++ b/stable/grafana/templates/pvc.yaml @@ -0,0 +1,29 @@ +{{- if .Values.server.persistentVolume.enabled -}} +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + annotations: + {{- if .Values.server.persistentVolume.storageClass -}} + volume.beta.kubernetes.io/storage-class: {{ .Values.server.persistentVolume.storageClass }} + {{ else }} + volume.alpha.kubernetes.io/storage-class: default + {{- end }} + {{- range $key, $value := .Values.server.persistentVolume.annotations }} + {{ $key }}: {{ $value }} + {{- end }} + labels: + app: {{ template "fullname" . }} + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" + component: "{{ .Values.server.name }}" + heritage: "{{ .Release.Service }}" + release: "{{ .Release.Name }}" + name: {{ template "server.fullname" . }} +spec: + accessModes: +{{- range .Values.server.persistentVolume.accessModes }} + - {{ . | quote }} +{{- end }} + resources: + requests: + storage: {{ .Values.server.persistentVolume.size | quote }} +{{- end -}} diff --git a/stable/grafana/templates/secret.yaml b/stable/grafana/templates/secret.yaml new file mode 100644 index 0000000000..ee68d91e8d --- /dev/null +++ b/stable/grafana/templates/secret.yaml @@ -0,0 +1,17 @@ +apiVersion: v1 +kind: Secret +metadata: + labels: + app: {{ template "fullname" . }} + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" + heritage: "{{ .Release.Service }}" + release: "{{ .Release.Name }}" + name: {{ template "server.fullname" . }} +type: Opaque +data: + {{ if .Values.server.adminPassword }} + grafana-admin-password: {{ .Values.server.adminPassword | b64enc | quote }} + {{ else }} + grafana-admin-password: {{ randAlphaNum 10 | b64enc | quote }} + {{ end }} + grafana-admin-user: {{ .Values.server.adminUser | b64enc | quote }} diff --git a/stable/grafana/templates/svc.yaml b/stable/grafana/templates/svc.yaml new file mode 100644 index 0000000000..f11295a0df --- /dev/null +++ b/stable/grafana/templates/svc.yaml @@ -0,0 +1,21 @@ +apiVersion: v1 +kind: Service +metadata: + labels: + app: {{ template "fullname" . }} + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" + component: "{{ .Values.server.name }}" + heritage: "{{ .Release.Service }}" + release: "{{ .Release.Name }}" + name: {{ template "server.fullname" . }} +spec: + ports: + - name: {{ default "http" .Values.server.httpPortName | quote }} + port: {{ .Values.server.httpPort }} + protocol: TCP + targetPort: 3000 + selector: + app: {{ template "fullname" . }} + component: "{{ .Values.server.name }}" + type: "{{ .Values.server.serviceType }}" + diff --git a/stable/grafana/values.yaml b/stable/grafana/values.yaml new file mode 100644 index 0000000000..d3a3e9fa38 --- /dev/null +++ b/stable/grafana/values.yaml @@ -0,0 +1,328 @@ +server: + ## Grafana Pod annotations: + ## + # annotations: + # iam.amazonaws.com/role: grafana + + ## Grafana service port + ## + httpPort: 80 + + ## Grafana Docker image + ## + image: "grafana/grafana:latest" + + ingress: + ## If true, Grafana Ingress will be created + ## + enabled: false + + ## Grafana Ingress annotations + ## + # annotations: + # kubernetes.io/ingress.class: nginx + # kubernetes.io/tls-acme: 'true' + + ## Grafana Ingress hostnames + ## Must be provided if Ingress is enabled + ## + # hosts: + # - grafana.domain.com + + ## Grafana Ingress TLS configuration + ## Secrets must be manually created in the namespace + ## + # tls: + # - secretName: grafana-server-tls + # hosts: + # - grafana.domain.com + + ## Grafana container name + ## + name: grafana + + adminUser: "admin" + # adminPassword: "admin" + + ## Global imagePullPolicy + ## Default: 'Always' if image tag is 'latest', else 'IfNotPresent' + ## Ref: http://kubernetes.io/docs/user-guide/images/#pre-pulling-images + ## + # imagePullPolicy: + + # Persist data to a persitent volume + persistentVolume: + ## If true, Grafana will create a Persistent Volume Claim + ## If false, use emptyDir + ## + enabled: true + + ## Grafana data Persistent Volume access modes + ## Must match those of existing PV or dynamic provisioner + ## Ref: http://kubernetes.io/docs/user-guide/persistent-volumes/ + ## + accessModes: + - ReadWriteOnce + + ## Server data Persistent Volume annotations + ## + # annotations: + + ## Grafana data Persistent Volume size + ## Default: 1Gi + ## + size: 1Gi + + ## Data Persistent Volume Storage Class + ## If defined, volume.beta.kubernetes.io/storage-class: + ## Default: volume.alpha.kubernetes.io/storage-class: default + ## + # storageClass: + + ## Grafana resource requests and limits + ## Ref: http://kubernetes.io/docs/user-guide/compute-resources/ + ## + resources: + # limits: + # cpu: 500m + # memory: 512Mi + requests: + cpu: 100m + memory: 100Mi + + ## Grafana service type + ## + serviceType: ClusterIP + + ## Grafana local config path + ## Default '/etc/grafana' + ## + # configLocalPath: /etc/grafana + + ## Grafana local dashboards path + ## Default: '/var/lib/grafana/dashboards' + ## + # dashboardLocalPath: /var/lib/grafana/dashboards + + ## Grafana local data storage path + ## Default: '/var/lib/grafana/data' + ## + # storageLocalPath: /var/lib/grafana/data + + ## Grafana Pod termination grace period + ## Default: 300s (5m) + ## + # terminationGracePeriodSeconds: 300 + + # Set datasource in beginning + setDatasource: + ## If true, an initial Grafana Datasource will be set + ## Default: false + ## + enabled: false + + ## How long should it take to commit failure + ## Default: 300 + ## + # activeDeadlineSeconds: 300 + + ## Curl Docker image + ## Default: appropriate/curl:latest + ## + # image: appropriate/curl:latest + + ## This assembles how curl post into Grafana + ## Ref1: http://docs.grafana.org/reference/http_api/#create-data-source + ## Ref2: https://github.com/grafana/grafana/issues/1789 + ## + # datasource: + ## The datasource name. + ## Default: default + # name: default + + ## Type of datasource + ## Default: prometheus + ## + # type: prometheus + + ## The url of the datasource. To set correctly you need to know + ## the right datasource name and its port ahead. Check kubernetes + ## dashboard or describe the service should fulfill the requirements. + ## Synatx like `http://-: + ## Default: "http://limping-tiger-server" + ## + # url: "http://limping-tiger-server" + + ## Specify if Grafana has to go thru proxy to reach datasource + ## Default: proxy + ## + # access: proxy + + ## Specify should Grafana use this datasource as default + ## Default: true + ## + # isDefault: true + + ## Specify the job policy + ## Default: OnFailure + ## + # restartPolicy: OnFailure + +## Grafana config file ConfigMap entry +## +serverConfigFile: + grafana.ini: | + ; instance_name = ${HOSTNAME} + [paths] + data = /var/lib/grafana/data + logs = /var/log/grafana + plugins = /var/lib/grafana/plugins + + [server] + ;protocol = http + ;http_addr = + ;http_port = 3000 + ;domain = localhost + ;enforce_domain = false + ;root_url = %(protocol)s://%(domain)s:%(http_port)s/ + ;router_logging = false + ;static_root_path = public + ;enable_gzip = false + ;cert_file = + ;cert_key = + + [database] + ;type = sqlite3 + ;host = 127.0.0.1:3306 + ;name = grafana + ;user = root + ;password = + ;ssl_mode = disable + ;path = grafana.db + + [session] + ;provider = file + ;provider_config = sessions + ;cookie_name = grafana_sess + ;cookie_secure = false + ;session_life_time = 86400 + + [analytics] + ;reporting_enabled = true + check_for_updates = true + ;google_analytics_ua_id = + + [security] + ;admin_user = admin + ;admin_password = admin + ;secret_key = SW2YcwTIb9zpOOhoPsMm + ;login_remember_days = 7 + ;cookie_username = grafana_user + ;cookie_remember_name = grafana_remember + ;disable_gravatar = false + ;data_source_proxy_whitelist = + + [snapshots] + ;external_enabled = true + ;external_snapshot_url = https://snapshots-origin.raintank.io + ;external_snapshot_name = Publish to snapshot.raintank.io + + [users] + ;allow_sign_up = true + ;allow_org_create = true + ;auto_assign_org = true + ;auto_assign_org_role = Viewer + ;login_hint = email or username + ;default_theme = dark + + [auth.anonymous] + ;enabled = false + ;org_name = Main Org. + ;org_role = Viewer + + [auth.github] + ;enabled = false + ;allow_sign_up = false + ;client_id = some_id + ;client_secret = some_secret + ;scopes = user:email,read:org + ;auth_url = https://github.com/login/oauth/authorize + ;token_url = https://github.com/login/oauth/access_token + ;api_url = https://api.github.com/user + ;team_ids = + ;allowed_organizations = + + [auth.google] + ;enabled = false + ;allow_sign_up = false + ;client_id = some_client_id + ;client_secret = some_client_secret + ;scopes = https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email + ;auth_url = https://accounts.google.com/o/oauth2/auth + ;token_url = https://accounts.google.com/o/oauth2/token + ;api_url = https://www.googleapis.com/oauth2/v1/userinfo + ;allowed_domains = + + [auth.proxy] + ;enabled = false + ;header_name = X-WEBAUTH-USER + ;header_property = username + ;auto_sign_up = true + + [auth.basic] + ;enabled = true + + [auth.ldap] + ;enabled = false + ;config_file = /etc/grafana/ldap.toml + + [smtp] + ;enabled = false + ;host = localhost:25 + ;user = + ;password = + ;cert_file = + ;key_file = + ;skip_verify = false + ;from_address = admin@grafana.localhost + + [emails] + ;welcome_email_on_sign_up = false + + [log] + mode = console + level = info + + [log.console] + ;level = + ;format = console + + [event_publisher] + ;enabled = false + ;rabbitmq_url = amqp://localhost/ + ;exchange = grafana_events + + [dashboards.json] + enabled = true + path = /var/lib/grafana/dashboards + + [metrics] + ;enabled = true + ;interval_seconds = 10 + + ; [metrics.graphite] + ; address = localhost:2003 + ; prefix = prod.grafana.%(instance_name)s. + + [grafana_net] + url = https://grafana.net + + +## Grafana dashboard files ConfigMap entries +## If you'd like to preinstall prometheus dashboard on the same namespace as example, get it from: +## +## https://grafana.net/dashboards/2 +## +## and add it below. +## +serverDashboardFiles: