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
k8s.io/client-go informer library #14
Comments
additionally there is a workqueue which helps to create a controller synchronized with a certain k8s resource state. Example: https://github.com/kubernetes/client-go/pull/65/files |
Thanks @ideahitme. This is also a very valuable document: Writing Controllers |
We also could import the kops code e.g. https://github.com/kubernetes/kops/blob/master/dns-controller/pkg/watchers/servicecontroller.go The abstractions are not necessarily any easier to understand, in my experience. The top bug that everyone falls in to is start reading the results in, and not waiting until the List has completed before processing. So on a restart, you delete almost all the records, then repopulate them as the List proceeds. The kops dns-controller builds an in-memory desired state of the world (https://github.com/kubernetes/kops/blob/master/dns-controller/pkg/dns/dnscontext.go), and then keeps tracks of which records are dirty. It then polls this for dirty records every N seconds, which gives us some change debouncing. Polling for dirty records is efficient, particularly in the "nothing changed" case. |
Joe Beda built another template for how a controller should look: https://github.com/jbeda/tgik-controller |
Our use-case for external-dns has latency requirements that the current reconciliation loop implementation isn’t ideally suited to. I’d be interested in picking this up if its still the direction the project wants to go in? |
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
Stale issues rot after 30d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
Rotten issues close after 30d of inactivity. Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
@fejta-bot: Closing this issue. 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. |
…s-sigs#14) * krew info: Improve error message when plugin doesn't exist * fixup! krew info: Improve error message when plugin doesn't exist
As suggested by @linki it might make sense to checkout the client-go
informer
library to fetch/watch the list of services/ingress resources. A pretty clean example can be found here:https://github.com/wfarr/client-go/blob/577d1900c3ba12335dc1edb4a812c14a07effd73/examples/informer/main.go
It is currently used in main kuberentes repo and in few of the /contrib projects as well
The text was updated successfully, but these errors were encountered: