fix(helm): disable controller metrics when bindAddress is empty or 0 (#2785)
## Summary
Fixes an issue where the metrics port was still rendered as
`containerPort: 0` when metrics were disabled using `bindAddress: "0"`
or an empty `bindAddress`.
The deployment was checking `.Values.controller.metrics.enabled`
directly, while the other metrics-related resources use the
`kagent.controller.metricsEnabled` helper.
## Fix
Use the same helper for the metrics port:
```diff
- {{- if .Values.controller.metrics.enabled }}
+ {{- if include "kagent.controller.metricsEnabled" . }}
```
This keeps all metrics-related resources consistent and does not change
the default `:8443` behavior.
## Tests
* Fixed the existing port assertions to use `any: true`.
* Added coverage for an empty `bindAddress`.
* `helm unittest helm/kagent`: **284 passed, 21 suites**
* Verified with `helm template` that the port is omitted for `0` and
`""`, and remains `8443` by default.
Fixes #2736
Signed-off-by: Gous0786 <gousalam0786@gmail.com> M
Mohammad Gous Alam committed
f378edffe1cf083e6f891047f4de612adf3e857a
Parent: 294976d
Committed by GitHub <noreply@github.com>
on 9/10/2026, 10:23:29 PM