-
Notifications
You must be signed in to change notification settings - Fork 488
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(exporter/elasticsearch): add Basic Auth support #5814
feat(exporter/elasticsearch): add Basic Auth support #5814
Conversation
Test results[Before] Unauthorized request when trying to reach secure ES cluster without
|
@grafana/grafana-agent-maintainers This needs your review as well. |
Thanks @hainenber! @thepalbi Can you take a look at this once, since the exporter integration was originally contributed by you? |
@@ -66,6 +70,21 @@ type Config struct { | |||
ExportDataStreams bool `yaml:"data_stream,omitempty"` | |||
// Export stats for Snapshot Lifecycle Management | |||
ExportSLM bool `yaml:"slm,omitempty"` | |||
// BasicAuth block allows secure connection with Elasticsearch cluster via Basic-Auth | |||
BasicAuth *commoncfg.BasicAuth `yaml:"basic_auth,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
given that this also touches the integration implementation itself, we should also update the static configs doc https://grafana.com/docs/agent/latest/static/configuration/integrations/elasticsearch-exporter-config/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, I think we should use in here the prometheus BasicAuth
type, which is yaml serializable, in contrast with the river definition of it. If not, someone trying to use this feature in a static config agent won't be able to.
See that the river BasicAuth
type has a Convert
method that translates it to the prometheus type in here.
@rfratto wdyt?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi there, thanks for the review! Makes sense to continue supporting the static config :D. I've made amends in latest commit. PTAL if you have time.
1151711
to
67b236f
Compare
Signed-off-by: hainenber <[email protected]>
PR grafana#5802 accidentally added the changelog entry to a published release.
Signed-off-by: hainenber <[email protected]>
Signed-off-by: hainenber <[email protected]>
Signed-off-by: hainenber <[email protected]>
Signed-off-by: hainenber <[email protected]>
Signed-off-by: hainenber <[email protected]>
67b236f
to
520608d
Compare
Signed-off-by: hainenber <[email protected]>
Can we also add a mapping from static to flow for this new property in the converter code?
This can be optionally validated in the testing in converter/internal/staticconvert/testdata/integrations.* |
Done :D |
Signed-off-by: hainenber <[email protected]>
cc @thepalbi in case he can take a final look here. |
} | ||
|
||
// Custom http.Transport struct for Basic Auth-secured communication with ES cluster | ||
type BasicAuthHTTPTransport struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: can we rename this to AuthenticatedHTTPTransport
or sth like this, since it just takes a generic header value?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, just left a small nit
Signed-off-by: erikbaranowski <[email protected]>
Merging since there's two approvals and no further commits in two weeks. Thanks @hainenber! |
* feat(exporter/elasticsearch): add Basic Auth support Signed-off-by: hainenber <[email protected]> * misc: fix changelog entry (grafana#5812) PR grafana#5802 accidentally added the changelog entry to a published release. * fix(exporter/elasticsearch): only add Auth header when needed Signed-off-by: hainenber <[email protected]> * doc(exporter/elasticsearch): add Basic Auth block desc Signed-off-by: hainenber <[email protected]> * feat(exporter/elasticsearch): add Basic Auth support Signed-off-by: hainenber <[email protected]> * feat(exporter/elasticsearch): support Basic Auth for static config Signed-off-by: hainenber <[email protected]> * chore(CHANGELOG): remove merge conflict artifact Signed-off-by: hainenber <[email protected]> * misc: fix changelog entry Signed-off-by: hainenber <[email protected]> * feat(converter): map ES exporter's BasicAuth flow from static to flow Signed-off-by: hainenber <[email protected]> * fix(converter): nil check for ES exporter's Basic Auth Signed-off-by: hainenber <[email protected]> * lint Signed-off-by: erikbaranowski <[email protected]> --------- Signed-off-by: hainenber <[email protected]> Signed-off-by: erikbaranowski <[email protected]> Co-authored-by: Robert Fratto <[email protected]> Co-authored-by: erikbaranowski <[email protected]>
* feat(exporter/elasticsearch): add Basic Auth support Signed-off-by: hainenber <[email protected]> * misc: fix changelog entry (grafana#5812) PR grafana#5802 accidentally added the changelog entry to a published release. * fix(exporter/elasticsearch): only add Auth header when needed Signed-off-by: hainenber <[email protected]> * doc(exporter/elasticsearch): add Basic Auth block desc Signed-off-by: hainenber <[email protected]> * feat(exporter/elasticsearch): add Basic Auth support Signed-off-by: hainenber <[email protected]> * feat(exporter/elasticsearch): support Basic Auth for static config Signed-off-by: hainenber <[email protected]> * chore(CHANGELOG): remove merge conflict artifact Signed-off-by: hainenber <[email protected]> * misc: fix changelog entry Signed-off-by: hainenber <[email protected]> * feat(converter): map ES exporter's BasicAuth flow from static to flow Signed-off-by: hainenber <[email protected]> * fix(converter): nil check for ES exporter's Basic Auth Signed-off-by: hainenber <[email protected]> * lint Signed-off-by: erikbaranowski <[email protected]> --------- Signed-off-by: hainenber <[email protected]> Signed-off-by: erikbaranowski <[email protected]> Co-authored-by: Robert Fratto <[email protected]> Co-authored-by: erikbaranowski <[email protected]>
PR Description
Which issue(s) this PR fixes
Fixes #5740
Notes to the Reviewer
List of AIs need to be done before out of draft:
PR Checklist