From 6d5c1b793c17e2963ba9955060ecd1747360da91 Mon Sep 17 00:00:00 2001 From: Sylvain Pasche <sylvain.pasche@gmail.com> Date: Sat, 11 Sep 2021 19:26:38 +0200 Subject: [PATCH] Always generate grafana-config secret Since https://github.com/brancz/kubernetes-grafana/pull/115, upstream grafana contains a non-empty config. Generate the grafana-config secret unconditionally even if no user config is passed. --- .../kube-prometheus/components/grafana.libsonnet | 3 +-- kustomization.yaml | 1 + manifests/grafana-config.yaml | 15 +++++++++++++++ 3 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 manifests/grafana-config.yaml diff --git a/jsonnet/kube-prometheus/components/grafana.libsonnet b/jsonnet/kube-prometheus/components/grafana.libsonnet index ce6cb40e..cf2c7ea2 100644 --- a/jsonnet/kube-prometheus/components/grafana.libsonnet +++ b/jsonnet/kube-prometheus/components/grafana.libsonnet @@ -68,8 +68,7 @@ function(params) { }, }, - // Add object only if user passes config and config is not empty - [if std.objectHas(params, 'config') && std.length(params.config) > 0 then 'config']: glib.grafana.config, + config: glib.grafana.config, service: glib.grafana.service, serviceAccount: glib.grafana.serviceAccount, deployment: glib.grafana.deployment, diff --git a/kustomization.yaml b/kustomization.yaml index 2f5b872e..ffea5b17 100644 --- a/kustomization.yaml +++ b/kustomization.yaml @@ -15,6 +15,7 @@ resources: - ./manifests/blackbox-exporter-service.yaml - ./manifests/blackbox-exporter-serviceAccount.yaml - ./manifests/blackbox-exporter-serviceMonitor.yaml +- ./manifests/grafana-config.yaml - ./manifests/grafana-dashboardDatasources.yaml - ./manifests/grafana-dashboardDefinitions.yaml - ./manifests/grafana-dashboardSources.yaml diff --git a/manifests/grafana-config.yaml b/manifests/grafana-config.yaml new file mode 100644 index 00000000..eeece25e --- /dev/null +++ b/manifests/grafana-config.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Secret +metadata: + labels: + app.kubernetes.io/component: grafana + app.kubernetes.io/name: grafana + app.kubernetes.io/part-of: kube-prometheus + app.kubernetes.io/version: 8.1.3 + name: grafana-config + namespace: monitoring +stringData: + grafana.ini: | + [date_formats] + default_timezone = UTC +type: Opaque -- GitLab