feat(grafana): enabled/disabled configurable

!8
This commit is contained in:
2024-02-04 15:01:04 +09:30
parent c5bb46f48a
commit e0cb8f57e2
16 changed files with 43 additions and 6 deletions

View File

@ -1,3 +1,4 @@
{{ if .Values.nfc_monitoring.grafana.enabled -}}
{{ if .Values.nfc_monitoring.additions.dashboard_sidecar.enabled -}} {{ if .Values.nfc_monitoring.additions.dashboard_sidecar.enabled -}}
--- ---
apiVersion: rbac.authorization.k8s.io/v1 apiVersion: rbac.authorization.k8s.io/v1
@ -14,3 +15,4 @@ rules:
resources: ["configmaps"] resources: ["configmaps"]
verbs: ["get", "watch", "list"] verbs: ["get", "watch", "list"]
{{- end }} {{- end }}
{{- end }}

View File

@ -1,3 +1,4 @@
{{ if .Values.nfc_monitoring.grafana.enabled -}}
{{ if .Values.nfc_monitoring.additions.dashboard_sidecar.enabled -}} {{ if .Values.nfc_monitoring.additions.dashboard_sidecar.enabled -}}
--- ---
kind: ClusterRoleBinding kind: ClusterRoleBinding
@ -18,3 +19,4 @@ subjects:
name: grafana name: grafana
namespace: "{{ .Values.nfc_monitoring.grafana.namespace }}" namespace: "{{ .Values.nfc_monitoring.grafana.namespace }}"
{{- end }} {{- end }}
{{- end }}

View File

@ -1,3 +1,4 @@
{{ if .Values.nfc_monitoring.grafana.enabled -}}
--- ---
apiVersion: v1 apiVersion: v1
kind: ConfigMap kind: ConfigMap
@ -123,4 +124,4 @@ data:
} }
} }
--- {{- end }}

View File

@ -1,3 +1,4 @@
{{ if .Values.nfc_monitoring.grafana.enabled -}}
{{ if .Values.nfc_monitoring.additions.dashboard_sidecar.enabled -}} {{ if .Values.nfc_monitoring.additions.dashboard_sidecar.enabled -}}
--- ---
# Provisioning config # Provisioning config
@ -27,3 +28,4 @@ data:
path: /var/lib/grafana/dashboards path: /var/lib/grafana/dashboards
foldersFromFilesStructure: true foldersFromFilesStructure: true
{{- end }} {{- end }}
{{- end }}

View File

@ -1,4 +1,5 @@
--- ---
{{ if .Values.nfc_monitoring.grafana.enabled -}}
apiVersion: grafana.integreatly.org/v1beta1 apiVersion: grafana.integreatly.org/v1beta1
kind: Grafana kind: Grafana
metadata: metadata:
@ -147,3 +148,5 @@ spec:
resources: resources:
requests: requests:
storage: "5Gi" storage: "5Gi"
{{- end }}

View File

@ -1,3 +1,4 @@
{{ if .Values.nfc_monitoring.grafana.enabled -}}
--- ---
apiVersion: grafana.integreatly.org/v1beta1 apiVersion: grafana.integreatly.org/v1beta1
kind: GrafanaDashboard kind: GrafanaDashboard
@ -15,4 +16,6 @@ spec:
app.kubernetes.io/name: grafana app.kubernetes.io/name: grafana
grafanaCom: grafanaCom:
id: 9578 id: 9578
revision: 4 # as @ 19-09-23 revision: 4 # as @ 19-09-23
{{- end }}

View File

@ -1,3 +1,4 @@
{{ if .Values.nfc_monitoring.grafana.enabled -}}
--- ---
{{- if .Values.nfc_monitoring.additions.ceph.enabled | default false -}} {{- if .Values.nfc_monitoring.additions.ceph.enabled | default false -}}
apiVersion: grafana.integreatly.org/v1beta1 apiVersion: grafana.integreatly.org/v1beta1
@ -18,4 +19,5 @@ spec:
id: 2842 id: 2842
revision: 17 # as @ 19-09-23 revision: 17 # as @ 19-09-23
{{- end -}} {{- end -}}
{{- end }}

View File

@ -1,4 +1,5 @@
--- ---
{{ if .Values.nfc_monitoring.grafana.enabled -}}
apiVersion: grafana.integreatly.org/v1beta1 apiVersion: grafana.integreatly.org/v1beta1
kind: GrafanaDashboard kind: GrafanaDashboard
metadata: metadata:
@ -17,3 +18,4 @@ spec:
json: >- json: >-
{{ $Dashboard | toRawJson }} {{ $Dashboard | toRawJson }}
{{- end }}

