mirror of
https://github.com/grafana/grafana.git
synced 2024-11-25 18:30:41 -06:00
e3787de470
* Alerting: Make ApplyAlertmanagerConfiguration only decrypt/encrypt new/changed secure settings Previously, ApplyAlertmanagerConfiguration would decrypt and re-encrypt all secure settings. However, this caused re-encrypted secure settings to be included in the raw configuration when applied to the embedded alertmanager, resulting in changes to the hash. Consequently, even if no actual modifications were made, saving any alertmanager configuration triggered an apply/restart and created a new historical entry in the database. To address the issue, this modifies ApplyAlertmanagerConfiguration, which is called by POST `api/alertmanager/grafana/config/api/v1/alerts`, to decrypt and re-encrypt only new and updated secure settings. Unchanged secure settings are loaded directly from the database without alteration. We determine whether secure settings have changed based on the following (already in-use) assumption: Only new or updated secure settings are provided via the POST `api/alertmanager/grafana/config/api/v1/alerts` request, while existing unchanged settings are omitted. * Ensure saving a grafana-managed contact point will only send new/changed secure settings Previously, when saving a grafana-managed contact point, empty string values were transmitted for all unset secure settings. This led to potential backend issues, as it assumed that only newly added or updated secure settings would be provided. To address this, we now exclude empty ('', null, undefined) secure settings, unless there was a pre-existing entry in secureFields for that specific setting. In essence, this means we only transmit an empty secure setting if a previously configured value was cleared. * Fix linting * refactor omitEmptyUnlessExisting * fixup --------- Co-authored-by: Gilles De Mey <gilles.de.mey@gmail.com> |
||
---|---|---|
.. | ||
test-data | ||
tooling | ||
api_alertmanager_guards_test.go | ||
api_alertmanager_guards.go | ||
api_alertmanager_test.go | ||
api_alertmanager.go | ||
api_configuration_test.go | ||
api_configuration.go | ||
api_prometheus_test_fixtures.go | ||
api_prometheus_test.go | ||
api_prometheus.go | ||
api_provisioning_test.go | ||
api_provisioning.go | ||
api_ruler_history.go | ||
api_ruler_test.go | ||
api_ruler_validation_test.go | ||
api_ruler_validation.go | ||
api_ruler.go | ||
api_testing_test.go | ||
api_testing.go | ||
api.go | ||
authorization_test.go | ||
authorization.go | ||
compat_test.go | ||
compat.go | ||
configuration.go | ||
errors.go | ||
forking_alertmanager.go | ||
forking_prometheus.go | ||
forking_ruler.go | ||
generated_base_api_alertmanager.go | ||
generated_base_api_configuration.go | ||
generated_base_api_history.go | ||
generated_base_api_prometheus.go | ||
generated_base_api_provisioning.go | ||
generated_base_api_ruler.go | ||
generated_base_api_testing.go | ||
hooks.go | ||
lotex_am.go | ||
lotex_prom.go | ||
lotex_ruler_test.go | ||
lotex_ruler.go | ||
persist.go | ||
promql_compat_test.go | ||
promql_compat.go | ||
provisioning.go | ||
ruler_history.go | ||
testing_api.go | ||
testing.go | ||
util_test.go | ||
util.go |