Skip to content

Stopping individual controllers in a manager #730

@suskin

Description

@suskin

Hi controller-runtime friends! Sorry if this is a dumb question; I'm a bit new to Kubernetes and controller patterns!

I'm experimenting with ways to configure and set up controllers dynamically for user-specified Kinds (as part of the crossplane project). I'm interested in stopping a running controller if, for example, the desired Kind no longer exists. I'm using a manager; a single manager may be managing multiple controllers, each of which watches a different Kind.

I already have some code which creates a controller and adds it to an already-started manager, which appears to work. For stopping that controller, I've looked into the manager logic, and the controller logic, and there appears to be support for stopping a controller, but it also appears to not be accessible if I am using a manager. Because a manager reuses a single stop channel for all of its controllers, and because it starts all of the controllers without checking whether they're already started, and because controllers appear to not check whether they've already been started when Start is called, I haven't found a way to do this with today's managers. It seems like one of the easier ways to add support for this would be to add another variation of the manager's Add function. The variation would take in a stop channel as a parameter.

Am I doing a Weird Thing that I shouldn't be doing? Is there a recommended, better way of doing this that I am missing? If possible, it seems like it'd be the most convenient to continue to use the manager pattern and be able to just stop an individual controller under that manager, rather than having to reimplement some of the nice management code in order to call into a controller or into a source directly.

Thanks in advance for your help!

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedDenotes an issue that needs help from a contributor. Must meet "help wanted" guidelines.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions