From 9c31c9279549f1569b6c6b11326742799bf271ae Mon Sep 17 00:00:00 2001 From: Matheus Sousa <73663610+MateSousa@users.noreply.github.com> Date: Thu, 29 Jun 2023 13:44:47 -0300 Subject: [PATCH] feat(operator): add namespace to grafanaDashboard (#168) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 🚀 feat(operator): add namespace to grafanaDashboard The `namespace` field has been added to the `grafanaDashboard` section of the `values.yaml` file. This allows the Grafana dashboard to be deployed to a specific namespace, which improves organization and separation of concerns. Signed-off-by: MateSousa * 🚀 feat(grafana-k8sgpt-dashboard.yaml): add namespace field to metadata The namespace field is added to the metadata section of the Grafana dashboard YAML file. This allows the dashboard to be created in the specified namespace, which improves organization and management of the dashboard. Signed-off-by: MateSousa * 🚀 feat(grafana-k8sgpt-dashboard.yaml): add namespaceSelector to k8sgpt-overview dashboard The namespaceSelector is added to the k8sgpt-overview dashboard to allow it to be displayed in the namespace specified in the values.yaml file. This improves the flexibility of the dashboard as it can now be displayed in any namespace specified in the values.yaml file. Signed-off-by: MateSousa * 🔧 chore(operator): remove unnecessary namespace field from grafanaDashboard in values.yaml The namespace field in the grafanaDashboard section of the values.yaml file is not needed as it is commented out and has no value. Removing it improves the readability of the file. Signed-off-by: MateSousa * 🔧 chore(grafana-k8sgpt-dashboard.yaml): simplify namespace configuration The namespace configuration for the Grafana dashboard has been simplified by removing the unnecessary namespaceSelector block. Instead, the namespace is directly set using the .Values.grafanaDashboard.namespace value, falling back to the default namespace if not provided. This change improves readability and reduces complexity in the configuration file. Signed-off-by: MateSousa --------- Signed-off-by: MateSousa Co-authored-by: Alex Jones --- chart/operator/templates/grafana-k8sgpt-dashboard.yaml | 1 + chart/operator/values.yaml | 2 ++ 2 files changed, 3 insertions(+) diff --git a/chart/operator/templates/grafana-k8sgpt-dashboard.yaml b/chart/operator/templates/grafana-k8sgpt-dashboard.yaml index 1580301d..bbad48c9 100644 --- a/chart/operator/templates/grafana-k8sgpt-dashboard.yaml +++ b/chart/operator/templates/grafana-k8sgpt-dashboard.yaml @@ -11,6 +11,7 @@ metadata: app.kubernetes.io/part-of: k8sgpt-operator {{- include "chart.labels" . | nindent 4 }} name: k8sgpt-overview + namespace: {{ .Values.grafanaDashboard.namespace | default (include "k8sgpt-operator.namespace" .) }} data: k8sgpt-overview.json: | {{ .Files.Get "dashboards/k8sgpt-overview.json" | indent 4}} diff --git a/chart/operator/values.yaml b/chart/operator/values.yaml index c30f5db4..ed2f2170 100644 --- a/chart/operator/values.yaml +++ b/chart/operator/values.yaml @@ -5,6 +5,8 @@ serviceMonitor: # namespace: "" grafanaDashboard: enabled: false + # The namespace where Grafana expects to find the dashboard + # namespace: "" folder: annotation: grafana_folder name: ai