From 4d20b366e7697cf58411832393abe1aee99c5998 Mon Sep 17 00:00:00 2001
From: Dhi Aurrahman <dio@rockybars.com>
Date: Tue, 27 Feb 2024 20:38:19 +0700
Subject: [PATCH] istio-monitoring-demo: Add prometheus as default datasource

Signed-off-by: Dhi Aurrahman <dio@rockybars.com>
---
 charts/demos/istio-monitoring-demo/Chart.yaml          |  2 +-
 charts/demos/istio-monitoring-demo/README.md           |  8 +++++++-
 charts/demos/istio-monitoring-demo/templates/NOTES.txt |  2 +-
 charts/demos/istio-monitoring-demo/values.yaml         | 10 ++++++++++
 4 files changed, 19 insertions(+), 3 deletions(-)

diff --git a/charts/demos/istio-monitoring-demo/Chart.yaml b/charts/demos/istio-monitoring-demo/Chart.yaml
index 833e0926..786ea823 100644
--- a/charts/demos/istio-monitoring-demo/Chart.yaml
+++ b/charts/demos/istio-monitoring-demo/Chart.yaml
@@ -15,7 +15,7 @@ type: application
 # This is the chart version. This version number should be incremented each time you make changes
 # to the chart and its templates, including the app version.
 # Versions are expected to follow Semantic Versioning (https://semver.org/)
-version: 0.2.0
+version: 0.3.0
 
 # This is the version number of the application being deployed. This version number should be
 # incremented each time you make changes to the application. Versions are not expected to
diff --git a/charts/demos/istio-monitoring-demo/README.md b/charts/demos/istio-monitoring-demo/README.md
index 0f8c5481..20e173b3 100644
--- a/charts/demos/istio-monitoring-demo/README.md
+++ b/charts/demos/istio-monitoring-demo/README.md
@@ -1,6 +1,6 @@
 # istio-monitoring-demo
 
-![Version: 0.2.0](https://img.shields.io/badge/Version-0.2.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: v0.1.0](https://img.shields.io/badge/AppVersion-v0.1.0-informational?style=flat-square)
+![Version: 0.3.0](https://img.shields.io/badge/Version-0.3.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: v0.1.0](https://img.shields.io/badge/AppVersion-v0.1.0-informational?style=flat-square)
 
 Helm chart for deploying Istio Monitoring demo
 
@@ -17,6 +17,12 @@ Helm chart for deploying Istio Monitoring demo
 | Key | Type | Default | Description |
 |-----|------|---------|-------------|
 | grafana.admin.existingSecret | string | `""` |  |
+| grafana.datasources."datasources.yaml".apiVersion | int | `1` |  |
+| grafana.datasources."datasources.yaml".datasources[0].access | string | `"proxy"` |  |
+| grafana.datasources."datasources.yaml".datasources[0].isDefault | bool | `true` |  |
+| grafana.datasources."datasources.yaml".datasources[0].name | string | `"Prometheus"` |  |
+| grafana.datasources."datasources.yaml".datasources[0].type | string | `"prometheus"` |  |
+| grafana.datasources."datasources.yaml".datasources[0].url | string | `"http://prometheus:9090"` |  |
 | grafana.enabled | bool | `true` |  |
 | grafana.env.GF_AUTH_ANONYMOUS_ENABLED | string | `"true"` |  |
 | grafana.env.GF_AUTH_ANONYMOUS_ORG_ROLE | string | `"Admin"` |  |
diff --git a/charts/demos/istio-monitoring-demo/templates/NOTES.txt b/charts/demos/istio-monitoring-demo/templates/NOTES.txt
index c547d99c..fcdfdb6d 100644
--- a/charts/demos/istio-monitoring-demo/templates/NOTES.txt
+++ b/charts/demos/istio-monitoring-demo/templates/NOTES.txt
@@ -5,7 +5,7 @@ To learn more about the release, try:
   $ helm get all {{ .Release.Name }}
 
 {{ if .Values.grafana.enabled }}
-Running these commands in the shell to make Grafana avaiable to access on localhost:3000:
+Running these commands in the shell to make Grafana available to access on localhost:3000:
 
   $ kubectl --namespace {{ .Release.Namespace }} port-forward svc/grafana 3000:3000
 {{ end }}
diff --git a/charts/demos/istio-monitoring-demo/values.yaml b/charts/demos/istio-monitoring-demo/values.yaml
index df5687a5..9429fc2d 100644
--- a/charts/demos/istio-monitoring-demo/values.yaml
+++ b/charts/demos/istio-monitoring-demo/values.yaml
@@ -31,6 +31,16 @@ grafana:
   service:
     port: 3000
 
+  datasources:
+    datasources.yaml:
+      apiVersion: 1
+      datasources:
+      - name: Prometheus
+        type: prometheus
+        access: proxy
+        isDefault: true
+        url: http://prometheus:9090
+
 prometheus:
   enabled: true
   # To simplify the deployment, disable non-essential components