-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Singleton Controller #2220
Comments
The Kubernetes project currently lacks enough contributors to adequately respond to all issues. This bot triages un-triaged issues according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues. This bot triages un-triaged issues according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle rotten |
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs. This bot triages issues according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /close not-planned |
@k8s-triage-robot: Closing this issue, marking it as "Not Planned". In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Karpenter has found it useful to adopt the same
Reconcile(context.Context, reconcile.Request)
interface across all of our controllers, including those that don't neccesarily reconcile on a specific K8s object, i.e. a poller. Ultimately, it makes it easier for new developers to consume when onboarding to the project and it also gives us things like leader election (and potentially metrics in the future for free).You can potentially achieve a polling mechanism with controller-runtime by doing something like removing your
For()
from the builder and creating an initial trigger off of an event channel, but it feels hacky and those that write their controllers wrong for their pollers may find that they return an empty result and then never see polling again.The Karpenter project proposes a
SingletonController
that has the same signature as the standard controller runtime controller but allows you to make a poller that automatically runs and only runs a single thread, never triggered by any K8s event. This is useful for a number of our controllers and has allowed us to unify the structure of our codebase tremendously.Beyond creating a whole new builder, I could also see the ability to specify something like
Singleton()
in the standard builder that changes the behavior of the existing controller to always trigger an initial queue of an event without the user having to hack itIt would be great if we could see a similar mechanism supported natively upstream so we get things like
controller_runtime
metrics and upstream support for free.The text was updated successfully, but these errors were encountered: