fix(backend): allow duplicated upstream URIs

Fixes #3024
This commit is contained in:
Łukasz Mierzwa
2021-04-22 15:13:27 +01:00
committed by Łukasz Mierzwa
parent 0de58da467
commit 9222133df8
3 changed files with 5 additions and 22 deletions

View File

@@ -8,6 +8,11 @@
for multi-grid, when multi-grid is configured to `Automatic selection`
in the UI or when `ui:multiGridLabel` config section is set to `@auto`.
### Changed
- karma will no longer fail to start if config file contains multiple alertmanager
instances with different name but identical URI #3024.
## v0.83
### Added

View File

@@ -1,17 +0,0 @@
# Raises an error if we have 2 instances with the same URI
karma.bin-should-fail --config.file karma.yaml
! stdout .
cmp stderr stderr.txt
-- stderr.txt --
level=info msg="Reading configuration file" path=karma.yaml
level=info msg="Version: dev"
level=info msg="Configured Alertmanager source" name=am1 proxy=false readonly=false uri=https://127.0.0.1:9093
level=error msg="Execution failed" error="failed to register Alertmanager 'am2' with URI 'https://127.0.0.1:9093': alertmanager upstream 'am1' already collects from 'https://127.0.0.1:9093'"
-- karma.yaml --
alertmanager:
servers:
- name: am1
uri: https://127.0.0.1:9093
- name: am2
uri: https://127.0.0.1:9093

View File

@@ -75,11 +75,6 @@ func RegisterAlertmanager(am *Alertmanager) error {
return fmt.Errorf("alertmanager upstream '%s' already exist", am.Name)
}
for _, existingAM := range upstreams {
if existingAM.URI == am.URI {
return fmt.Errorf("alertmanager upstream '%s' already collects from '%s'", existingAM.Name, uri.SanitizeURI(existingAM.URI))
}
}
upstreams[am.Name] = am
// am.Name, uri.SanitizeURI(am.URI), am.ProxyRequests, am.ReadOnly
log.Info().