Skip to content

feat: make the Prometheus exporter bind address configurable - #4953

Open
GitHubxsy wants to merge 1 commit into
open-policy-agent:masterfrom
GitHubxsy:feat/prometheus-bind-address
Open

GitHubxsy wants to merge 1 commit into
open-policy-agent:masterfrom
GitHubxsy:feat/prometheus-bind-address

Conversation

@GitHubxsy

Copy link
Copy Markdown

What this PR does / why we need it

Gatekeeper's Prometheus exporter listens on all local interfaces. Operators can change its port, but cannot restrict the listener to loopback when a collector runs alongside Gatekeeper in the same Pod.

Add --prometheus-bind-address and expose it to both the audit and controller-manager Deployments through the Helm value prometheusBindAddress. For example, setting the value to 127.0.0.1 restricts scraping to IPv4 loopback. The default remains an empty host so existing Pod IP and Service scrapes continue to work. Each Deployment keeps its own metrics port.

Special notes for your reviewer

The exporter uses net.JoinHostPort so an IPv6 address such as ::1 works with the existing --prometheus-port flag. The controller-runtime metrics listener is independent of this exporter.

Testing

  • Passed the Prometheus exporter package tests, including the default, a custom port, and IPv4 and IPv6 loopback addresses.
  • Started the exporter and received HTTP 200 from /metrics on both loopback families.
  • Passed Helm lint and checked the rendered arguments for both Deployments with default, IPv4, and IPv6 values and distinct ports.
  • The full local make native-test run failed with linker processes killed and envtest API server startup timeouts. Local make lint could not run because Docker was unavailable.

@GitHubxsy
GitHubxsy requested a review from a team as a code owner December 2, 2026 02:49
@linux-foundation-easycla

linux-foundation-easycla Bot commented Dec 2, 2026 •

Copy link
Copy Markdown

CLA Signed
The committers listed above are authorized under a signed CLA.

  • ✅ login: GitHubxsy / name: xsy (ef1f7c9)

@GitHubxsy
GitHubxsy force-pushed the feat/prometheus-bind-address branch from ef1f7c9 to 6f26470 Compare December 3, 2026 06:27
Signed-off-by: xsy <xieshiyi1@huawei.com>
@GitHubxsy
GitHubxsy force-pushed the feat/prometheus-bind-address branch from 6f26470 to d269304 Compare December 3, 2026 06:29

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant