-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Additive updates to services when discovery enabled #2318
Additive updates to services when discovery enabled #2318
Conversation
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
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.
Looks pretty good. See comment about docs/error behaviour.
docs/content/management.md
Outdated
The discovery feature cannot be used to dynamically modify `labels` and `discovery`. This means that these configuration settings should be included | ||
in the bootup configuration file provided to OPA. However, it can be used to modify `services` with the exception of the service used to download the discovery bundle. |
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.
Would be good to include a note here about why these settings cannot be modified and what happens if you try to. Something like:
In practice, discovery services do not change frequently. These configuration sections are treated as
immutable to avoid accidental configuration errors rendering OPA unable to discover new configuration.
If the discovered configuration changes the `discovery` or `labels` sections,
those changes are ignored. If the discovered configuration changes the discovery service,
an error will be logged.
This makes me wonder why we're erroring on disco service changes but not disco or label section changes.
// clients can be specified either as an array or as a map. Some systems (e.g., | ||
// Helm) do not have proper support for configuration values nested under | ||
// arrays, so just support both here. | ||
func ParseServicesConfig(raw json.RawMessage) (map[string]rest.Client, error) { |
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.
Just a side note, but I imagine us having to change this API slightly in the future when we introduce support for other bundle download protocols like Git. In that case, the service will no longer be a rest.Client. No changes required at this time since this is just an internal API.
@ashutosh-narkar if you update the docs, we can merge this. |
56900e0
to
24762b1
Compare
Doc updated. |
Earlier with discovery enabled, there was no protection against accidental changes to the discovery service. This change prevents the discovery service from being modified by checking it's config in the service bundle. Fixes open-policy-agent#2058 Signed-off-by: Ashutosh Narkar <anarkar4387@gmail.com>
24762b1
to
5261011
Compare
Earlier with discovery enabled, there was no protection against accidental
changes to the discovery service. This change prevents the discovery service
from being modified by checking it's config in the service bundle.
Fixes #2058