Skip to content
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

Merged

Commits on Aug 30, 2022

  1. fix: cache.BuilderWithOptions inherit options from caller

    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>
    joelanford committed Aug 30, 2022
    Copy the full SHA
    b38c4a5 View commit details
    Browse the repository at this point in the history