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

Conditional controllers with event handler removal #3

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

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
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