Merge pull request #1386 from miguelaeh/grafanaChart

[bitnami/grafana] Add Grafana Helm Chart
This commit is contained in:
Miguel Ángel Cabrera Miñagorri
2019-09-06 14:56:25 +02:00
committed by GitHub
14 changed files with 1287 additions and 0 deletions
+22
View File
@@ -0,0 +1,22 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
+18
View File
@@ -0,0 +1,18 @@
apiVersion: v1
name: grafana
version: 0.0.1
appVersion: "6.3.3"
description: Grafana is an open source, feature rich metrics dashboard and graph editor for Graphite, Elasticsearch, OpenTSDB, Prometheus and InfluxDB.
keywords:
- analitics
- monitoring
- metrics
- logs
home: https://grafana.com/
sources:
- https://github.com/bitnami/bitnami-docker-grafana
maintainers:
- name: Bitnami
email: containers@bitnami.com
engine: gotpl
icon: https://bitnami.com/assets/stacks/grafana/img/grafana-stack-220x234.png
+195
View File
@@ -0,0 +1,195 @@
# Grafana
[Grafana](https://grafana.com/) is an open source, feature rich metrics dashboard and graph editor for Graphite, Elasticsearch, OpenTSDB, Prometheus and InfluxDB.
## TL;DR;
```console
$ helm repo add bitnami https://charts.bitnami.com/bitnami
$ helm install bitnami/grafana
```
## Introduction
This chart bootstraps a [grafana](https://github.com/bitnami/bitnami-docker-grafana) deployment on a [Kubernetes](http://kubernetes.io) cluster using the [Helm](https://helm.sh) package manager.
Bitnami charts can be used with [Kubeapps](https://kubeapps.com/) for deployment and management of Helm Charts in clusters.
## Installing the Chart
To install the chart with the release name `my-release`:
```console
$ helm repo add bitnami https://charts.bitnami.com/bitnami
$ helm install --name my-release bitnami/grafana
```
These commands deploy grafana on the Kubernetes cluster in the default configuration. The [configuration](#configuration) section lists the parameters that can be configured during installation.
> **Tip**: List all releases using `helm list`
## Uninstalling the Chart
To uninstall/delete the `my-release` statefulset:
```console
$ helm delete my-release
```
The command removes all the Kubernetes components associated with the chart and deletes the release. Use the option `--purge` to delete all persistent volumes too.
## Configuration
The following tables lists the configurable parameters of the grafana chart and their default values.
| Parameter | Description | Default |
| ------------------------------------------- | ------------------------------------------------------------------------------------------- | ------------------------------------------------------- |
| `global.imageRegistry` | Global Docker image registry | `nil` |
| `global.imagePullSecrets` | Global Docker registry secret names as an array | `[]` (does not add image pull secrets to deployed pods) |
| `image.registry` | Grafana image registry | `docker.io` |
| `image.repository` | Grafana image name | `bitnami/grafana` |
| `image.tag` | Grafana image tag | `{TAG_NAME}` |
| `image.pullPolicy` | Grafana image pull policy | `IfNotPresent` |
| `image.pullSecrets` | Specify docker-registry secret names as an array | `[]` (does not add image pull secrets to deployed pods) |
| `nameOverride` | String to partially override grafana.fullname template with a string (will prepend the release name) | `nil` |
| `fullnameOverride` | String to fully override grafana.fullname template with a string | `nil` |
| `replicaCount` | Number of replicas of the Grafana Pod | `1` |
| `updateStrategy` | Update strategy for deployment | `{type: "RollingUpdate"}` |
| `schedulerName` | Alternative scheduler | `nil` |
| `admin.user` | Grafana admin username | `admin` |
| `admin.password` | Grafana admin password | Randomly generated |
| `smtp.enabled` | Enable SMTP configuration | `false` |
| `smtp.existingSecret` | Secret with SMTP credentials | `nil` |
| `smtp.existingSecretUserKey` | Key which value is the SMTP user in the SMTP secret | `user` |
| `smtp.existingSecretPasswordKey` | Key which values is the SMTP password in the SMTP secret | `password` |
| `plugins` | Grafana plugins to be installed in deployment time separated by commas | `nil` |
| `ldap.enabled` | Enable LDAP for Grafana | `false` |
| `ldap.allowSignUp` | Allows LDAP sign up for Grafana | `false` |
| `ldap.configMapName` | Name of the ConfigMap with the LDAP configuration file for Grafana | `nil` |
| `extraEnvVars` | Array containing extra env vars to configure Grafana | `nil` |
| `extraConfigmaps` | Array to mount extra ConfigMaps to configure Grafana | `nil` |
| `config.useGrafanaIniFile` | Allows to load a `grafana.ini` file | `false` |
| `config.grafanaIniConfigMap` | Name of the ConfigMap containing the `grafana.ini` file | `nil` |
| `config.useCustomIniFile` | Allows to load a `custom.ini` file | `false` |
| `config.customIniConfigMap` | Name of the ConfigMap containing the `custom.ini` file | `nil` |
| `dashboardsProvider.enabled` | Enable the use of a Grafana dashboard provider | `false` |
| `dashboardsProvider.configMapName` | Name of a ConfigMap containing a custom dashboard provider | `nil` |
| `dashboardsConfigMaps` | Array with the names of a series of ConfigMaps containing dashboards files | `nil` |
| `datasources.secretName` | Secret name containing custom datasource files | `nil` |
| `persistence.enabled` | Enable persistence | `true` |
| `presistence.storageClass` | Storage class to use with the PVC | `nil` |
| `persistence.accessMode` | Access mode to the PV | `ReadWriteOnce` |
| `persistence.size` | Size for the PV | `10Gi` |
| `livenessProbe.enabled` | Enable/disable the Liveness probe | `true` |
| `livenessProbe.initialDelaySeconds` | Delay before liveness probe is initiated | `60` |
| `livenessProbe.periodSeconds` | How often to perform the probe | `10` |
| `livenessProbe.timeoutSeconds` | When the probe times out | `5` |
| `livenessProbe.successThreshold` | Minimum consecutive successes for the probe to be considered successful after having failed.| `1` |
| `livenessProbe.failureThreshold` | Minimum consecutive failures for the probe to be considered failed after having succeeded. | `6` |
| `readinessProbe.enabled` | Enable/disable the Readiness probe | `true` |
| `readinessProbe.initialDelaySeconds` | Delay before readiness probe is initiated | `5` |
| `readinessProbe.periodSeconds` | How often to perform the probe | `10` |
| `readinessProbe.timeoutSeconds` | When the probe times out | `5` |
| `readinessProbe.failureThreshold` | Minimum consecutive failures for the probe to be considered failed after having succeeded. | `6` |
| `readinessProbe.successThreshold` | Minimum consecutive successes for the probe to be considered successful after having failed.| `1` |
| `service.type` | Kubernetes Service type | `ClusterIP` |
| `service.webPort` | Grafana client port | `80` |
| `service.clusterPort` | Grafana cluster port | `7077` |
| `service.nodePort` | Port to bind to for NodePort service type (client port) | `nil` |
| `service.annotations` | Annotations for Grafana service | `{}` |
| `service.loadBalancerIP` | loadBalancerIP if Grafana service type is `LoadBalancer` | `nil` |
| `ingress.enabled` | Enable the use of the ingress controller to access the web UI | `false` |
| `ingress.annotations` | Annotations for the Grafana Ingress | `{}` |
| `ingress.hosts` | Add hosts to the ingress controller with name and path | `name: grafana.local`, `path: /` |
| `ingress.tls` | Configure TLS for the Grafana Ingress | `[]` |
| `securityContext.enabled` | Enable securityContext on for Granafa deployment | `true` |
| `securityContext.runAsUser` | User for the security context | `1001` |
| `securityContext.fsGroup` | Group to configure permissions for volumes | `1001` |
| `securityContext.runAsNonRoot` | Run containers as non-root users | `true` |
| `resources` | Configure resource requests and limits | `nil` |
| `nodeSelector` | Node labels for pod assignment | `{}` |
| `tolerations` | Tolerations for pod assignment | `[]` |
| `affinity` | Affinity for pod assignment | `{}` |
| `podAnnotations` | Pod annotations | `{}` |
Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example,
```console
$ helm install --name my-release \
--set admin.user=admin-user bitnami/grafana
```
The above command sets the Grafana admin user to `admin-user`.
Alternatively, a YAML file that specifies the values for the parameters can be provided while installing the chart. For example,
```console
$ helm install --name my-release -f values.yaml bitnami/grafana
```
> **Tip**: You can use the default [values.yaml](values.yaml)
### Using custom configuration
Grafana support multiples configuration files. Using kubernetes you can mount a file using a ConfigMap. For example, to mount a custom `grafana.ini` file or `custom.ini` file you can create a ConfigMap like the following:
```
apiVersion: v1
kind: ConfigMap
metadata:
name: myconfig
data:
grafana.ini: |-
# Raw text of the file
```
And now you need to pass the ConfigMap name, to the corresponding parameter:
```
$ helm install bitnami/grafana --set config.useGrafanaIniFile=true,config.grafanaIniConfigMap=myconfig
```
To provide dashboards on deployment time, Grafana needs a dashboards provider and the dashboards themselves.
A default provider is created if enabled, or you can mount your own provider using a ConfigMap, but have in mind that the path to the dashboard folder must be `/opt/bitnami/grafana/dashboards`.
1. To create a dashboard, it is needed to have a datasource for it. The datasources must be created mounting a secret with all the datasource files in it. In this case, it is not a ConfigMap because the datasource could contain sensitive information.
2. To load the dashboards themselves you need to create a ConfigMap for each one containing the `json` file that defines the dashboard and set the array with the ConfigMap names into the `dashboardsConfigMaps` parameter.
Note the difference between the datasources and the dashboards creation. For the datasources we can use just one secret with all of the files, while for the dashboards we need one ConfigMap per file.
For example, after the creation of the dashboard and datasource ConfigMap in the same way that the explained for the `grafana.ini` file, execute the following to deploy Grafana with custom dashboards:
```
$ helm install bitnami/grafana --set "dashboardsProvider.enabled=true,datasources.secretName=datasource-secret,dashboardsConfigMaps[0].configMapName=mydashboard,dashboardsConfigMaps[0].fileName=mydashboard.json"
```
### Production configuration
This chart includes a `values-production.yaml` file where you can find some parameters oriented to production configuration in comparison to the regular `values.yaml`.
```console
$ helm install --name my-release -f ./values-production.yaml bitnami/grafana
```
- Enable ingress controller
```diff
- ingress.enabled: false
+ ingress.enabled: true
```
### Supporting HA (High Availability)
To support HA Grafana just need an external database where store dashboards, users and other persistent data.
To configure the external database provide a configuration file containing the [database section](https://grafana.com/docs/installation/configuration/#database)
More information about Grafana HA [here](https://grafana.com/docs/tutorials/ha_setup/)
### [Rolling VS Immutable tags](https://docs.bitnami.com/containers/how-to/understand-rolling-tags-containers/)
It is strongly recommended to use immutable tags in a production environment. This ensures your deployment does not change automatically if the same tag is updated with a different image.
Bitnami will release a new chart updating its containers if a new version of the main container, significant changes, or critical vulnerabilities exist.
## Persistence
The [Bitnami Grafana](https://github.com/bitnami/bitnami-docker-grafana) image stores the Grafana data and configurations at the `/opt/bitnami/grafana/data` path of the container.
Persistent Volume Claims are used to keep the data across deployments. This is known to work in GCE, AWS, and minikube.
See the [Configuration](#configuration) section to configure the PVC or to disable persistence.
+37
View File
@@ -0,0 +1,37 @@
** Please be patient while the chart is being deployed **
1. Get the application URL by running these commands:
{{- if .Values.ingress.enabled }}
{{- range $host := .Values.ingress.hosts }}
{{- range .paths }}
http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ . }}
{{- end }}
{{- end }}
{{- else if contains "NodePort" .Values.service.type }}
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "grafana.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.service.type }}
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "grafana.fullname" . }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "grafana.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
echo http://$SERVICE_IP:{{ .Values.service.port }}
{{- else if contains "ClusterIP" .Values.service.type }}
echo "Browse to http://127.0.0.1:8080"
kubectl port-forward svc/{{ include "grafana.fullname" . }} 8080:{{ .Values.service.port }} &
{{- end }}
2. Get the admin credentials:
echo "User: {{ .Values.admin.user }}"
echo "Password: $(kubectl get secret {{ include "grafana.fullname" . }}-secret -o jsonpath="{.data.GF_SECURITY_ADMIN_PASSWORD}" | base64 --decode)"
{{- if and (contains "bitnami/" .Values.image.repository) (not (.Values.image.tag | toString | regexFind "-r\\d+$|sha256:")) }}
WARNING: Rolling tag detected ({{ .Values.image.repository }}:{{ .Values.image.tag }}), please note that it is strongly recommended to avoid using rolling tags in a production environment.
+info https://docs.bitnami.com/containers/how-to/understand-rolling-tags-containers/
{{- end }}
{{ include "grafana.validateValues" . }}
+163
View File
@@ -0,0 +1,163 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "grafana.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Return the proper Grafana image name
*/}}
{{- define "grafana.image" -}}
{{- $registryName := .Values.image.registry -}}
{{- $repositoryName := .Values.image.repository -}}
{{- $tag := .Values.image.tag | toString -}}
{{/*
Helm 2.11 supports the assignment of a value to a variable defined in a different scope,
but Helm 2.9 and 2.10 doesn't support it, so we need to implement this if-else logic.
Also, we can't use a single if because lazy evaluation is not an option
*/}}
{{- if .Values.global }}
{{- if .Values.global.imageRegistry }}
{{- printf "%s/%s:%s" .Values.global.imageRegistry $repositoryName $tag -}}
{{- else -}}
{{- printf "%s/%s:%s" $registryName $repositoryName $tag -}}
{{- end -}}
{{- else -}}
{{- printf "%s/%s:%s" $registryName $repositoryName $tag -}}
{{- end -}}
{{- end -}}
{{/*
Common labels
*/}}
{{- define "grafana.labels" -}}
app.kubernetes.io/name: {{ include "grafana.name" . }}
helm.sh/chart: {{ include "grafana.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end -}}
{{/*
Labels to use on deploy.spec.selector.matchLabels and svc.spec.selector
*/}}
{{- define "grafana.matchLabels" -}}
app.kubernetes.io/name: {{ include "grafana.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- 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).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "grafana.fullname" -}}
{{- if .Values.fullnameOverride -}}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- if contains $name .Release.Name -}}
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "grafana.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Return the proper Docker Image Registry Secret Names
*/}}
{{- define "grafana.imagePullSecrets" -}}
{{/*
Helm 2.11 supports the assignment of a value to a variable defined in a different scope,
but Helm 2.9 and 2.10 does not support it, so we need to implement this if-else logic.
Also, we can not use a single if because lazy evaluation is not an option
*/}}
{{- if .Values.global }}
{{- if .Values.global.imagePullSecrets }}
imagePullSecrets:
{{- range .Values.global.imagePullSecrets }}
- name: {{ . }}
{{- end }}
{{- else if .Values.image.pullSecrets }}
imagePullSecrets:
{{- range .Values.image.pullSecrets }}
- name: {{ . }}
{{- end }}
{{- end -}}
{{- else if .Values.image.pullSecrets }}
imagePullSecrets:
{{- range .Values.image.pullSecrets }}
- name: {{ . }}
{{- end }}
{{- end -}}
{{- end -}}
{{/*
Return the proper Storage Class
*/}}
{{- define "grafana.storageClass" -}}
{{/*
Helm 2.11 supports the assignment of a value to a variable defined in a different scope,
but Helm 2.9 and 2.10 does not support it, so we need to implement this if-else logic.
*/}}
{{- if .Values.global -}}
{{- if .Values.global.storageClass -}}
{{- if (eq "-" .Values.global.storageClass) -}}
{{- printf "storageClassName: \"\"" -}}
{{- else }}
{{- printf "storageClassName: %s" .Values.global.storageClass -}}
{{- end -}}
{{- else -}}
{{- if .Values.persistence.storageClass -}}
{{- if (eq "-" .Values.persistence.storageClass) -}}
{{- printf "storageClassName: \"\"" -}}
{{- else }}
{{- printf "storageClassName: %s" .Values.persistence.storageClass -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- else -}}
{{- if .Values.persistence.storageClass -}}
{{- if (eq "-" .Values.persistence.storageClass) -}}
{{- printf "storageClassName: \"\"" -}}
{{- else }}
{{- printf "storageClassName: %s" .Values.persistence.storageClass -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{/*
Validate values for Grafana.
*/}}
{{- define "grafana.validateValues" -}}
{{- $messages := list -}}
{{- $messages := append $messages (include "grafana.validateValues.database" .) -}}
{{- $messages := without $messages "" -}}
{{- $message := join "\n" $messages -}}
{{- if $message -}}
{{- printf "\nVALUES VALIDATION:\n%s" $message -}}
{{- end -}}
{{- end -}}
{{/*
Function to validate the external database
*/}}
{{- define "grafana.validateValues.database" -}}
{{- $replicaCount := int .Values.replicaCount }}
{{- if gt $replicaCount 1 -}}
WARNING: Using more than one replica requires using an external database to share data between Grafana instances.
By default Grafana uses an internal sqlite3 per instance but you can configure an external MySQL or PostgreSQL.
Please, ensure you provide a configuration file configuring the external database to share data between replicas.
{{- end -}}
{{- end -}}
+19
View File
@@ -0,0 +1,19 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "grafana.fullname" . }}-envvars
labels: {{ include "grafana.labels" . | nindent 4 }}
data:
GF_SECURITY_ADMIN_USER: {{ .Values.admin.user | quote }}
{{- if .Values.plugins }}
GF_INSTALL_PLUGINS: {{ .Values.plugins | quote }}
{{- end }}
GF_PATHS_PLUGINS: "/opt/bitnami/grafana/data/plugins"
GF_AUTH_LDAP_ENABLED: {{ .Values.ldap.enabled | quote }}
GF_AUTH_LDAP_CONFIG_FILE: "/opt/bitnami/grafana/conf/ldap.toml"
GF_AUTH_LDAP_ALLOW_SIGN_UP: {{ .Values.ldap.allowSignUp | quote }}
GF_PATHS_PROVISIONING: "/opt/bitnami/grafana/conf/provisioning"
GF_PATHS_CONFIG: "/opt/bitnami/grafana/conf/grafana.ini"
GF_PATHS_DATA: "/opt/bitnami/grafana/data"
GF_PATHS_LOGS: "/opt/bitnami/grafana/logs"
GF_PATHS_PLUGINS: "/opt/bitnami/grafana/data/plugins"
@@ -0,0 +1,31 @@
{{- if .Values.dashboardsProvider.enabled }}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "grafana.fullname" . }}-provider
labels: {{ include "grafana.labels" . | nindent 4 }}
data:
default-provider.yaml: |-
apiVersion: 1
providers:
# <string> an unique provider name
- name: 'default-provider'
# <int> org id. will default to orgId 1 if not specified
orgId: 1
# <string, required> name of the dashboard folder. Required
folder: dashboards
# <string> folder UID. will be automatically generated if not specified
folderUid: ''
# <string, required> provider type. Required
type: file
# <bool> disable dashboard deletion
disableDeletion: false
# <bool> enable dashboard editing
editable: true
# <int> how often Grafana will scan for changed dashboards
updateIntervalSeconds: 10
options:
# <string, required> path to dashboard files on disk. Required
path: /opt/bitnami/grafana/dashboards
{{- end }}
+165
View File
@@ -0,0 +1,165 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "grafana.fullname" . }}
labels: {{ include "grafana.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels: {{ include "grafana.matchLabels" . | nindent 6 }}
{{- if .Values.updateStrategy }}
strategy: {{ toYaml .Values.updateStrategy | nindent 4 }}
{{- end }}
template:
metadata:
labels: {{ include "grafana.labels" . | nindent 8 }}
annotations:
checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
checksum/dashboard-provider: {{ include (print $.Template.BasePath "/dashboard-provider.yaml") . | sha256sum }}
{{- if .Values.podAnnotations }}
{{ toYaml .Values.podAnnotations | indent 8 }}
{{- end }}
spec:
{{- if .Values.schedulerName }}
schedulerName: {{ .Values.schedulerName | quote }}
{{- end }}
{{- include "grafana.imagePullSecrets" . | indent 6 }}
{{- if .Values.securityContext.enabled }}
securityContext:
runAsUser: {{ .Values.securityContext.runAsUser }}
fsGroup: {{ .Values.securityContext.fsGroup }}
runAsNonRoot: {{ .Values.securityContext.runAsNonRoot }}
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- tpl (toYaml .) $ | indent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- tpl (toYaml .) $ | indent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- tpl (toYaml .) $ | indent 8 }}
{{- end }}
containers:
- name: {{ .Chart.Name }}
image: {{ template "grafana.image" . }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
envFrom:
- configMapRef:
name: {{ include "grafana.fullname" . }}-envvars
- secretRef:
name: {{ include "grafana.fullname" . }}-secret
{{- if .Values.smtp.existingSecret }}
- name: GF_SMTP_USER
valueFrom:
secretKeyRef:
name: {{ .Values.smtp.existingSecret }}
key: {{ .Values.smtp.existingSecretUserKey }}
- name: GF_SMTP_PASSWORD
valueFrom:
secretKeyRef:
name: {{ .Values.smtp.existingSecret }}
key: {{ .Values.smtp.existingSecretPasswordKey }}
{{- end }}
{{- if .Values.extraEnvVars }}
{{ toYaml .Values.extraEnvVars | indent 8 }}
{{- end }}
volumeMounts:
{{- if .Values.config.useGrafanaIniFile }}
- name: grafana-ini
mountPath: /opt/bitnami/grafana/conf/grafana.ini
subPath: grafana.ini
{{- end }}
{{- if .Values.config.useCustomIniFile }}
- name: custom-ini
mountPath: /opt/bitnami/grafana/conf/custom.ini
subPath: custom.ini
{{- end }}
- name: data
mountPath: /opt/bitnami/grafana/data
{{- if .Values.dashboardsProvider.enabled }}
- name: dashboards-provider
mountPath: /opt/bitnami/grafana/conf/provisioning/dashboards
{{- end }}
{{- range .Values.dashboardsConfigMaps }}
- name: {{ .configMapName }}
mountPath: /opt/bitnami/grafana/dashboards/{{ .fileName }}
subPath: {{ .fileName }}
{{- end }}
{{- if .Values.datasources.secretName }}
- name: datasources
mountPath: /opt/bitnami/grafana/conf/provisioning/datasources
{{- end }}
{{- if and .Values.ldap.enabled .Values.ldap.configMapName }}
- name: ldap
mountPath: /opt/bitnami/grafana/conf/ldap.toml
subPath: ldap.toml
{{- end }}
{{- range .Values.extraConfigmaps }}
- name: {{ .name }}
mountPath: {{ .mountPath }}
subPath: {{ .subPath | default "" }}
readOnly: {{ .readOnly }}
{{- end }}
ports:
- name: dashboard
containerPort: 3000
protocol: TCP
livenessProbe:
httpGet:
path: /
port: dashboard
{{ toYaml .Values.livenessProbe | indent 10 }}
readinessProbe:
httpGet:
path: /
port: dashboard
{{ toYaml .Values.readinessProbe | indent 10 }}
resources: {{- toYaml .Values.resources | nindent 10 }}
volumes:
- name: data
{{- if .Values.persistence.enabled }}
persistentVolumeClaim:
claimName: {{ .Values.persistence.existingClaim | default (include "grafana.fullname" .) }}
{{- end }}
{{- if and .Values.ldap.enabled .Values.ldap.configMapName }}
- name: ldap
configMap:
name: {{ .Values.ldap.configMapName }}
{{- end }}
{{- if .Values.dashboardsProvider.enabled }}
- name: dashboards-provider
configMap:
{{- if .Values.dashboardsProvider.configMapName }}
name: {{ .Values.dashboardsProvider.configMapName }}
{{- else }}
name: {{ include "grafana.fullname" . }}-provider
{{- end }}
{{- end }}
{{- range .Values.dashboardsConfigMaps }}
- name: {{ .configMapName }}
configMap:
name: {{ .configMapName }}
{{- end }}
{{- if .Values.datasources.secretName }}
- name: datasources
secret:
secretName: {{ .Values.datasources.secretName }}
{{- end }}
{{- if .Values.config.useGrafanaIniFile }}
- name: grafana-ini
configMap:
name: {{ required "A configmap containing the grafana.ini file is needed!!" .Values.config.grafanaIniConfigMap }}
{{- end }}
{{- if .Values.config.useCustomIniFile }}
- name: custom-ini
configMap:
name: {{ required "A configmap containing the custom.ini file is needed!!" .Values.config.customIniConfigMap }}
{{- end }}
{{- range .Values.extraConfigmaps }}
- name: {{ .name }}
configMap:
name: {{ .name }}
{{- end }}
+37
View File
@@ -0,0 +1,37 @@
{{- if .Values.ingress.enabled -}}
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: {{ include "grafana.fullname" . }}
labels: {{ include "grafana.labels" . | nindent 4 }}
annotations:
{{- if .Values.ingress.certManager }}
kubernetes.io/tls-acme: "true"
{{- end }}
{{- with .Values.ingress.annotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- if .Values.ingress.tls }}
tls:
{{- range .Values.ingress.tls }}
- hosts:
{{- range .hosts }}
- {{ . | quote }}
{{- end }}
secretName: {{ .secretName }}
{{- end }}
{{- end }}
rules:
{{- range .Values.ingress.hosts }}
- host: {{ .host | quote }}
http:
paths:
{{- range .paths }}
- path: {{ . }}
backend:
serviceName: {{ include "grafana.fullname" $ }}
servicePort: http
{{- end }}
{{- end }}
{{- end }}
+14
View File
@@ -0,0 +1,14 @@
{{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim) }}
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: {{ template "grafana.fullname" . }}
labels: {{ include "grafana.labels" . | nindent 4 }}
spec:
accessModes:
- {{ .Values.persistence.accessMode | quote }}
resources:
requests:
storage: {{ .Values.persistence.size | quote }}
{{ include "grafana.storageClass" . }}
{{- end -}}
+18
View File
@@ -0,0 +1,18 @@
apiVersion: v1
kind: Secret
metadata:
name: {{ template "grafana.fullname" . }}-secret
labels: {{ include "grafana.labels" . | nindent 4 }}
type: Opaque
data:
{{- if .Values.admin.password }}
GF_SECURITY_ADMIN_PASSWORD: {{ .Values.admin.password | b64enc | quote }}
{{- else }}
GF_SECURITY_ADMIN_PASSWORD: {{ randAlphaNum 10 | b64enc | quote }}
{{- end }}
{{- if and .Values.smtp.enabled (not .Values.smtp.existingSecret) }}
{{- if and .Values.smtp.user .Values.smtp.password }}
GF_SMTP_USER: {{ .Values.smtp.user | b64enc | quote }}
GF_SMTP_PASSWORD: {{ .Values.smtp.password | b64enc | quote }}
{{- end }}
{{- end }}
+22
View File
@@ -0,0 +1,22 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "grafana.fullname" . }}
labels: {{ include "grafana.labels" . | nindent 4 }}
{{- if .Values.service.annotations }}
annotations: {{ toYaml .Values.service.annotations | nindent 4 }}
{{- end }}
spec:
type: {{ .Values.service.type }}
{{- if and .Values.service.loadBalancerIP (eq .Values.service.type "LoadBalancer") }}
loadBalancerIP: {{ .Values.service.loadBalancerIP }}
{{- end }}
ports:
- port: {{ .Values.service.port }}
targetPort: dashboard
protocol: TCP
name: http
{{- if .Values.service.nodePort }}
nodePort: {{ .Values.service.nodePort }}
{{- end }}
selector: {{ include "grafana.matchLabels" . | nindent 4 }}
+273
View File
@@ -0,0 +1,273 @@
## Global Docker image parameters
## Please, note that this will override the image parameters, including dependencies, configured to use the global value
## Current available global Docker image parameters: imageRegistry, imagePullSecrets and storageClass
##
# global:
# imageRegistry: myRegistryName
# imagePullSecrets:
# - myRegistryKeySecretName
# storageClass: myStorageClass
## Bitnami Grafana image version
## ref: https://hub.docker.com/r/bitnami/grafana/tags/
##
image:
registry: docker.io
repository: bitnami/grafana
tag: 6.3.3-debian-9-r12
## Specify a imagePullPolicy
## Defaults to 'Always' if image tag is 'latest', else set to 'IfNotPresent'
## ref: http://kubernetes.io/docs/user-guide/images/#pre-pulling-images
##
pullPolicy: IfNotPresent
## Optionally specify an array of imagePullSecrets.
## Secrets must be manually created in the namespace.
## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/
##
# pullSecrets:
# - myRegistryKeySecretName
## String to partially override grafana.fullname template (will maintain the release name)
##
# nameOverride:
## String to fully override grafana.fullname template
##
# fullnameOverride:
## Number of grafana Pod replicas
##
replicaCount: 1
## Set up update strategy for Grafana installation. Set to Recreate if you use persistent volume that cannot be mounted by more than one pods to makesure the pods is destroyed first.
## ref: https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#strategy
## Example:
# updateStrategy:
# type: RollingUpdate
# rollingUpdate:
# maxSurge: 25%
# maxUnavailable: 25%
updateStrategy:
type: RollingUpdate
## Use an alternate scheduler, e.g. "stork".
## ref: https://kubernetes.io/docs/tasks/administer-cluster/configure-multiple-schedulers/
##
# schedulerName:
## Admin access configuration
## If a password is not provided a random password will be generated
##
admin:
user: "admin"
# password:
## SMTP configuration
## Use either a secret container the credentials or set the credentials through command line.
##
smtp:
enabled: false
# Provide credentials by command line
user: user
password: password
## Existing secret with SMTP credentials (user and password)
# existingSecret:
## User and password key on the existing secret ( "user" and "password" by default )
existingSecretUserKey: user
existingSecretPasswordKey: password
## Grafana plugins that will be installed
## Specify plugins as a list separated by commas ( you will need to scape them when specifying from command line )
## Example:
## plugins: grafana-kubernetes-app,grafana-example-app
##
# plugins:
## Ldap configuration for Grafana
##
ldap:
enabled: false
allowSignUp: false
## configMap with LDAP configuration file (ldap.toml)
# configMapName:
## An array to add extra env vars
## For example:
## extraEnvVars:
## - name: GF_DEFAULT_INSTANCE_NAME
## value: my-instance
##
# extraEnvVars:
## An array to add extra configmaps:
## For example:
## extraConfigmaps:
## - name: myconfigmap
## mountPath: /opt/bitnami/desired-path
## subPath: file-name.extension (optional)
## readOnly: true
## Parameters to override the default grafana.ini and custom.ini files.
## It is needed to create a configmap containing the grafana.ini and custom.ini files.
##
config:
useGrafanaIniFile: false
grafanaIniConfigMap:
useCustomIniFile: false
customIniConfigMap:
## Create dasboard provider to load dashboards, a default one is created to load
## dashboards from "/opt/bitnami/grafana/dashboards"
##
dashboardsProvider:
enabled: false
## ConfigMap with a custom provider file.
## Important to set the Path to "/opt/bitnami/grafana/dashboards"
configMapName:
## Create dashboards from a custom configMap that contains the file.
## They will be mounted by the default dashboard provider if it is enabled
## Use an array with the configMap names.
## Example:
## dashboardsConfigMaps:
## - configMapName: mydashboard
## fileName: mydashboard.json
## - configMapName: myotherdashboard
## fileName: myotherdashboard.json
##
dashboardsConfigMaps: []
## Create datasources from a custom secret
## The secret must contain the files
##
datasources:
secretName:
## Enable persistence using Persistent Volume Claims
## ref: http://kubernetes.io/docs/user-guide/persistent-volumes/
##
##
persistence:
enabled: true
## wordpress data Persistent Volume Storage Class
## If defined, storageClassName: <storageClass>
## If set to "-", storageClassName: "", which disables dynamic provisioning
## If undefined (the default) or set to null, no storageClassName spec is
## set, choosing the default provisioner. (gp2 on AWS, standard on
## GKE, AWS & OpenStack)
##
# storageClass: "-"
##
## If you want to reuse an existing claim, you can pass the name of the PVC using
## the existingClaim variable
# existingClaim: your-claim
accessMode: ReadWriteOnce
size: 10Gi
## Configure extra options for liveness and readiness probes
## ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/#configure-probes)
##
livenessProbe:
initialDelaySeconds: 120
periodSeconds: 10
timeoutSeconds: 5
failureThreshold: 6
successThreshold: 1
readinessProbe:
initialDelaySeconds: 30
periodSeconds: 10
timeoutSeconds: 5
failureThreshold: 6
successThreshold: 1
## Service configuration
##
service:
port: 3000
type: ClusterIP
## Specify the nodePort value for the LoadBalancer and NodePort service types.
## ref: https://kubernetes.io/docs/concepts/services-networking/service/#type-nodeport
##
# nodePort:
## Provide any additional annotations which may be required. This can be used to
## set the LoadBalancer service type to internal only.
## ref: https://kubernetes.io/docs/concepts/services-networking/service/#internal-load-balancer
##
annotations: {}
## loadBalancerIP for the PrestaShop Service (optional, cloud specific)
## ref: http://kubernetes.io/docs/user-guide/services/#type-loadbalancer
##
# loadBalancerIP:
## Configure the ingress resource that allows you to access the
## Grafana web. Set up the URL
## ref: http://kubernetes.io/docs/user-guide/ingress/
##
ingress:
## Set to true to enable ingress record generation
enabled: true
## Set this to true in order to add the corresponding annotations for cert-manager
certManager: false
## Ingress annotations done as key:value pairs
## For a full list of possible ingress annotations, please see
## ref: https://github.com/kubernetes/ingress-nginx/blob/master/docs/annotations.md
##
## If tls is set to true, annotation ingress.kubernetes.io/secure-backends: "true" will automatically be set
## If certManager is set to true, annotation kubernetes.io/tls-acme: "true" will automatically be set
# annotations:
# kubernetes.io/ingress.class: nginx
## The list of hostnames to be covered with this ingress record.
## Most likely this will be just one host, but in the event more hosts are needed, this is an array
hosts:
- host: grafana.local
paths: ["/"]
## The tls configuration for the ingress
## see: https://kubernetes.io/docs/concepts/services-networking/ingress/#tls
tls: []
# - secretName: chart-example-tls
# hosts:
# - chart-example.local
## SecurityContext configuration
##
securityContext:
enabled: true
runAsUser: 1001
fsGroup: 1001
runAsNonRoot: true
## Configure resource requests and limits
## ref: http://kubernetes.io/docs/user-guide/compute-resources/
## Example:
## resources:
## requests:
## memory: 512Mi
## cpu: 300m
##
# resources:
## Node labels for pod assignment
## Ref: https://kubernetes.io/docs/user-guide/node-selection/
##
nodeSelector: {}
## Tolerations for pod assignment
## Ref: https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/
##
tolerations: []
## Affinity for pod assignment
## Ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity
##
affinity: {}
## Pod annotations
## ref: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/
##
podAnnotations: {}
+273
View File
@@ -0,0 +1,273 @@
## Global Docker image parameters
## Please, note that this will override the image parameters, including dependencies, configured to use the global value
## Current available global Docker image parameters: imageRegistry, imagePullSecrets and storageClass
##
# global:
# imageRegistry: myRegistryName
# imagePullSecrets:
# - myRegistryKeySecretName
# storageClass: myStorageClass
## Bitnami Grafana image version
## ref: https://hub.docker.com/r/bitnami/grafana/tags/
##
image:
registry: docker.io
repository: bitnami/grafana
tag: 6.3.3-debian-9-r12
## Specify a imagePullPolicy
## Defaults to 'Always' if image tag is 'latest', else set to 'IfNotPresent'
## ref: http://kubernetes.io/docs/user-guide/images/#pre-pulling-images
##
pullPolicy: IfNotPresent
## Optionally specify an array of imagePullSecrets.
## Secrets must be manually created in the namespace.
## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/
##
# pullSecrets:
# - myRegistryKeySecretName
## String to partially override grafana.fullname template (will maintain the release name)
##
# nameOverride:
## String to fully override grafana.fullname template
##
# fullnameOverride:
## Number of grafana Pod replicas
##
replicaCount: 1
## Set up update strategy for Grafana installation. Set to Recreate if you use persistent volume that cannot be mounted by more than one pods to makesure the pods is destroyed first.
## ref: https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#strategy
## Example:
# updateStrategy:
# type: RollingUpdate
# rollingUpdate:
# maxSurge: 25%
# maxUnavailable: 25%
updateStrategy:
type: RollingUpdate
## Use an alternate scheduler, e.g. "stork".
## ref: https://kubernetes.io/docs/tasks/administer-cluster/configure-multiple-schedulers/
##
# schedulerName:
## Admin access configuration
## If a password is not provided a random password will be generated
##
admin:
user: "admin"
# password:
## SMTP configuration
## Use either a secret container the credentials or set the credentials through command line.
##
smtp:
enabled: false
# Provide credentials by command line
user: user
password: password
## Existing secret with SMTP credentials (user and password)
# existingSecret:
## User and password key on the existing secret ( "user" and "password" by default )
existingSecretUserKey: user
existingSecretPasswordKey: password
## Grafana plugins that will be installed
## Specify plugins as a list separated by commas ( you will need to scape them when specifying from command line )
## Example:
## plugins: grafana-kubernetes-app,grafana-example-app
##
# plugins:
## Ldap configuration for Grafana
##
ldap:
enabled: false
allowSignUp: false
## configMap with LDAP configuration file (ldap.toml)
# configMapName:
## An array to add extra env vars
## For example:
## extraEnvVars:
## - name: GF_DEFAULT_INSTANCE_NAME
## value: my-instance
##
# extraEnvVars:
## An array to add extra configmaps:
## For example:
## extraConfigmaps:
## - name: myconfigmap
## mountPath: /opt/bitnami/desired-path
## subPath: file-name.extension (optional)
## readOnly: true
## Parameters to override the default grafana.ini and custom.ini files.
## It is needed to create a configmap containing the grafana.ini and custom.ini files.
##
config:
useGrafanaIniFile: false
grafanaIniConfigMap:
useCustomIniFile: false
customIniConfigMap:
## Create dasboard provider to load dashboards, a default one is created to load
## dashboards from "/opt/bitnami/grafana/dashboards"
##
dashboardsProvider:
enabled: false
## ConfigMap with a custom provider file.
## Important to set the Path to "/opt/bitnami/grafana/dashboards"
configMapName:
## Create dashboards from a custom configMap that contains the file.
## They will be mounted by the default dashboard provider if it is enabled
## Use an array with the configMap names.
## Example:
## dashboardsConfigMaps:
## - configMapName: mydashboard
## fileName: mydashboard.json
## - configMapName: myotherdashboard
## fileName: myotherdashboard.json
##
dashboardsConfigMaps: []
## Create datasources from a custom secret
## The secret must contain the files
##
datasources:
secretName:
## Enable persistence using Persistent Volume Claims
## ref: http://kubernetes.io/docs/user-guide/persistent-volumes/
##
##
persistence:
enabled: true
## wordpress data Persistent Volume Storage Class
## If defined, storageClassName: <storageClass>
## If set to "-", storageClassName: "", which disables dynamic provisioning
## If undefined (the default) or set to null, no storageClassName spec is
## set, choosing the default provisioner. (gp2 on AWS, standard on
## GKE, AWS & OpenStack)
##
# storageClass: "-"
##
## If you want to reuse an existing claim, you can pass the name of the PVC using
## the existingClaim variable
# existingClaim: your-claim
accessMode: ReadWriteOnce
size: 10Gi
## Configure extra options for liveness and readiness probes
## ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/#configure-probes)
##
livenessProbe:
initialDelaySeconds: 120
periodSeconds: 10
timeoutSeconds: 5
failureThreshold: 6
successThreshold: 1
readinessProbe:
initialDelaySeconds: 30
periodSeconds: 10
timeoutSeconds: 5
failureThreshold: 6
successThreshold: 1
## Service configuration
##
service:
port: 3000
type: ClusterIP
## Specify the nodePort value for the LoadBalancer and NodePort service types.
## ref: https://kubernetes.io/docs/concepts/services-networking/service/#type-nodeport
##
# nodePort:
## Provide any additional annotations which may be required. This can be used to
## set the LoadBalancer service type to internal only.
## ref: https://kubernetes.io/docs/concepts/services-networking/service/#internal-load-balancer
##
annotations: {}
## loadBalancerIP for the PrestaShop Service (optional, cloud specific)
## ref: http://kubernetes.io/docs/user-guide/services/#type-loadbalancer
##
# loadBalancerIP:
## Configure the ingress resource that allows you to access the
## Grafana web. Set up the URL
## ref: http://kubernetes.io/docs/user-guide/ingress/
##
ingress:
## Set to true to enable ingress record generation
enabled: false
## Set this to true in order to add the corresponding annotations for cert-manager
certManager: false
## Ingress annotations done as key:value pairs
## For a full list of possible ingress annotations, please see
## ref: https://github.com/kubernetes/ingress-nginx/blob/master/docs/annotations.md
##
## If tls is set to true, annotation ingress.kubernetes.io/secure-backends: "true" will automatically be set
## If certManager is set to true, annotation kubernetes.io/tls-acme: "true" will automatically be set
# annotations:
# kubernetes.io/ingress.class: nginx
## The list of hostnames to be covered with this ingress record.
## Most likely this will be just one host, but in the event more hosts are needed, this is an array
hosts:
- host: grafana.local
paths: ["/"]
## The tls configuration for the ingress
## see: https://kubernetes.io/docs/concepts/services-networking/ingress/#tls
tls: []
# - secretName: chart-example-tls
# hosts:
# - chart-example.local
## SecurityContext configuration
##
securityContext:
enabled: true
runAsUser: 1001
fsGroup: 1001
runAsNonRoot: true
## Configure resource requests and limits
## ref: http://kubernetes.io/docs/user-guide/compute-resources/
## Example:
## resources:
## requests:
## memory: 512Mi
## cpu: 300m
##
# resources:
## Node labels for pod assignment
## Ref: https://kubernetes.io/docs/user-guide/node-selection/
##
nodeSelector: {}
## Tolerations for pod assignment
## Ref: https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/
##
tolerations: []
## Affinity for pod assignment
## Ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity
##
affinity: {}
## Pod annotations
## ref: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/
##
podAnnotations: {}