Skip to content

First-class support for class-based reconcilers. #1098

Description

@mattmoor

/area API
/kind bug
/kind feature

There is a bug today with // +genreconciler-based reconcilers that using finalizers and are class-based. Essentially we have no way to keep the wrong class' reconciler from adding finalizers to resources they shouldn't handle or (worse!) removing them from resources they shouldn't handle.

We know in general which resources we define are going to be class-based, so my recommendation here would be to adopt the following solution.

// This is a normal type
// +genreconciler
...

// This is a class-based type
// +genreconciler:class=networking.knative.dev/ingress.class
...

The idea here is that we would tell the codegen infrastructure the name of the class annotation. This would then influence the code-generator to add an additional argument to the appropriate constructors:

// Normal +genreconciler
fooreconciler.NewImpl(ctx, c)

// One with a class.
barreconciler.NewImpl(ctx, c, "my.class.value")

Activity

  1. n3wscott commented on Feb 16, 2020

    @n3wscott
    Contributor

    Can we add that to the optional stuct?

  2. n3wscott commented on Feb 16, 2020

    @n3wscott
    Contributor

    Or!! How about allow a options filter function callback to be passed back!!

  3. mattmoor commented on Feb 16, 2020

    @mattmoor
    MemberAuthor

    I think what I suggest above is harder to hold wrong because it requires a different signature iff it is class-based. I think adding stuff to the options struct that is only used for class-based stuff gets confusing (what if I specify it when I'm not using a class-based type?!?).

  4. n3wscott commented on Feb 18, 2020

    @n3wscott
    Contributor

    ok I like the args idea. I will give it a try

    /assign

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions