From aec5d469bea83312a4886f88603945407a7f166e Mon Sep 17 00:00:00 2001 From: Diogo Guerra Date: Thu, 23 Apr 2020 20:22:41 +0900 Subject: [PATCH] 2. Add persistency for grafana dashboards When label monitoring_storage_class_name is specified dashboards altered using the grafana UI are now persisted if the pod is terminated. It is still recommended that the user utilizes a kubernetes configMap to persist the dashboard. task: 39514 story: 2006765 Depends-On: I42117837e8e3cd03f3cb723df4d73692ead0d169 Change-Id: Ieb90605182626869528349a7fdeed65061914bcb Signed-off-by: Diogo Guerra --- doc/source/user/index.rst | 3 +++ .../templates/kubernetes/helm/prometheus-operator.sh | 9 +++++++++ ...rafanaUI_dashboards_persistency-1106b2e259a769b0.yaml | 9 +++++++++ 3 files changed, 21 insertions(+) create mode 100644 releasenotes/notes/altered_grafanaUI_dashboards_persistency-1106b2e259a769b0.yaml diff --git a/doc/source/user/index.rst b/doc/source/user/index.rst index 7f16eee280..2fcd478f0e 100644 --- a/doc/source/user/index.rst +++ b/doc/source/user/index.rst @@ -1500,6 +1500,9 @@ _`monitoring_storage_class_name` The kubernetes storage class name to use for the prometheus pvc. Using this label will activate the usage of a pvc instead of local disk space. + When using monitoring_storage_class_name 2 pvcs will be created. + One for the prometheus server which size is set by + monitoring_retention_size and one for grafana which is fixed at 1Gi. Default: "" _`prometheus_adapter_enabled` diff --git a/magnum/drivers/common/templates/kubernetes/helm/prometheus-operator.sh b/magnum/drivers/common/templates/kubernetes/helm/prometheus-operator.sh index 6398c3e9cd..db05225c6e 100755 --- a/magnum/drivers/common/templates/kubernetes/helm/prometheus-operator.sh +++ b/magnum/drivers/common/templates/kubernetes/helm/prometheus-operator.sh @@ -24,7 +24,12 @@ EOF # Because the PVC and Prometheus use different scales for the volume size # conversion is needed. The prometheus-monitoring value (in GB) is the conversion # with a ratio of (1 GiB = 1.073741824 GB) and then rounded to int + MONITORING_RETENTION_SIZE_GB=$(echo | awk "{print int(${MONITORING_RETENTION_SIZE}*1.073741824)}") + APP_GRAFANA_PERSISTENT_STORAGE="false" + if [ "${MONITORING_STORAGE_CLASS_NAME}" != "" ]; then + APP_GRAFANA_PERSISTENT_STORAGE="true" + fi # Validate if communication node <-> master is secure or insecure PROTOCOL="https" @@ -71,6 +76,10 @@ prometheus-operator: cpu: 100m memory: 128Mi adminPassword: ${GRAFANA_ADMIN_PASSWD} + persistence: + enabled: ${APP_GRAFANA_PERSISTENT_STORAGE} + storageClassName: ${MONITORING_STORAGE_CLASS_NAME} + size: 1Gi kubeApiServer: tlsConfig: diff --git a/releasenotes/notes/altered_grafanaUI_dashboards_persistency-1106b2e259a769b0.yaml b/releasenotes/notes/altered_grafanaUI_dashboards_persistency-1106b2e259a769b0.yaml new file mode 100644 index 0000000000..d826a4fbde --- /dev/null +++ b/releasenotes/notes/altered_grafanaUI_dashboards_persistency-1106b2e259a769b0.yaml @@ -0,0 +1,9 @@ +--- +features: + - | + Add persistency for grafana UI altered dashboards. To enable this use + monitoring_storage_class_name label. + It is recommended that dashboards be persisted by other means, mainly + by using kubernetes configMaps. More info [0]. + + [0] https://github.com/helm/charts/tree/master/stable/grafana#sidecar-for-dashboards