From c62939cd6fec7c46c7dae2acb27ab4c39bbc730e Mon Sep 17 00:00:00 2001 From: Danny Kopping Date: Fri, 14 Jan 2022 11:42:55 +0200 Subject: [PATCH 1/3] Retrieving original password to avoid marshaling issues Signed-off-by: Danny Kopping --- pkg/ruler/config.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkg/ruler/config.go b/pkg/ruler/config.go index 29e9456972c6..a615f1c4113a 100644 --- a/pkg/ruler/config.go +++ b/pkg/ruler/config.go @@ -73,6 +73,10 @@ func (c *RemoteWriteConfig) Clone() (*RemoteWriteConfig, error) { return nil, err } + // BasicAuth.Password has a type of Secret (github.com/prometheus/common/config/config.go), + // so when its value is marshaled it is obfuscated as "". + // Here we copy the original password into the cloned config. + n.Client.HTTPClientConfig.BasicAuth.Password = c.Client.HTTPClientConfig.BasicAuth.Password return n, nil } From 30bb801cd00ad7d4cef7180e906f6e894c13fb23 Mon Sep 17 00:00:00 2001 From: Danny Kopping Date: Fri, 14 Jan 2022 11:48:50 +0200 Subject: [PATCH 2/3] Fixing test Signed-off-by: Danny Kopping --- pkg/ruler/registry_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/ruler/registry_test.go b/pkg/ruler/registry_test.go index 1244638c9f92..96f4807b5e01 100644 --- a/pkg/ruler/registry_test.go +++ b/pkg/ruler/registry_test.go @@ -191,7 +191,7 @@ func TestTenantRemoteWriteHTTPConfigMaintained(t *testing.T) { // HTTP client config is not currently overrideable, all tenants' configs should inherit base assert.Equal(t, tenantCfg.RemoteWrite[0].HTTPClientConfig.BasicAuth.Username, "foo") - assert.Equal(t, tenantCfg.RemoteWrite[0].HTTPClientConfig.BasicAuth.Password, promConfig.Secret("")) + assert.Equal(t, tenantCfg.RemoteWrite[0].HTTPClientConfig.BasicAuth.Password, promConfig.Secret("bar")) } func TestTenantRemoteWriteHeaderOverride(t *testing.T) { From ed8ef47de0aaa45d45b1749133f83a52976c5a15 Mon Sep 17 00:00:00 2001 From: Danny Kopping Date: Fri, 14 Jan 2022 11:50:07 +0200 Subject: [PATCH 3/3] Adding CHANGELOG entry Signed-off-by: Danny Kopping --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b2078830b008..ee828be6d67f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ ## Main -* [5107](https://github.com/grafana/loki/pull5107) **chaudum** Fix bug in fluentd plugin that caused log lines containing non UTF-8 characters to be dropped. +* [5144](https://github.com/grafana/loki/pull/5144) **dannykopping** Ruler: fix remote write basic auth credentials. +* [5107](https://github.com/grafana/loki/pull/5107) **chaudum** Fix bug in fluentd plugin that caused log lines containing non UTF-8 characters to be dropped. * [5091](https://github.com/grafana/loki/pull/5091) **owen-d**: Changes `ingester.concurrent-flushes` default to 32 * [4879](https://github.com/grafana/loki/pull/4879) **cyriltovena**: LogQL: add __line__ function to | line_format template. * [5081](https://github.com/grafana/loki/pull/5081) **SasSwart**: Add the option to configure memory ballast for Loki