config-reloader ContainerPort ignores configReloaderExtraArgs http.listenAddr (hostNetwork port conflict)

Aperta
#2,584 5 commenti 0 reazioni 1 assegnatario Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@Haleygo ci sta già lavorando.

Dal 4/11/2026.

  • #2585 di @cesium147 — integrata

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
72/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
go, kubernetes

Direzione di ricerca

Iniziate in internal/controller/operator/factory/build/container.go leggendo ConfigReloaderContainer, addPortProbesToConfigReloaderContainer e ConfigReloaderDefaultPort, quindi esaminate internal/controller/operator/factory/reconcile/config_reload.go per configReloaderMetricsURL. Aggiungete i casi richiesti a container_test.go e verificate che le porte dei container, le probe e il polling delle metriche utilizzino la porta configurata con il fallback e le forme degli indirizzi documentati.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

enhancement waiting for release

Summary

The operator always sets containerPort to the constant 8435 (ConfigReloaderDefaultPort in internal/controller/operator/factory/build/container.go) when building the config-reloader sidecar. Changing the process listen address with spec.configReloaderExtraArgs["http.listenAddr"] updates container args only. Neither containerPort nor the generated HTTP liveness/readiness probes respect the overridden port — both stay locked to 8435, so the kube-scheduler still sees a host port conflict even when the process listens elsewhere.

On nodes with hostNetwork: true, that blocks scheduling a second DaemonSet that also needs a config-reloader: Kubernetes reports that the node did not have free ports for the requested pod ports (didn't have free ports…), even when one process listens on 8435 and another on 8436 via http.listenAddr.

CommonConfigReloaderParams is shared across VMAgent, VMAuth, VMSingle, VMAlertmanager, and VMAlert. The bug lives in the common builder build.ConfigReloaderContainer and affects any component that uses configReloaderExtraArgs to change the listen address.

Environment

  • Operator: v0.74.0 (also reproduced in source of v0.74.1, v0.75.0-rc1, and current master as of 2026-09-04)
  • Resources: two VMAgent DaemonSets with hostNetwork: true on the same node
  • Sidecar: default VictoriaMetrics config-reloader

Steps to reproduce

  1. Deploy two VMAgent CRs as DaemonSets with hostNetwork: true (and otherwise valid scrape config).
  2. On the second agent, override the reloader listen port, for example:
spec:
  hostNetwork: true
  configReloaderExtraArgs:
    http.listenAddr: "127.0.0.1:8436"
  1. Observe PodSpec of the second DaemonSet: config-reloader still has containerPort: 8435 and probes targeting 8435, while args include --http.listenAddr=127.0.0.1:8436.
  2. Scheduler fails to place the second pod on a node that already runs the first agent’s reloader on host port 8435.

Expected

ContainerPort and HTTP probe ports for config-reloader should follow the port from configReloaderExtraArgs["http.listenAddr"] when set (with fallback to 8435).

Actual

Process listens on the overridden address (127.0.0.1:8436). PodSpec still declares containerPort: 8435 and probes 8435. Scheduler rejects the pod on a node that already exposes host port 8435 for another agent’s reloader.

Proposed fix

  1. Parse the port from ConfigReloaderExtraArgs["http.listenAddr"] (support :PORT, IP:PORT, [IPv6]:PORT).
  2. Use that port for ContainerPort and liveness/readiness probes in addPortProbesToConfigReloaderContainer (default 8435 if unset/invalid).
  3. Align scrape endpoint builders that hardcode 8435 if they scrape the sidecar by numeric port.
  4. Update configReloaderMetricsURL in internal/controller/operator/factory/reconcile/config_reload.go, which also hardcodes build.ConfigReloaderDefaultPort (8435). Controllers that call WaitForConfigReloadHash (e.g. VMAuth) poll /metrics on that URL; when the sidecar listen port is overridden, they keep polling 8435 and eventually time out. configReloaderMetricsURL should resolve the configured port the same way as ContainerPort and probes.
  5. Add unit tests in container_test.go for default, overridden, IPv6, and invalid values.

Related

  • VictoriaMetrics/operator#1581 — IPv6 / enableTCP6 / http.listenAddr interaction (different symptom; related listen-address handling).
  • VictoriaMetrics/operator#1308 — hardcoded config-reloader probes with proxy-protocol (probe port behavior; not hostNetwork / ContainerPort scheduling).

Related code

  • internal/controller/operator/factory/build/container.go: ConfigReloaderDefaultPort, ConfigReloaderContainer, addPortProbesToConfigReloaderContainer
Lingua principale
Go
Stelle
603
Fork
242
Merge medio
1g 14h
PR unite (30g)
57

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di VictoriaMetrics/operator

Tutte le issue di VictoriaMetrics/operator

Issue simili

Altre issue su Go

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.