-
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
Manager.Add does not start Cache after Manager has already started #1673
Comments
Hey @jsafrane , actually adding a new cluster is something I'd have expected to already work 🤔 So seems there is a bug. Removing one isn't currently supported, we would have to make sure that we can properly stop everything without leaks and think about how we want to add that to our API. |
Although we can new a cluster and add it into an existing manager, but it is added as a Runnable and the main cluster can only be one. type controllerManager struct {
// cluster holds a variety of methods to interact with a cluster. Required.
cluster cluster.Cluster
} It somehow triggers my obsession... Could we change it to a list and provide something like |
I guess the title is a bit misleading. I know that a Runnable can be added after the Manager is started but my understanding is that it won't be started. I want to add a Cluster to a Manager after the Manager has already started and then have the Cluster started. |
Yeah that should work. It seems the issue is that we don't start the cache: controller-runtime/pkg/manager/internal.go Lines 208 to 217 in 386c2b5
|
@jsanda Actually it will be started. When adding a Cluster into a started Manager (and the Cluster does not require resource lock), Manager will start it immediately. https://github.com/kubernetes-sigs/controller-runtime/blob/master/pkg/manager/internal.go#L221 BTW, it is also weird that the new cluster is decided to start according to the resource lock acquired in the previous cluster. They could be different K8s clusters. |
That's what I observed from prior testing. |
@alvaroaleman I may have some questions along the way, but I would be happy to work on a PR for this. |
@jsafrane sure, feel free to take a stab |
I am working on a multi-cluster operator project. We following the changes described in https://github.com/kubernetes-sigs/controller-runtime/blob/master/designs/move-cluster-specific-code-out-of-manager.md initializing a
Cluster
for each remote k8s cluster. It works great, so thanks for that :)I would like to add (and remove)
Clusters
at runtime after theManager
has already started. It doesn't look like that is possible today. I have been trying to get more familiar with theManager
code to get a better sense of what I need to do to manage theCluster
on my own. It definitely looks non-trivial. Maybe I am wrong but it looks like I would have to reimplement a fair bit of logic fromcontrollerManager
.This brings me to my question. Are there any plans to support adding a
Cluster
to theManager
after it has been started? What are some of the caveats with doing this?The text was updated successfully, but these errors were encountered: