-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
✨ Cache: Allow defining options that apply to all namespaces that themselves have no explicit config #2528
Conversation
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: alvaroaleman The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
pkg/cache/cache.go
Outdated
@@ -172,6 +178,11 @@ type Options struct { | |||
// the namespaces in here will be watched and it will by used to default | |||
// ByObject.Namespaces for all objects if that is nil. | |||
// | |||
// It is possible to have specific Config for just some namespaces | |||
// but cache all namespaces by using the AllNamespaces const as the map key. | |||
// This wil then include all namespaces that do not have a more specific |
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
// This wil then include all namespaces that do not have a more specific | |
// This will then include all namespaces that do not have a more specific |
pkg/cache/cache.go
Outdated
@@ -220,6 +231,11 @@ type ByObject struct { | |||
// Settings in the map value that are unset will be defaulted. | |||
// Use an empty value for the specific setting to prevent that. | |||
// | |||
// It is possible to have specific Config for just some namespaces | |||
// but cache all namespaces by using the AllNamespaces const as the map key. | |||
// This wil then include all namespaces that do not have a more specific |
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
// This wil then include all namespaces that do not have a more specific | |
// This will then include all namespaces that do not have a more specific |
…mselves have no explicit config This change allows to define a cache selector config that applies to all namespaces that themselves do not have an explicit config. An example would be "Cache all namespaces without selector, except for namespace foo, there use labelSelector bar=baz". More as a side effect than intentionally, this also makes it valid to use the empty string as a key in the `Namespaces` and `byObject.Namespaces` config of the cache. This is very useful to for example have a `namespace` CLI flag that might be empty. This change is the last missing bit to finish the implementation of the [cache options design doc](./designs/cache_options.md).
47ae247
to
414b86e
Compare
/lgtm |
/cherrypick release-0.16 |
@alvaroaleman: new pull request created: #2539 In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/lgtm |
This change allows to define a cache selector config that applies to all namespaces that themselves do not have an explicit config. An example would be "Cache all namespaces without selector, except for namespace foo, there use labelSelector bar=baz".
More as a side effect than intentionally, this also makes it valid to use the empty string as a key in the
Namespaces
andbyObject.Namespaces
config of the cache. This is very useful to for example have anamespace
CLI flag that might be empty.This change is the last missing bit to finish the implementation of the cache options design doc.
Sidenote: If someone can come up with a less wordy title that describes what this does, that would be nice :)