Skip to content
This repository has been archived by the owner on Aug 28, 2024. It is now read-only.

Apply go 1.18 generics across reconciler-runtime #349

Merged
merged 5 commits into from
Apr 5, 2023
Merged

Apply go 1.18 generics across reconciler-runtime #349

merged 5 commits into from
Apr 5, 2023

Commits on Mar 29, 2023

  1. Apply go 1.18 generics across reconciler-runtime

    This is a major breaking change that will affect all users of
    reconciler-runtime. There does not appear to be a way to transparently
    apply generics to an existing API that allows users to opt-in over time.
    
    User defined functions are now compile-time type checked, and IDEs will
    be able to offer completion for method signatures. At runtime these
    functions are directly invoked and are no longer called by reflection.
    Runtime type checking has been removed.
    
    Changes:
    
    - All existing deprecations are removed
    - All Reconcilers and SubReconcilers now operate on generic types of
      client.Object.
    - All reconciler Type/ChildType/ChildListType fields are now optional.
      They are only required if the generic type is an interface, or to
      define the apiVersion/kind for an Unstructured type.
    - SyncReconciler#Sync and #Finalize methods are split into two fields,
      one that is _WithResult and the default method which only returns an
      error.
    
    Signed-off-by: Scott Andrews <andrewssc@vmware.com>
    scothis committed Mar 29, 2023
    Configuration menu
    Copy the full SHA
    e603c75 View commit details
    Browse the repository at this point in the history
  2. Drop CastResource#Type

    The Type field for CastResource is completely redundant with the generic
    types. We can also go a step further and avoid converting the resource
    when the CastType is an interface, because we know all concrete types
    are already compatible and only need to be cast, saving a lot of
    overhead.
    
    Signed-off-by: Scott Andrews <andrewssc@vmware.com>
    scothis committed Mar 29, 2023
    Configuration menu
    Copy the full SHA
    b49ecc2 View commit details
    Browse the repository at this point in the history

Commits on Mar 30, 2023

  1. Cleanup unessesary reflective invocations

    Signed-off-by: Scott Andrews <andrewssc@vmware.com>
    scothis committed Mar 30, 2023
    Configuration menu
    Copy the full SHA
    ed0b867 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    705e5d2 View commit details
    Browse the repository at this point in the history

Commits on Apr 4, 2023

  1. Extend generics into SubReconcilerTestCase Resource and ExpectedResource

    This means that the value of Resource and ExpectedResource must be the
    same type as the reconciler handles.
    
    No longer can a die be passed directly and unwrapped inside the test.
    While this behavior was extremely convenient, it created expectations
    that may not be true in other cases and depends on DeepCopyObject on the
    die returning a different type than the method was called on.
    
    Signed-off-by: Scott Andrews <andrewssc@vmware.com>
    scothis committed Apr 4, 2023
    Configuration menu
    Copy the full SHA
    deb9b67 View commit details
    Browse the repository at this point in the history