Skip to content

Commit

Permalink
feat(metrics): Add new datasource to kumactl install metrics
Browse files Browse the repository at this point in the history
This adds the plugin to grafana and add a new panel in the mesh dashboard

Signed-off-by: Charly Molter <charly.molter@konghq.com>
  • Loading branch information
lahabana committed Aug 23, 2021
1 parent 73c454e commit 44ce14a
Show file tree
Hide file tree
Showing 3 changed files with 103 additions and 56 deletions.
2 changes: 2 additions & 0 deletions app/kumactl/cmd/install/context/install_metrics_context.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ type MetricsTemplateArgs struct {
KumaPrometheusSdImage string
KumaPrometheusSdVersion string
KumaCpAddress string
KumaCpApiAddress string
WithoutPrometheus bool
WithoutGrafana bool
Dashboards []Dashboard
Expand All @@ -29,6 +30,7 @@ func DefaultInstallMetricsContext() InstallMetricsContext {
KumaPrometheusSdImage: "docker.io/kumahq/kuma-prometheus-sd",
KumaPrometheusSdVersion: kuma_version.Build.GitTag,
KumaCpAddress: "grpc://kuma-control-plane.kuma-system:5676",
KumaCpApiAddress: "http://kuma-control-plane.kuma-system:5681",
WithoutPrometheus: false,
WithoutGrafana: false,
},
Expand Down
21 changes: 20 additions & 1 deletion app/kumactl/data/install/k8s/metrics/grafana/grafana.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ data:
logs = /var/log/grafana
plugins = /var/lib/grafana/plugins
provisioning = /etc/grafana/provisioning
[plugins]
allow_loading_unsigned_plugins = "kumahq-kuma-datasource"
---
apiVersion: v1
kind: ConfigMap
Expand Down Expand Up @@ -128,6 +130,11 @@ data:
version: 1
# <bool> allow users to edit datasources from the UI.
editable: true
- name: Kuma
type: kumahq-kuma-datasource
url: {{.KumaCpApiAddress}}
jsonData:
prometheusDataSourceId: "1"
---
apiVersion: v1
kind: ConfigMap
Expand Down Expand Up @@ -269,9 +276,16 @@ spec:
securityContext:
fsGroup: 472
runAsUser: 472
initContainers:
- name: init-plugins
image: alpine
command: [ '/bin/sh', '-c', 'wget -O /tmp/kuma.zip https://github.com/kumahq/kuma-grafana-datasource/releases/download/v0.0.2/kumahq-kuma-datasource-0.0.2.zip && unzip /tmp/kuma.zip -d /var/lib/grafana/plugins/ && rm /tmp/kuma.zip']
volumeMounts:
- name: plugins-volume
mountPath: /var/lib/grafana/plugins
containers:
- name: grafana
image: "grafana/grafana:7.5.8"
image: "grafana/grafana:8.1.2"
imagePullPolicy: IfNotPresent
volumeMounts:
- name: config
Expand All @@ -286,6 +300,9 @@ spec:
- name: provisioning-dashboards
mountPath: /etc/grafana/provisioning/dashboards
readOnly: true
- name: plugins-volume
mountPath: /var/lib/grafana/plugins
readOnly: true
ports:
- name: service
containerPort: 80
Expand Down Expand Up @@ -324,3 +341,5 @@ spec:
{{ end }}
- name: storage
emptyDir: {}
- name: plugins-volume
emptyDir: {}
Loading

0 comments on commit 44ce14a

Please sign in to comment.