-
Notifications
You must be signed in to change notification settings - Fork 3.4k
pkg/lpr: filter the backend based on the port #41411
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
+9
−3
Conversation
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
Fix the bug where proper port filtering based on the destination is not applied. consider the following dst pod with the LRP policy containers: - image: nginx:latest imagePullPolicy: Always name: nginx ports: - containerPort: 80 name: http protocol: TCP - containerPort: 443 name: https protocol: TCP - containerPort: 8080 name: http-alt protocol: TCP - containerPort: 9090 name: metrics protocol: TCP - containerPort: 3000 name: app protocol: TCP ----- apiVersion: cilium.io/v2 kind: CiliumLocalRedirectPolicy metadata: annotations: name: lrp-addr namespace: default spec: redirectBackend: localEndpointSelector: matchLabels: app: nginx-test toPorts: - port: "80" protocol: TCP redirectFrontend: addressMatcher: ip: 169.254.169.254 toPorts: - port: "8080" protocol: TCP skipRedirectFromBackend: false Without port filtering, all possible ports will be allowed, even if the destination port is specifically configured as 80: 12 169.254.169.254:8080/TCP LocalRedirect 1 => 10.244.1.86:80/TCP (active) 2 => 10.244.1.86:443/TCP (active) 3 => 10.244.1.86:3000/TCP (active) 4 => 10.244.1.86:8080/TCP (active) 5 => 10.244.1.86:9090/TCP (active) With this patch, the correct port filtering is applied, and we get the expected behavior: 14 169.254.169.254:8080/TCP LocalRedirect 1 => 10.244.1.86:80/TCP (active) Signed-off-by: Liyi Huang <liyi.huang@isovalent.com>
bb02044
to
acf036c
Compare
/test |
1 similar comment
/test |
3 tasks
Based on our doc, we have ports specified in toPorts under redirectBackend exist in the backend pod spec. I can see the unit test is using lrp to forward to 8080 but the pod is listening port 80. I ran into this issue when implementing filter the backend based on the port. That's how I find this issue. Signed-off-by: Liyi Huang <liyi.huang@isovalent.com>
/test |
joamaki
approved these changes
Sep 2, 2025
ysksuzuki
approved these changes
Sep 2, 2025
18 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
area/lrp
Impacts Local Redirect Policy.
backport-done/1.18
The backport for Cilium 1.18.x for this PR is done.
kind/bug
This is a bug in the Cilium logic.
ready-to-merge
This PR has passed all tests and received consensus from code owners to merge.
release-note/bug
This PR fixes an issue in a previous release of Cilium.
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.
see the commit message
Fixes: #41407