You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When init-agent picks up an InitTarget pointing at a WorkspaceType it hasn't seen yet, `targetcontroller` calls `createMulticlusterManager()` which calls `mcmanager.New(wstConfig, provider, manager.Options{Scheme: scheme})` without specifying `Metrics.BindAddress`. controller-runtime defaults to `:8080`, which is already in use by the FIRST manager.
Result: the new init controller fails to start with:
```
Failed to run multicluster manager ctrlkey=root:account error=failed to start metrics server: failed to create listener: listen tcp :8080: bind: address already in use
```
The new InitTarget is effectively ignored until the pod restarts (and it happens to start with that target already known).
Reproduction
Run init-agent with one InitTarget A targeting WT `foo`.
Apply a second InitTarget B targeting WT `bar`.
init-agent's targetcontroller logs "Creating new init controller…" and then crashes the new manager on port collision.
Suggested fix
In `internal/controller/targetcontroller/controller.go` `createMulticlusterManager`, set `manager.Options{ ..., Metrics: metricsserver.Options{BindAddress: "0"} }` for all subsequent managers, OR allocate distinct ports automatically. Only the primary manager needs metrics.
Bug
When init-agent picks up an InitTarget pointing at a WorkspaceType it hasn't seen yet, `targetcontroller` calls `createMulticlusterManager()` which calls `mcmanager.New(wstConfig, provider, manager.Options{Scheme: scheme})` without specifying `Metrics.BindAddress`. controller-runtime defaults to `:8080`, which is already in use by the FIRST manager.
Result: the new init controller fails to start with:
```
Failed to run multicluster manager ctrlkey=root:account error=failed to start metrics server: failed to create listener: listen tcp :8080: bind: address already in use
```
The new InitTarget is effectively ignored until the pod restarts (and it happens to start with that target already known).
Reproduction
Suggested fix
In `internal/controller/targetcontroller/controller.go` `createMulticlusterManager`, set `manager.Options{ ..., Metrics: metricsserver.Options{BindAddress: "0"} }` for all subsequent managers, OR allocate distinct ports automatically. Only the primary manager needs metrics.
Environment