View File

@ -1,4 +1,5 @@
--- ---
{{ if .Values.nfc_monitoring.grafana.enabled -}}
apiVersion: grafana.integreatly.org/v1beta1 apiVersion: grafana.integreatly.org/v1beta1
kind: GrafanaDashboard kind: GrafanaDashboard
metadata: metadata:
@ -15,4 +16,6 @@ spec:
app.kubernetes.io/name: grafana app.kubernetes.io/name: grafana
grafanaCom: grafanaCom:
id: 1860 id: 1860
revision: 32 # as @ 19-09-23 revision: 32 # as @ 19-09-23
{{- end }}

View File

@ -1,4 +1,5 @@
--- ---
{{ if .Values.nfc_monitoring.grafana.enabled -}}
apiVersion: grafana.integreatly.org/v1beta1 apiVersion: grafana.integreatly.org/v1beta1
kind: GrafanaDatasourceList kind: GrafanaDatasourceList
items: items:
@ -24,3 +25,4 @@ items:
{{ toYaml . | nindent 8 }} {{ toYaml . | nindent 8 }}
{{ end }} {{ end }}
{{- end }}

View File

@ -12,7 +12,8 @@ spec:
{{ end }} {{ 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 apiVersion: networking.k8s.io/v1
kind: Ingress kind: Ingress
@ -25,6 +26,7 @@ spec:
{{ toYaml $.Values.nfc_monitoring.grafana.ingress.spec | nindent 2 }} {{ toYaml $.Values.nfc_monitoring.grafana.ingress.spec | nindent 2 }}
{{ end }} {{ end }}
{{ end }}
{{ if .Values.nfc_monitoring.prometheus.ingress.enabled | default "false" -}} {{ if .Values.nfc_monitoring.prometheus.ingress.enabled | default "false" -}}
--- ---

View File

@ -1,3 +1,4 @@
{{ if .Values.nfc_monitoring.grafana.enabled -}}
--- ---
apiVersion: monitoring.coreos.com/v1 apiVersion: monitoring.coreos.com/v1
kind: PrometheusRule kind: PrometheusRule
@ -32,3 +33,5 @@ spec:
- expr: | - expr: |
sum by (namespace, job, handler, status_code) (rate(grafana_http_request_duration_seconds_count[5m])) 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 record: namespace_job_handler_statuscode:grafana_http_request_duration_seconds_count:rate5m
{{- end }}

View File

@ -1,5 +1,5 @@
{{ if .Values.nfc_monitoring.grafana.enabled -}}
--- ---
apiVersion: v1 apiVersion: v1
kind: Service kind: Service
metadata: metadata:
@ -24,3 +24,5 @@ spec:
#nodePort: 3000 #nodePort: 3000
#type: LoadBalancer #type: LoadBalancer
sessionAffinity: ClientIP sessionAffinity: ClientIP
{{- end }}

View File

@ -1,3 +1,4 @@
{{ if .Values.nfc_monitoring.grafana.enabled -}}
--- ---
apiVersion: v1 apiVersion: v1
automountServiceAccountToken: false automountServiceAccountToken: false
@ -10,3 +11,5 @@ metadata:
app.kubernetes.io/managed-by: {{ $.Release.Service }} app.kubernetes.io/managed-by: {{ $.Release.Service }}
app.kubernetes.io/part-of: {{ $.Chart.Name }} app.kubernetes.io/part-of: {{ $.Chart.Name }}
app.kubernetes.io/version: {{ $.Chart.Version }} app.kubernetes.io/version: {{ $.Chart.Version }}
{{- end }}

View File

@ -1,3 +1,4 @@
{{ if .Values.nfc_monitoring.grafana.enabled -}}
--- ---
apiVersion: monitoring.coreos.com/v1 apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor kind: ServiceMonitor
@ -31,3 +32,5 @@ spec:
matchLabels: matchLabels:
{{ toYaml $.Values.nfc_monitoring.grafana.labels | nindent 6 }} {{ toYaml $.Values.nfc_monitoring.grafana.labels | nindent 6 }}
app.kubernetes.io/part-of: {{ $.Chart.Name }} app.kubernetes.io/part-of: {{ $.Chart.Name }}
{{- end }}

View File

@ -52,6 +52,8 @@ nfc_monitoring:
grafana: grafana:
enabled: false
# Grafana Configuration # Grafana Configuration
# Type: Dict # Type: Dict
# See: https://grafana.com/docs/grafana/latest/setup-grafana/configure-grafana # See: https://grafana.com/docs/grafana/latest/setup-grafana/configure-grafana