diff --git a/templates/ClusterRole-grafana-SideCar.yaml b/templates/ClusterRole-grafana-SideCar.yaml index ceeb030..b5ad7eb 100644 --- a/templates/ClusterRole-grafana-SideCar.yaml +++ b/templates/ClusterRole-grafana-SideCar.yaml @@ -1,3 +1,4 @@ +{{ if .Values.nfc_monitoring.grafana.enabled -}} {{ if .Values.nfc_monitoring.additions.dashboard_sidecar.enabled -}} --- apiVersion: rbac.authorization.k8s.io/v1 @@ -14,3 +15,4 @@ rules: resources: ["configmaps"] verbs: ["get", "watch", "list"] {{- end }} +{{- end }} diff --git a/templates/ClusterRoleBinding-Grafana-SideCar.yaml b/templates/ClusterRoleBinding-Grafana-SideCar.yaml index 00032cc..81dacb8 100644 --- a/templates/ClusterRoleBinding-Grafana-SideCar.yaml +++ b/templates/ClusterRoleBinding-Grafana-SideCar.yaml @@ -1,3 +1,4 @@ +{{ if .Values.nfc_monitoring.grafana.enabled -}} {{ if .Values.nfc_monitoring.additions.dashboard_sidecar.enabled -}} --- kind: ClusterRoleBinding @@ -18,3 +19,4 @@ subjects: name: grafana namespace: "{{ .Values.nfc_monitoring.grafana.namespace }}" {{- end }} +{{- end }} diff --git a/templates/ConfigMap-Grafana.yaml b/templates/ConfigMap-Grafana.yaml index cf9f04d..95f5a1e 100644 --- a/templates/ConfigMap-Grafana.yaml +++ b/templates/ConfigMap-Grafana.yaml @@ -1,3 +1,4 @@ +{{ if .Values.nfc_monitoring.grafana.enabled -}} --- apiVersion: v1 kind: ConfigMap @@ -123,4 +124,4 @@ data: } } ---- \ No newline at end of file +{{- end }} diff --git a/templates/ConfigMap-GrafanaProvisioning.yaml b/templates/ConfigMap-GrafanaProvisioning.yaml index 5f987d6..e1e7ad7 100644 --- a/templates/ConfigMap-GrafanaProvisioning.yaml +++ b/templates/ConfigMap-GrafanaProvisioning.yaml @@ -1,3 +1,4 @@ +{{ if .Values.nfc_monitoring.grafana.enabled -}} {{ if .Values.nfc_monitoring.additions.dashboard_sidecar.enabled -}} --- # Provisioning config @@ -27,3 +28,4 @@ data: path: /var/lib/grafana/dashboards foldersFromFilesStructure: true {{- end }} +{{- end }} diff --git a/templates/Grafana-Grafana.yaml b/templates/Grafana-Grafana.yaml index 257a3d2..8cd4983 100644 --- a/templates/Grafana-Grafana.yaml +++ b/templates/Grafana-Grafana.yaml @@ -1,4 +1,5 @@ --- +{{ if .Values.nfc_monitoring.grafana.enabled -}} apiVersion: grafana.integreatly.org/v1beta1 kind: Grafana metadata: @@ -147,3 +148,5 @@ spec: resources: requests: storage: "5Gi" + +{{- end }} diff --git a/templates/GrafanaDashboard-AlertManager.yaml b/templates/GrafanaDashboard-AlertManager.yaml index cc9ef9e..c7207e1 100644 --- a/templates/GrafanaDashboard-AlertManager.yaml +++ b/templates/GrafanaDashboard-AlertManager.yaml @@ -1,3 +1,4 @@ +{{ if .Values.nfc_monitoring.grafana.enabled -}} --- apiVersion: grafana.integreatly.org/v1beta1 kind: GrafanaDashboard @@ -15,4 +16,6 @@ spec: app.kubernetes.io/name: grafana grafanaCom: id: 9578 - revision: 4 # as @ 19-09-23 \ No newline at end of file + revision: 4 # as @ 19-09-23 + +{{- end }} diff --git a/templates/GrafanaDashboard-Ceph.yaml b/templates/GrafanaDashboard-Ceph.yaml index 38d735d..462244e 100644 --- a/templates/GrafanaDashboard-Ceph.yaml +++ b/templates/GrafanaDashboard-Ceph.yaml @@ -1,3 +1,4 @@ +{{ if .Values.nfc_monitoring.grafana.enabled -}} --- {{- if .Values.nfc_monitoring.additions.ceph.enabled | default false -}} apiVersion: grafana.integreatly.org/v1beta1 @@ -18,4 +19,5 @@ spec: id: 2842 revision: 17 # as @ 19-09-23 -{{- end -}} \ No newline at end of file +{{- end -}} +{{- end }} \ No newline at end of file diff --git a/templates/GrafanaDashboard-cluster-summary.yaml b/templates/GrafanaDashboard-cluster-summary.yaml index 2cfcf66..9fb41fb 100644 --- a/templates/GrafanaDashboard-cluster-summary.yaml +++ b/templates/GrafanaDashboard-cluster-summary.yaml @@ -1,4 +1,5 @@ --- +{{ if .Values.nfc_monitoring.grafana.enabled -}} apiVersion: grafana.integreatly.org/v1beta1 kind: GrafanaDashboard metadata: @@ -17,3 +18,4 @@ spec: json: >- {{ $Dashboard | toRawJson }} +{{- end }} diff --git a/templates/GrafanaDashboard-node-exporter-full.yaml b/templates/GrafanaDashboard-node-exporter-full.yaml index b5b9abe..2337958 100644 --- a/templates/GrafanaDashboard-node-exporter-full.yaml +++ b/templates/GrafanaDashboard-node-exporter-full.yaml @@ -1,4 +1,5 @@ --- +{{ if .Values.nfc_monitoring.grafana.enabled -}} apiVersion: grafana.integreatly.org/v1beta1 kind: GrafanaDashboard metadata: @@ -15,4 +16,6 @@ spec: app.kubernetes.io/name: grafana grafanaCom: id: 1860 - revision: 32 # as @ 19-09-23 \ No newline at end of file + revision: 32 # as @ 19-09-23 + +{{- end }} diff --git a/templates/GrafanaDatasources.yaml b/templates/GrafanaDatasources.yaml index 18a365d..5405a93 100644 --- a/templates/GrafanaDatasources.yaml +++ b/templates/GrafanaDatasources.yaml @@ -1,4 +1,5 @@ --- +{{ if .Values.nfc_monitoring.grafana.enabled -}} apiVersion: grafana.integreatly.org/v1beta1 kind: GrafanaDatasourceList items: @@ -24,3 +25,4 @@ items: {{ toYaml . | nindent 8 }} {{ end }} +{{- end }} diff --git a/templates/Ingress-Multi.yaml b/templates/Ingress-Multi.yaml index a1a1f97..cbe93ca 100644 --- a/templates/Ingress-Multi.yaml +++ b/templates/Ingress-Multi.yaml @@ -12,7 +12,8 @@ spec: {{ end }} -{{ if .Values.nfc_monitoring.grafana.ingress.enabled | default "false" -}} +{{ if .Values.nfc_monitoring.grafana.enabled -}} +{{ if .Values.nfc_monitoring.grafana.ingress.enabled -}} --- apiVersion: networking.k8s.io/v1 kind: Ingress @@ -25,6 +26,7 @@ spec: {{ toYaml $.Values.nfc_monitoring.grafana.ingress.spec | nindent 2 }} {{ end }} +{{ end }} {{ if .Values.nfc_monitoring.prometheus.ingress.enabled | default "false" -}} --- diff --git a/templates/PrometheusRule-grafana.yaml b/templates/PrometheusRule-grafana.yaml index f615bc3..3b3da9a 100644 --- a/templates/PrometheusRule-grafana.yaml +++ b/templates/PrometheusRule-grafana.yaml @@ -1,3 +1,4 @@ +{{ if .Values.nfc_monitoring.grafana.enabled -}} --- apiVersion: monitoring.coreos.com/v1 kind: PrometheusRule @@ -32,3 +33,5 @@ spec: - expr: | sum by (namespace, job, handler, status_code) (rate(grafana_http_request_duration_seconds_count[5m])) record: namespace_job_handler_statuscode:grafana_http_request_duration_seconds_count:rate5m + +{{- end }} diff --git a/templates/Service-Grafana.yaml b/templates/Service-Grafana.yaml index 6e8d14a..1630f7a 100644 --- a/templates/Service-Grafana.yaml +++ b/templates/Service-Grafana.yaml @@ -1,5 +1,5 @@ +{{ if .Values.nfc_monitoring.grafana.enabled -}} --- - apiVersion: v1 kind: Service metadata: @@ -24,3 +24,5 @@ spec: #nodePort: 3000 #type: LoadBalancer sessionAffinity: ClientIP + +{{- end }} diff --git a/templates/ServiceAccount-Grafana.yaml b/templates/ServiceAccount-Grafana.yaml index ab3cf74..8ce3283 100644 --- a/templates/ServiceAccount-Grafana.yaml +++ b/templates/ServiceAccount-Grafana.yaml @@ -1,3 +1,4 @@ +{{ if .Values.nfc_monitoring.grafana.enabled -}} --- apiVersion: v1 automountServiceAccountToken: false @@ -10,3 +11,5 @@ metadata: app.kubernetes.io/managed-by: {{ $.Release.Service }} app.kubernetes.io/part-of: {{ $.Chart.Name }} app.kubernetes.io/version: {{ $.Chart.Version }} + +{{- end }} diff --git a/templates/ServiceMonitor-Grafana.yaml b/templates/ServiceMonitor-Grafana.yaml index 0706bd6..0e89a64 100644 --- a/templates/ServiceMonitor-Grafana.yaml +++ b/templates/ServiceMonitor-Grafana.yaml @@ -1,3 +1,4 @@ +{{ if .Values.nfc_monitoring.grafana.enabled -}} --- apiVersion: monitoring.coreos.com/v1 kind: ServiceMonitor @@ -31,3 +32,5 @@ spec: matchLabels: {{ toYaml $.Values.nfc_monitoring.grafana.labels | nindent 6 }} app.kubernetes.io/part-of: {{ $.Chart.Name }} + +{{- end }} diff --git a/values.yaml b/values.yaml index 22097c9..c33d7e7 100644 --- a/values.yaml +++ b/values.yaml @@ -52,6 +52,8 @@ nfc_monitoring: grafana: + enabled: false + # Grafana Configuration # Type: Dict # See: https://grafana.com/docs/grafana/latest/setup-grafana/configure-grafana