Skip to content
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

Fix SCTP default-deny test #110395

Merged
merged 1 commit into from Jun 7, 2022
Merged

Conversation

tnqn
Copy link
Member

@tnqn tnqn commented Jun 6, 2022

What type of PR is this?

/kind cleanup
/kind flake

What this PR does / why we need it:

The test is about SCTP and the accessed service only forwarded SCTP traffic to the server Pod but the client Pod used TCP protocol, so the test traffic never reached the server Pod and the test NetworkPolicy was never enforced, which lead to test success even if the default-deny policy was implemented wrongly. In some cases it may got failure result if there was an external server having same IP as the cluster IP and listening to TCP 80 port.

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?

NONE

Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:


The test is about SCTP and the accessed service only forwarded SCTP
traffic to the server Pod but the client Pod used TCP protocol, so the
test traffic never reached the server Pod and the test NetworkPolicy
was never enforced, which lead to test success even if the default-deny
policy was implemented wrongly. In some cases it may got failure result
if there was an external server having same IP as the cluster IP and
listening to TCP 80 port.

Signed-off-by: Quan Tian <qtian@vmware.com>
@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. kind/flake Categorizes issue or PR as related to a flaky test. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Jun 6, 2022
@k8s-ci-robot
Copy link
Contributor

@tnqn: This issue is currently awaiting triage.

If a SIG or subproject determines this is a relevant issue, they will accept it by applying the triage/accepted label and provide further guidance.

The triage/accepted label can be added by org members by writing /triage accepted in a comment.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot added needs-priority Indicates a PR lacks a `priority/foo` label and requires one. area/network-policy Issues or PRs related to Network Policy subproject area/test sig/network Categorizes an issue or PR as relevant to SIG Network. sig/testing Categorizes an issue or PR as relevant to SIG Testing. and removed do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Jun 6, 2022
@aojea
Copy link
Member

aojea commented Jun 6, 2022

In some cases it may got failure result if there was an external server having same IP as the cluster IP and listening to TCP 80 port.

besides the protocol thing, how can not be a failure if there is a deny-all?

@tnqn
Copy link
Member Author

tnqn commented Jun 6, 2022

In some cases it may got failure result if there was an external server having same IP as the cluster IP and listening to TCP 80 port.

besides the protocol thing, how can not be a failure if there is a deny-all?

The test client Pod accessed TCP/80 port of the service while kube-proxy (or similar proxies) only proxied SCTP/80 traffic. The traffic didn't reach the backend Pod and was routed to external network. If there is an server configured with this IP, the test would be a failure (it got response). I found this issue because of this case.

Besides, even when the test is a success, it's not because of the enforcement of the deny-all policy, but because the traffic was routed to external network and dropped there.

@aojea
Copy link
Member

aojea commented Jun 6, 2022

he traffic didn't reach the backend Pod and was routed to external network. If there is an server configured with this IP, the test would be a failure (it got response). I found this issue because of this case.

wow, what are the odds? so you have an overlapping network with connectivity and the packet unfortunately hits the other network

/test pull-kubernetes-e2e-ubuntu-gce-network-policies

Kubernetes e2e suite: [sig-network] NetworkPolicyLegacy [LinuxOnly] NetworkPolicy between server and client should deny ingress access to updated pod [Feature:NetworkPolicy] expand_more	

@aojea
Copy link
Member

aojea commented Jun 6, 2022

/lgtm
/approve
The test failure is unrelated to this PR

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jun 6, 2022
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: aojea, tnqn

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 6, 2022
@tnqn
Copy link
Member Author

tnqn commented Jun 6, 2022

he traffic didn't reach the backend Pod and was routed to external network. If there is an server configured with this IP, the test would be a failure (it got response). I found this issue because of this case.

wow, what are the odds? so you have an overlapping network with connectivity and the packet unfortunately hits the other network

Yes, I guess it's normal that the underlay network has overlapping with the default service CIDR as the former could use 10.0.0.0/8 and the latter is 10.96.0.0/12. When the test failed, the allocated service IP was "10.110.83.242", which looked like a very normal priviate IP and it was indeed used by a server in my corporate network.

@aojea
Copy link
Member

aojea commented Jun 6, 2022

/hold

I'm holding just to check that the job that test the network policies doesn't fail, it is not required and we can merge with it failing

pull-kubernetes-e2e-ubuntu-gce-network-policies

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jun 6, 2022
@aojea
Copy link
Member

aojea commented Jun 7, 2022

/hold cancel
Job passed
Thanks for keep fixing things 😄 👏

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jun 7, 2022
@k8s-ci-robot k8s-ci-robot merged commit 198dd76 into kubernetes:master Jun 7, 2022
@k8s-ci-robot k8s-ci-robot added this to the v1.25 milestone Jun 7, 2022
@tnqn tnqn deleted the fix-sctp-test branch June 7, 2022 15:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/network-policy Issues or PRs related to Network Policy subproject area/test cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. kind/flake Categorizes issue or PR as related to a flaky test. lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. release-note-none Denotes a PR that doesn't merit a release note. sig/network Categorizes an issue or PR as relevant to SIG Network. sig/testing Categorizes an issue or PR as relevant to SIG Testing. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants