Perform some minor improvements on grafana

This commit is contained in:
miguelaeh
2019-09-05 13:56:12 +02:00
parent 63f1ef75b1
commit dac97fd4d7
10 changed files with 74 additions and 75 deletions
+11 -8
View File
@@ -1,5 +1,7 @@
** 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 }}
@@ -7,21 +9,22 @@
{{- 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
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 }}
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 }}
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 password:
echo Password: $(kubectl get secret {{ include "grafana.fullname" . }}-secret -o jsonpath="{.data.GF_SECURITY_ADMIN_PASSWORD}" | base64 --decode)
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:")) }}
+18
View File
@@ -6,6 +6,24 @@ Expand the name of the chart.
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- 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).
+1 -5
View File
@@ -2,11 +2,7 @@ apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "grafana.fullname" . }}-envvars
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 }}
labels: {{ include "grafana.labels" . | nindent 4 }}
data:
GF_SECURITY_ADMIN_USER: {{ .Values.admin.user | quote }}
{{- if .Values.plugins }}
@@ -3,11 +3,7 @@ apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "grafana.fullname" . }}-provider
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 }}
labels: {{ include "grafana.labels" . | nindent 4 }}
data:
default-provider.yaml: |-
apiVersion: 1
+14 -20
View File
@@ -2,17 +2,11 @@ apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "grafana.fullname" . }}
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 }}
labels: {{ include "grafana.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
app.kubernetes.io/name: {{ include "grafana.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
matchLabels: {{ include "grafana.matchLabels" . | nindent 6 }}
{{- if .Values.updateStrategy }}
strategy: {{ toYaml .Values.updateStrategy | nindent 4 }}
{{- end }}
@@ -39,6 +33,18 @@ spec:
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: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
@@ -159,15 +165,3 @@ spec:
configMap:
name: {{ .name }}
{{- 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 }}
+1 -5
View File
@@ -3,11 +3,7 @@ apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: {{ include "grafana.fullname" . }}
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 }}
labels: {{ include "grafana.labels" . | nindent 4 }}
{{- with .Values.ingress.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
+1 -5
View File
@@ -3,11 +3,7 @@ kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: {{ template "grafana.fullname" . }}
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 }}
labels: {{ include "grafana.labels" . | nindent 4 }}
spec:
accessModes:
- {{ .Values.persistence.accessMode | quote }}
+4 -8
View File
@@ -2,21 +2,17 @@ apiVersion: v1
kind: Secret
metadata:
name: {{ template "grafana.fullname" . }}-secret
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 }}
labels: {{ include "grafana.labels" . | nindent 4 }}
type: Opaque
data:
{{- if .Values.admin.password }}
GF_SECURITY_ADMIN_PASSWORD: {{ .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 }}
GF_SMTP_PASSWORD: {{ .Values.smtp.password }}
GF_SMTP_USER: {{ .Values.smtp.user | b64enc | quote }}
GF_SMTP_PASSWORD: {{ .Values.smtp.password | b64enc | quote }}
{{- end }}
{{- end }}
+2 -8
View File
@@ -2,11 +2,7 @@ apiVersion: v1
kind: Service
metadata:
name: {{ include "grafana.fullname" . }}
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 }}
labels: {{ include "grafana.labels" . | nindent 4 }}
{{- if .Values.service.annotations }}
annotations: {{ toYaml .Values.service.annotations | nindent 4 }}
{{- end }}
@@ -23,6 +19,4 @@ spec:
{{- if .Values.service.nodePort }}
nodePort: {{ .Values.service.nodePort }}
{{- end }}
selector:
app.kubernetes.io/name: {{ include "grafana.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
selector: {{ include "grafana.matchLabels" . | nindent 4 }}
+21 -11
View File
@@ -35,17 +35,18 @@ image:
##
# fullnameOverride:
# Number of grafana Pod replicas
## 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
# rollingUpdate:
# maxSurge: 25%
# maxUnavailable: 25%
updateStrategy:
type: RollingUpdate
@@ -56,13 +57,14 @@ updateStrategy:
## 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
@@ -105,6 +107,7 @@ ldap:
## 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:
@@ -113,6 +116,7 @@ config:
## 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.
@@ -126,16 +130,19 @@ dashboardsProvider:
## dashboardsConfigMaps:
## - mydashboard
## - myotherdashboard
##
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
@@ -155,6 +162,7 @@ persistence:
## 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
@@ -168,7 +176,8 @@ readinessProbe:
failureThreshold: 6
successThreshold: 1
# Service configuration
## Service configuration
##
service:
port: 3000
type: ClusterIP
@@ -188,7 +197,8 @@ service:
##
# loadBalancerIP:
# Ingress configuration
## Ingress configuration
##
ingress:
enabled: false
annotations: {}
@@ -203,8 +213,8 @@ ingress:
# hosts:
# - chart-example.local
# SecurityContext configuration
## SecurityContext configuration
##
securityContext:
enabled: true
runAsUser: 1001