diff --git a/charts/alloy-mixin/Chart.yaml b/charts/alloy-mixin/Chart.yaml index e1e05a78..a6627d5d 100644 --- a/charts/alloy-mixin/Chart.yaml +++ b/charts/alloy-mixin/Chart.yaml @@ -29,7 +29,7 @@ keywords: - prometheus - monitoring-mixin - portefaix -version: 0.1.0 +version: 0.2.0 appVersion: 1.0.0 maintainers: diff --git a/charts/alloy-mixin/README.md b/charts/alloy-mixin/README.md index 7987f7cc..c1a5e14b 100644 --- a/charts/alloy-mixin/README.md +++ b/charts/alloy-mixin/README.md @@ -1,6 +1,6 @@ # alloy-mixin -![Version: 0.1.0](https://img.shields.io/badge/Version-0.1.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 1.0.0](https://img.shields.io/badge/AppVersion-1.0.0-informational?style=flat-square) +![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: 1.0.0](https://img.shields.io/badge/AppVersion-1.0.0-informational?style=flat-square) A Helm chart for Alloy mixin @@ -23,7 +23,11 @@ A Helm chart for Alloy mixin | additionalAnnotations | object | `{}` | Additional annotations to add to all resources | | additionalLabels | object | `{}` | Additional labels to add to all resources | | fullnameOverride | string | `""` | Provide a name to substitute for the full names of resources | -| grafana.folder | string | `"opentelemetry"` | Grafana folder in which to store the dashboards | +| grafanaDashboard.enabled | bool | `true` | | +| grafanaDashboard.folder | string | `"opentelemetry"` | Grafana folder in which to store the dashboards | +| grafanaDashboard.grafanaOperator.allowCrossNamespaceImport | bool | `true` | | +| grafanaDashboard.grafanaOperator.enabled | bool | `false` | | +| grafanaDashboard.grafanaOperator.matchLabels | object | `{}` | Selected labels for Grafana instance | | monitor.additionalLabels | object | `{}` | Additional labels to add to resources managed by the Prometheus Operator | ---------------------------------------------- diff --git a/charts/alloy-mixin/templates/configmap-dashboards.yaml b/charts/alloy-mixin/templates/configmap-dashboards.yaml index 0a49e225..cc0efede 100644 --- a/charts/alloy-mixin/templates/configmap-dashboards.yaml +++ b/charts/alloy-mixin/templates/configmap-dashboards.yaml @@ -14,9 +14,10 @@ # # SPDX-License-Identifier: Apache-2.0 ---- +{{ if .Values.grafanaDashboard.enabled -}} {{- $files := .Files.Glob "dashboards/*.json" }} {{- if $files }} +--- apiVersion: v1 kind: ConfigMapList items: @@ -25,15 +26,38 @@ items: - apiVersion: v1 kind: ConfigMap metadata: - name: {{ printf "dashboard-%s" $dashboardName | trunc 63 | trimSuffix "-" }} - namespace: {{ include "alloy-mixin.namespace" $ }} annotations: - grafana-folder: {{ $.Values.grafana.folder }} + grafana-folder: {{ $.Values.grafanaDashboard.folder }} labels: grafana-dashboard: {{ $dashboardName }} {{- include "alloy-mixin.labels" $ | indent 6 }} + name: {{ printf "dashboard-%s" $dashboardName | trunc 63 | trimSuffix "-" }} + namespace: {{ include "alloy-mixin.namespace" $ }} data: {{ $dashboardName }}.json: |- {{ $.Files.Get $path | indent 6}} {{- end }} +{{ if $.Values.grafanaDashboard.grafanaOperator.enabled -}} +{{- range $path, $fileContents := $files }} +{{- $dashboardName := regexReplaceAll "(^.*/)(.*)\\.json$" $path "${2}" }} +--- +apiVersion: grafana.integreatly.org/v1beta1 +kind: GrafanaDashboard +metadata: + labels: + {{- include "alloy-mixin.labels" $ | indent 4 }} + name: {{ printf "%s" $dashboardName | trunc 63 | trimSuffix "-" | lower }} + namespace: {{ $.Release.Namespace }} +spec: + allowCrossNamespaceImport: {{ $.Values.grafanaDashboard.grafanaOperator.allowCrossNamespaceImport }} + folder: {{ $.Values.grafanaDashboard.folder }} + instanceSelector: + matchLabels: + {{- toYaml $.Values.grafanaDashboard.grafanaOperator.matchLabels | nindent 6 }} + configMapRef: + name: {{ printf "dashboard-%s" $dashboardName | trunc 63 | trimSuffix "-" }} + key: {{ $dashboardName }}.json +{{- end }} +{{- end }} +{{- end }} {{- end }} diff --git a/charts/alloy-mixin/values.yaml b/charts/alloy-mixin/values.yaml index 632cf49d..6f23ea35 100644 --- a/charts/alloy-mixin/values.yaml +++ b/charts/alloy-mixin/values.yaml @@ -35,6 +35,12 @@ monitor: additionalLabels: {} # release: kube-prometheus-stack -grafana: +grafanaDashboard: + enabled: true # -- Grafana folder in which to store the dashboards folder: opentelemetry + grafanaOperator: + enabled: false + allowCrossNamespaceImport: true + # -- Selected labels for Grafana instance + matchLabels: {}