-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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.BuilderWithOptions inherit options from caller #1980
⚠ cache.BuilderWithOptions inherit options from caller #1980
Conversation
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: joelanford 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 |
cdf6208
to
6182d4b
Compare
6182d4b
to
62f0538
Compare
62f0538
to
b0184e1
Compare
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.
This fix does seem good to me. Except for my questions on having DisableDeepCopyByObject
external. But that change isn't made here, and hence not concerning/blocking. Leaving it for others to review.
using cache.BuilderWithOptions does not properly inherit all options passed in from the caller: - scheme was overridden instead of merged - selectors were not inherited at all, even if specified options selectors remained unset - transforms were not inherited at all, even if specified options transforms remained unset - disable deep copy settings were not inherited at all, even if specified options for disabling deep copies remained unset This commit resolves this issues by implementing merge logic for all fields in the cache.Options struct: - Schemes are merged - RESTMapper is chosen by precedence only falling back to inherited options if left unset in specified options - Resync is chosen by precedence only falling back to inherited options if left unset in specified options - Namespace is chosen by precedence only falling back to inherited options if left unset in specified options - Selectors are merged. If both inherited and specified Options defined selectors for a given type, those selectors are merged via logical AND. - DisableDeepCopy is combined via precedence. Only if a value for a particular GVK is unset in the specified options will a value from the inherited options be used. - Transform functions are combined via chaining. If both inherited and specified options define a transform function, the transform function from the inherited options will be called first, and the transform function from the specified options will be called second. Signed-off-by: Joe Lanford <joe.lanford@gmail.com>
b0184e1
to
b38c4a5
Compare
/retest |
/retest /lgtm |
/retest |
Oh wasn't aware self-approve is enabled in this repo. Sorry if this wasn't intended to be merged already |
using cache.BuilderWithOptions does not properly inherit all
options passed in from the caller:
selectors remained unset
transforms remained unset
specified options for disabling deep copies remained unset
This commit resolves this issues by implementing merge logic for all
fields in the cache.Options struct:
options if left unset in specified options
options if left unset in specified options
options if left unset in specified options
selectors for a given type, those selectors are merged via logical
AND.
particular GVK is unset in the specified options will a value from the
inherited options be used.
specified options define a transform function, the transform function
from the inherited options will be called first, and the transform
function from the specified options will be called second.
This is a breaking change if your code does all of the following:
cache.BuilderWithOptions
cache.BuilderWithOptions
.Signed-off-by: Joe Lanford joe.lanford@gmail.com