Skip to content

gateway-api: exclude conflicted listeners from translation - #47306

Merged
mhofstetter merged 1 commit into
cilium:mainfrom
AkashKumar7902:agent/fix-gateway-protocol-conflict
Jul 24, 2026
Merged

gateway-api: exclude conflicted listeners from translation#47306
mhofstetter merged 1 commit into
cilium:mainfrom
AkashKumar7902:agent/fix-gateway-protocol-conflict

Conversation

@AkashKumar7902

Copy link
Copy Markdown
Contributor

Please ensure your pull request adheres to the following guidelines:

  • For first time contributors, read Submitting a pull request
  • All code is covered by unit and/or runtime tests where feasible.
  • All commits contain a well written commit description including a title,
    description and a Fixes: #XXX line if the commit addresses a particular
    GitHub issue.
  • If your commit description contains a Fixes: <commit-id> tag, then
    please add the commit author[s] as reviewer[s] to this issue.
  • All commits are signed off. See the section Developer’s Certificate of Origin
  • Provide a title or release-note blurb suitable for the release notes.
  • Disclose use of machine learning models (including LLMs and other generative AI)
    in accordance with the Cilium AI Policy, and indicate the rating using
    AI Influence Level.
    Example: "This PR was prepared with AIL:3. I personally checked X."
  • Thanks for contributing!

Gateway listener conflicts (e.g. two listeners sharing a port with
ProtocolConflict) are reflected correctly in Gateway status, but every
configured listener was still passed into the translation pipeline. As a
result, rejected/conflicted listeners could still be programmed into Envoy
and serve traffic, as long as the Gateway had at least one other accepted
listener keeping it Programmed.

This excludes conflicted direct Gateway listeners when building the merged
listener model in resolveAllowedListeners, so only listeners that are
actually accepted are handed to translation. The tlsroute-mixed-protocol-listeners
golden CEC fixture is updated to assert that port 443, its TLS filter
chains, route config, and backend are absent from the resulting Envoy
config, instead of asserting their presence.

Fixes: #46917

This PR was prepared with AIL:3. I personally checked that the conflicted
listener exclusion only applies to already-rejected listeners (Gateway
status Accepted=False/Conflicted=ProtocolConflict) and verified the
regenerated golden fixture no longer emits port 443 or its associated TLS
chains, route config, and backend.

gateway-api: exclude conflicted listeners from Envoy programming

Gateway listener conflicts are reflected in status, but all configured
listeners are currently passed to ingestion. This can cause rejected
listeners to be programmed whenever another listener keeps the Gateway valid.

Exclude conflicted direct Gateway listeners when building the merged
listener model. Update the golden CEC to assert that port 443, its filter
chains, and its backend are not emitted.

Fixes: cilium#46917

Signed-off-by: Akash Kumar <[email protected]>
@AkashKumar7902
AkashKumar7902 requested a review from a team as a code owner July 18, 2026 09:43
@AkashKumar7902
AkashKumar7902 requested a review from youngnick July 18, 2026 09:43
@maintainer-s-little-helper maintainer-s-little-helper Bot added the dont-merge/needs-release-note-label The author needs to describe the release impact of these changes. label Jul 18, 2026
@github-actions github-actions Bot added feature/k8s-gateway-api kind/community-contribution This was a contribution made by a community member. labels Jul 18, 2026
@asauber

asauber commented Jul 21, 2026

Copy link
Copy Markdown
Member

This looks like a good first start towards resolving the issue. A few questions:

  1. Does the same bug still exist for ListenerSet listeners?
  2. Are there cases where this change prevents status from being written to excluded listeners?
  3. Are there missing test cases that cover the above?

If the answer to these questions is "no, no, no", then this looks like a good patch to me.

I'm currently reviewing this area of the code to explore those questions. Let me know what you find.

@asauber asauber added the release-note/bug This PR fixes an issue in a previous release of Cilium. label Jul 21, 2026
@maintainer-s-little-helper maintainer-s-little-helper Bot removed the dont-merge/needs-release-note-label The author needs to describe the release impact of these changes. label Jul 21, 2026
@asauber
asauber self-requested a review July 21, 2026 02:07
@asauber asauber self-assigned this Jul 21, 2026
@asauber

asauber commented Jul 21, 2026

Copy link
Copy Markdown
Member

Does the same bug still exist for ListenerSet listeners?

I've confirmed that the bug does still exist for ListenerSet listeners, but this can be treated as a separate issue.

Are there cases where this change prevents status from being written to excluded listeners?

No, given that the conflicted checks are re-calculated for status writing, this change does not affect status writing

Are there missing test cases that cover the above?

There are at least three missing test cases for this type of "a rejected listener should not reach translation" issue, but they can be treated as separate issues. I will open a PR with each test case on a separate commit so that we can discuss there.

Given that this is the correct fix for this specific test case variant. I'm inclined to approve.

@youngnick

Copy link
Copy Markdown
Contributor

/test

@asauber

asauber commented Jul 24, 2026

Copy link
Copy Markdown
Member

I included this commit as part of a wider fix that fixes the bug for ListenerSets as well. #47457

I would say that this is fine to merge, and I can rebase the new PR, or we can close this one and review that one.

Either way, thank you for the contribution and please continue to contribute concise fixes for specific issues.

@mhofstetter mhofstetter added area/servicemesh GH issues or PRs regarding servicemesh needs-backport/1.20 This PR / issue needs backporting to the v1.20 branch kind/bug This is a bug in the Cilium logic. labels Jul 24, 2026
@mhofstetter
mhofstetter added this pull request to the merge queue Jul 24, 2026
Merged via the queue into cilium:main with commit e5dd26b Jul 24, 2026
88 checks passed
@nbusseneau nbusseneau mentioned this pull request Jul 27, 2026
17 tasks
@nbusseneau nbusseneau added backport-pending/1.20 The backport for Cilium 1.20.x for this PR is in progress. and removed needs-backport/1.20 This PR / issue needs backporting to the v1.20 branch labels Jul 27, 2026
@github-actions github-actions Bot added backport-done/1.20 The backport for Cilium 1.20.x for this PR is done. and removed backport-pending/1.20 The backport for Cilium 1.20.x for this PR is in progress. labels Jul 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/servicemesh GH issues or PRs regarding servicemesh backport-done/1.20 The backport for Cilium 1.20.x for this PR is done. feature/k8s-gateway-api kind/bug This is a bug in the Cilium logic. kind/community-contribution This was a contribution made by a community member. release-note/bug This PR fixes an issue in a previous release of Cilium.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

gateway-api: rejected ProtocolConflict listeners still serve traffic

5 participants