Skip to content

Conditional controllers with event handler removal#3

Open
kevindelgado wants to merge 8 commits intomasterfrom
conditional-controllers-4-15
Open

Conditional controllers with event handler removal#3
kevindelgado wants to merge 8 commits intomasterfrom
conditional-controllers-4-15

Conversation

@kevindelgado
Copy link
Owner

@kevindelgado kevindelgado commented Apr 19, 2021

A proof-of-concept for how controller-runtime controllers could operate regardless of if the CRD they are watching is installed/uninstalled/reinstalled.

This builds off of two other WIP PRs in upstream k/k

  1. Adding the ability to remove event handlers (support removal of event handlers from SharedIndexInformers kubernetes/kubernetes#98657)
  2. Notifying the EventHandlers that when the list/watch call encounters an error by adding OnError to the EventHandler interface ([WIP] Add OnError to ResourceEventHandler kubernetes#2)

There are three new mechanisms at play here to make this work:

  1. The controller's logic to start the watches is wrapped in a loop that will periodically re-check if the resource to watch can be installed and only starting it if it can be.
  2. An ErrorFunc is added to the event handler that removes the event handler in the situation where list/watch is erroring out, because the CRD is not installed.
  3. The informer is ran with stop options to indicate that it should shut itself down if all its event handlers have been removed.

@kevindelgado kevindelgado changed the title Conditional controllers 4 15 Conditional controllers with event handler removal Apr 19, 2021
@kevindelgado kevindelgado force-pushed the conditional-controllers-4-15 branch from 4db167a to 035ee65 Compare April 19, 2021 21:38
@kevindelgado kevindelgado force-pushed the conditional-controllers-4-15 branch from 035ee65 to 9ecfb35 Compare April 22, 2021 23:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant