Skip to content

Instantly share code, notes, and snippets.

@jeesmon
Created February 28, 2022 13:38
Show Gist options
  • Save jeesmon/0248357a0374a58805e20a0c32f4c213 to your computer and use it in GitHub Desktop.
Save jeesmon/0248357a0374a58805e20a0c32f4c213 to your computer and use it in GitHub Desktop.

Wondered what happens when controller manager starts in your operator?

  • Start metrics endpoint
  • Start health probes
  • Start web hooks servers
  • Start and wait for caches to sync
  • Start non-leader election runnables
  • Start leader election and all required runnables

You can see that caches are sync’ed in both leader and non-leader operator pods which makes transition quick if leader pod exits and another operator pod becomes leader (if you run multiple pods of your operator for HA)

Code for all these in here: https://github.com/kubernetes-sigs/controller-runtime/blob/master/pkg/manager/internal.go#L441-L496

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