[improve][monitor] Metrics: allow to configure a set of roles for the scrapers #53
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
For the metrics endpoints for the Pulsar services (broker, proxy, functions-worker) it would be handy to configure dedicated "service" roles that have grain-fined permission to only scrape the metrics.
Changes
The metrics impacted are on broker, proxy, and functions worker.
Currently the default config values for "authenticateMetricsEndpoint" are:
It's not intended to change these values in this pull request.
For all the above services, we add two new configurations:
Before this change, any authenticated users could see the metrics if authenticateMetricsEndpoint=true.
After this change, the logic is:
authenticationEnabled=true
ANDauthenticateMetricsEndpoint=true
ANDauthorizationEnabled=true
ANDauthorizeMetricsEndpoint=true
=> you need to be either a metricsRole user or a superUser user (if metricsRoles is empty, only superUser can access metrics)authenticationEnabled=true
ANDauthenticateMetricsEndpoint=true
=> you need to be authenticated as before this changeSince the default value of
authorizeMetricsEndpoint
is true, after the upgrade, the effects are:At this point the operator must consider to either
If the operator wants to leave anyone authenticated with the metrics access - so rollback to the previous behaviour, they have to set
authorizeMetricsEndpoint=false
before upgrading the code.Modifications
authorizeMetricsEndpoint=true
.authorizeMetricsEndpoint
only takes effect ifauthenticateMetricsEndpoint
is also true.The authorization model relies on being a super user role or a metrics role.
metricsRoles
, a set of roles separated by a comma.Only
metricsRoles
or superuser are allowed to get the metrics endpoints.The impacted metrics endpoints are:
Broker:
Functions Worker:
Proxy:
Verifying this change
Documentation
doc
doc-required
doc-not-needed
doc-complete