Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use grafana provisioning to replace dashboard installer #388

Merged
merged 17 commits into from
Apr 15, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions charts/tidb-cluster/templates/config/_grafana-dashboard.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"apiVersion": 1,
"providers": [
{
"folder": "",
"name": "0",
"options": {
"path": "/grafana-dashboard-definitions/tidb"
},
"orgId": 1,
"type": "file"
}
]
}
14 changes: 14 additions & 0 deletions charts/tidb-cluster/templates/config/_grafana-datasource.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"apiVersion": 1,
"datasources": [
{
"access": "proxy",
"editable": false,
"name": "tidb-cluster",
"orgId": 1,
"type": "prometheus",
"url": "http://127.0.0.1:9090",
"version": 1
}
]
}
5 changes: 4 additions & 1 deletion charts/tidb-cluster/templates/monitor-configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,13 @@ metadata:
data:
prometheus-config: |-
{{ tuple "config/_prometheus-config.tpl" . | include "helm-toolkit.utils.template" | indent 4 }}

alert-rules-config: |-
{{ tuple "config/_alert-rules-config.tpl" . | include "helm-toolkit.utils.template" | indent 4 }}
{{- if .Values.monitor.grafana.create }}
datasource-config: |-
{{ tuple "config/_grafana-datasource.tpl" . | include "helm-toolkit.utils.template" | indent 4 }}
dashboard-config: |-
{{ tuple "config/_grafana-dashboard.tpl" . | include "helm-toolkit.utils.template" | indent 4 }}
grafana-config: |-
{{ tuple "config/_grafana-config.tpl" . | include "helm-toolkit.utils.template" | indent 4 }}
{{- end }}
Expand Down
35 changes: 35 additions & 0 deletions charts/tidb-cluster/templates/monitor-dashboard-configmap.yaml

Large diffs are not rendered by default.

40 changes: 40 additions & 0 deletions charts/tidb-cluster/templates/monitor-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,17 @@ spec:
- name: grafana
image: {{ .Values.monitor.grafana.image }}
imagePullPolicy: {{ .Values.monitor.grafana.imagePullPolicy | default "IfNotPresent" }}
lifecycle:
postStart:
aylei marked this conversation as resolved.
Show resolved Hide resolved
exec:
command:
- "/bin/sh"
- "-c"
- >
gzip -dc /tmp/dashboard-gz/tidb.json.gz > /grafana-dashboard-definitions/tidb/tidb.json &&
gzip -dc /tmp/dashboard-gz/pd.json.gz > /grafana-dashboard-definitions/tidb/pd.json &&
gzip -dc /tmp/dashboard-gz/tikv.json.gz > /grafana-dashboard-definitions/tidb/tikv.json &&
gzip -dc /tmp/dashboard-gz/overview.json.gz > /grafana-dashboard-definitions/tidb/overview.json
{{- if .Values.monitor.grafana.resources }}
resources:
{{ toYaml .Values.monitor.grafana.resources | indent 12 }}
Expand Down Expand Up @@ -136,6 +147,18 @@ spec:
# mountPath: /etc/grafana
- name: monitor-data
mountPath: /data
- mountPath: /etc/grafana/provisioning/datasources
name: datasource
readOnly: false
- mountPath: /etc/grafana/provisioning/dashboards
name: dashboards-provisioning
readOnly: false
- mountPath: /tmp/dashboard-gz
name: dashboard-gz
readOnly: false
- mountPath: /grafana-dashboard-definitions/tidb
name: grafana-dashboard
readOnly: false
{{- end }}
volumes:
- name: monitor-data
Expand All @@ -160,6 +183,23 @@ spec:
items:
- key: grafana-config
path: grafana.ini
- configMap:
name: {{ template "cluster.name" . }}-monitor
items:
- key: datasource-config
path: datasource.yaml
name: datasource
- configMap:
name: {{ template "cluster.name" . }}-monitor
items:
- key: dashboard-config
path: dashboards.yaml
name: dashboards-provisioning
- emptyDir: {}
name: grafana-dashboard
- configMap:
name: {{ template "cluster.name" . }}-monitor-dashboard
name: dashboard-gz
{{- end }}
{{- if .Values.monitor.tolerations }}
tolerations:
Expand Down
38 changes: 0 additions & 38 deletions charts/tidb-cluster/templates/monitor-job.yaml

This file was deleted.

5 changes: 1 addition & 4 deletions charts/tidb-cluster/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -207,12 +207,9 @@ monitor:
persistent: false
storageClassName: local-storage
storage: 10Gi
dashboardInstaller:
image: pingcap/tidb-dashboard-installer:v2.0.0
imagePullPolicy: IfNotPresent
grafana:
create: true
image: grafana/grafana:4.6.5
image: grafana/grafana:6.0.1
imagePullPolicy: IfNotPresent
logLevel: info
resources:
Expand Down