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