diff --git a/charts/kube-state-metrics-mixin/Chart.yaml b/charts/kube-state-metrics-mixin/Chart.yaml index e1242003..a6826b50 100644 --- a/charts/kube-state-metrics-mixin/Chart.yaml +++ b/charts/kube-state-metrics-mixin/Chart.yaml @@ -31,12 +31,12 @@ keywords: # 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: 1.2.0 +version: 1.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 # follow Semantic Versioning. They should reflect the version the application is using. -appVersion: 2.10.1 +appVersion: 2.13.0 maintainers: - name: nlamirault @@ -60,4 +60,4 @@ annotations: url: https://keybase.io/nlamirault/pgp_keys.asc artifacthub.io/changes: | - kind: changed - description: kube-state-metrics-mixin v2.10.1 + description: kube-state-metrics-mixin v2.13.0 diff --git a/charts/kube-state-metrics-mixin/templates/alerts.yaml b/charts/kube-state-metrics-mixin/templates/alerts.yaml index 91a4b4e8..e256a7fb 100644 --- a/charts/kube-state-metrics-mixin/templates/alerts.yaml +++ b/charts/kube-state-metrics-mixin/templates/alerts.yaml @@ -1,3 +1,4 @@ +{{ if .Values.monitor.enabled -}} --- apiVersion: monitoring.coreos.com/v1 kind: PrometheusRule @@ -8,6 +9,7 @@ metadata: {{- include "kube-state-metrics-mixin.annotations" . | indent 4 }} labels: {{- include "kube-state-metrics-mixin.labels" . | indent 4 }} + app.kubernetes.io/component: metrics {{- if .Values.monitor.additionalLabels }} {{- toYaml .Values.monitor.additionalLabels | nindent 4 }} {{- end }} @@ -60,3 +62,4 @@ spec: for: 15m labels: severity: critical +{{- end }} diff --git a/charts/kube-state-metrics-mixin/templates/configmap-dashboards.yaml b/charts/kube-state-metrics-mixin/templates/configmap-dashboards.yaml index c44e6e09..35b1b5db 100644 --- a/charts/kube-state-metrics-mixin/templates/configmap-dashboards.yaml +++ b/charts/kube-state-metrics-mixin/templates/configmap-dashboards.yaml @@ -1,24 +1,50 @@ ---- +{{ if .Values.grafanaDashboard.enabled -}} {{- $files := .Files.Glob "dashboards/*.json" }} {{- if $files }} +--- apiVersion: v1 kind: ConfigMapList items: {{- range $path, $fileContents := $files }} -{{- $dashboardName := regexReplaceAll "(^.*/)(.*)\\.json$" $path "${2}" }} +{{- $dashboardName := regexReplaceAll "(^.*/)(.*)\\.json$" $path "${2}" | lower }} - apiVersion: v1 kind: ConfigMap metadata: - name: {{ printf "dashboard-kube-state-metrics-mixin-%s" $dashboardName | trunc 63 | trimSuffix "-" }} - namespace: {{ include "kube-state-metrics-mixin.namespace" $ }} annotations: - grafana-folder: {{ $.Values.grafana.folder }} + grafana-folder: {{ $.Values.grafanaDashboard.folder }} {{- include "kube-state-metrics-mixin.annotations" $ | indent 6 }} labels: grafana-dashboard: {{ $dashboardName }} {{- include "kube-state-metrics-mixin.labels" $ | indent 6 }} + app.kubernetes.io/component: dashboard + name: {{ printf "dashboard-%s" $dashboardName | trunc 63 | trimSuffix "-" }} + namespace: {{ include "kube-state-metrics-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 "kube-state-metrics-mixin.labels" $ | indent 4 }} + app.kubernetes.io/component: dashboard + 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 }}