fix(policy-controller): properly index named ports in native sidecar containers#14144
Merged
Conversation
d1b894f to
4c6a96d
Compare
Closes #14103 Prometheus wasn't't able to scrape metrics on proxies injected as sidecar containers in workloads with a restrictive inbound policy (see #14103 for repro). The cause was the function in charge of indexing ports by name (`pod_tcp_ports_by_name`) wasn't considering init containers. This fix also expands the `probe_multiple_paths` unit test to include probe ports in init containers, but that was working fine. A new test `tcp_ports_by_name` was introduced that didn't pass without this fix.
adleong
approved these changes
Jun 17, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #14103
Prometheus wasn't't able to scrape metrics on proxies injected as native sidecar containers in workloads with a restrictive inbound policy (see #14103 for repro).
The cause was the function in charge of indexing ports by name (
pod_tcp_ports_by_name) wasn't considering init containers.This fix also expands the
probe_multiple_pathsunit test to include probe ports in init containers, but that was working fine.A new test
tcp_ports_by_namewas introduced that didn't pass without this fix.