:8080 metrics port collision when starting a new init controller for a different WorkspaceType
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 76/100
Research direction
Start in internal/controller/targetcontroller/controller.go at createMulticlusterManager and inspect how the primary and subsequent managers configure metrics. Reproduce the second InitTarget scenario with different WorkspaceTypes, then verify that the new init controller starts without a :8080 bind collision and handles the target.
Written by the indexing model from the issue text.
Description
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
- 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.
Environment
- init-agent: main, commit 6ad35e2
- Dominant language
- Go
- Stars
- 0
- Forks
- 5
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from kcp-dev/init-agent
-
Difficulty 3/5 1-2 days Newbie friendliness 55/100
kcp-dev/init-agent#25 ·
-
kind/feature
Difficulty 3/5 1-2 days Newbie friendliness 55/100
kcp-dev/init-agent#24 ·
All issues in kcp-dev/init-agent
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 84/100
-
enhancement needs triage
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
kind/cleanup
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
kubernetes-sigs/kueue#15947 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
sympozium-ai/sympozium#627 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100