From 19274a7fc4b3624db4a421ab01cbf4d69d9ac62c Mon Sep 17 00:00:00 2001 From: Jacob Baungard Hansen Date: Wed, 21 Aug 2024 16:45:46 +0200 Subject: [PATCH] ACM-12794: forward auth header to datasource This allows rbac-query-proxy to authentication against obs-api. This is needed as Grafana no longer automatically forwards the header (and for now only does so in our patched Grafana version). Signed-off-by: Jacob Baungard Hansen --- .../controllers/multiclusterobservability/grafana.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/operators/multiclusterobservability/controllers/multiclusterobservability/grafana.go b/operators/multiclusterobservability/controllers/multiclusterobservability/grafana.go index c50107253..7f821a600 100644 --- a/operators/multiclusterobservability/controllers/multiclusterobservability/grafana.go +++ b/operators/multiclusterobservability/controllers/multiclusterobservability/grafana.go @@ -62,10 +62,11 @@ type JsonData struct { TLSAuth bool `yaml:"tlsAuth,omitempty"` TLSAuthCA bool `yaml:"tlsAuthWithCACert,omitempty"` // Timeout is the request timeout in seconds for an HTTP datasource. - Timeout string `yaml:"timeout,omitempty"` - HttpMethod string `yaml:"httpMethod,omitempty"` - TimeInterval string `yaml:"timeInterval,omitempty"` - CustomQueryParameters string `yaml:"customQueryParameters,omitempty"` + Timeout string `yaml:"timeout,omitempty"` + HttpMethod string `yaml:"httpMethod,omitempty"` + TimeInterval string `yaml:"timeInterval,omitempty"` + CustomQueryParameters string `yaml:"customQueryParameters,omitempty"` + ForwardHeaders []string `yaml:"forwardHeaders,omitempty"` } type SecureJsonData struct { @@ -104,6 +105,7 @@ func GenerateGrafanaDataSource( Timeout: "300", CustomQueryParameters: "max_source_resolution=auto", TimeInterval: fmt.Sprintf("%ds", mco.Spec.ObservabilityAddonSpec.Interval), + ForwardHeaders: []string{"X-Forwarded-Access-Token", "X-Forwarded-User"}, }, }, { @@ -120,6 +122,7 @@ func GenerateGrafanaDataSource( Timeout: "300", CustomQueryParameters: "max_source_resolution=auto", TimeInterval: fmt.Sprintf("%ds", DynamicTimeInterval), + ForwardHeaders: []string{"X-Forwarded-Access-Token", "X-Forwarded-User"}, }, }, },