Skip to content

e2e testing for PreferSameZone/PreferSameNode #130945

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 commits into from
Mar 26, 2025

Conversation

danwinship
Copy link
Contributor

What this PR does / why we need it:

e2e tests for PreferSameZone/PreferSameNode

This also extends the existing PreferClose test to test the case where the client and server are in the same zone but not on the same node.

This required a lot of refactoring to avoid just totally duplicating everything multiple times...

Does this PR introduce a user-facing change?

NONE

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

- [KEP]: https://github.com/kubernetes/enhancements/issues/3015

/kind cleanup
/sig network
/assign @aojea @gauravkghildiyal

@k8s-ci-robot k8s-ci-robot added the release-note-none Denotes a PR that doesn't merit a release note. label Mar 20, 2025
@k8s-ci-robot k8s-ci-robot added kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. sig/network Categorizes an issue or PR as relevant to SIG Network. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Mar 20, 2025
@k8s-ci-robot
Copy link
Contributor

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-sigs/prow repository.

@k8s-ci-robot k8s-ci-robot added needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. area/test sig/testing Categorizes an issue or PR as relevant to SIG Testing. labels Mar 20, 2025
@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 20, 2025
@aojea
Copy link
Member

aojea commented Mar 20, 2025

/test pull-kubernetes-e2e-kind-multizone

@danwinship
Copy link
Contributor Author

/hold
to make sure we get all the required test coverage

@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 Mar 20, 2025
@aojea
Copy link
Member

aojea commented Mar 20, 2025

see the error message with instructions to fix it

�[1m�[38;5;9mUnknown Decorator�[0m
  �[38;5;243mk8s.io/kubernetes/test/e2e/network/traffic_distribution.go:398�[0m
    [It] node was passed an unknown decorator:
    'framework.label{parts:[]string{"Feature", "PreferSame Traffic Distribution"},
    explanation:"If you see this as part of an 'Unknown Decorator' error from
    Ginkgo, then you need to replace the ginkgo.It/Context/Describe call with the
    corresponding framework.It/Context/Describe or (if available)
    f.It/Context/Describe.", alphaBetaLevel:"", offByDefault:false}'

    �[1mLearn more at:�[0m �[38;5;14m�[4mhttp://onsi.github.io/ginkgo/#node-decorators-overview�[0m

@danwinship danwinship force-pushed the prefersame-e2e-test branch from e3a206c to 8d4acf6 Compare March 20, 2025 16:37
@danwinship
Copy link
Contributor Author

/test pull-kubernetes-e2e-kind-multizone

@danwinship danwinship force-pushed the prefersame-e2e-test branch from 8d4acf6 to 035b921 Compare March 20, 2025 17:56
@danwinship
Copy link
Contributor Author

/test pull-kubernetes-e2e-kind-multizone

The features are always enabled, so the tests don't need to be
conditional.
@danwinship danwinship force-pushed the prefersame-e2e-test branch from 035b921 to 9201739 Compare March 20, 2025 19:32
@danwinship
Copy link
Contributor Author

/test pull-kubernetes-e2e-kind-multizone

@@ -41,7 +40,7 @@ import (
admissionapi "k8s.io/pod-security-admission/api"
)

var _ = common.SIGDescribe(feature.TopologyHints, func() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feature in the e2e framework terminology indicates this test needs to enable something to work, does not run in a normal cluster

Copy link
Member

@aojea aojea Mar 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this test requires a cluster to have zones so we need to add the Feature label or it will be picked by any normal test ... we must not rely on skips

}
}
if len(nodeForZone) < 3 {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wasn't 2 nodes per zone in 3 zones?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a separate test for that added later.

I didn't want to remove the existing test because OpenShift CI runs in clusters with only 1 schedulable node per zone

@k8s-ci-robot k8s-ci-robot requested a review from aojea March 24, 2025 14:44
@danwinship
Copy link
Contributor Author

/test pull-kubernetes-e2e-kind-multizone

1 similar comment
@danwinship
Copy link
Contributor Author

/test pull-kubernetes-e2e-kind-multizone

@danwinship danwinship force-pushed the prefersame-e2e-test branch from 08bf379 to 99a8289 Compare March 24, 2025 18:24
@danwinship
Copy link
Contributor Author

/test pull-kubernetes-e2e-kind-multizone

@danwinship danwinship force-pushed the prefersame-e2e-test branch from 99a8289 to 0758cb4 Compare March 24, 2025 20:52
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: danwinship

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

@danwinship danwinship marked this pull request as ready for review March 24, 2025 20:52
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Mar 24, 2025
@k8s-ci-robot k8s-ci-robot requested a review from bowei March 24, 2025 20:52
Remove endpointSlicesHaveSameZoneHints check. We are testing that
connections end up at the right endpoints. We don't need to validate
_why_ they go to the right endpoints, which is already tested by other
tests anyway. (Also, validating the hints becomes more complicated in
the same-node case, where there may or may not also be same-zone hints
depending on cluster configuration.)

Remove DeferCleanup calls; we don't need to delete anything manually
because namespaced resources will automatically be deleted when the
test case's namespace is deleted.

Remove a setting of pod.NodeName that was redundant with
e2epod.SetNodeSelection().
Split the logic of creating the clients and the servers apart from the
logic of checking which clients connect to which servers. Add some
extra complexity to support additional use cases (like multiple
endpoints on the same node).
(Identical to the PreferClose test.)
The existing TrafficDistribution test didn't really distinguish "same
zone" from "same node". Add another test that makes sure there are at
least 2 nodes in each zone so it can do that.

(Keep the original test as well to avoid losing coverage in CI systems
with single-schedulable-node-per-zone clusters.)
@danwinship danwinship force-pushed the prefersame-e2e-test branch from 0758cb4 to 478a6f9 Compare March 24, 2025 22:47
@danwinship
Copy link
Contributor Author

/retest
/milestone v1.33

@gauravkghildiyal
Copy link
Member

/lgtm

Thanks!

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

LGTM label has been added.

Git tree hash: 545aca66f2d24b467cc1b50156a16bcc57cdcd2f

@k8s-triage-robot
Copy link

The Kubernetes project has merge-blocking tests that are currently too flaky to consistently pass.

This bot retests PRs for certain kubernetes repos according to the following rules:

  • The PR does have any do-not-merge/* labels
  • The PR does not have the needs-ok-to-test label
  • The PR is mergeable (does not have a needs-rebase label)
  • The PR is approved (has cncf-cla: yes, lgtm, approved labels)
  • The PR is failing tests required for merge

You can:

/retest

@k8s-ci-robot k8s-ci-robot merged commit c90a4b1 into kubernetes:master Mar 26, 2025
18 checks passed
@danwinship danwinship deleted the prefersame-e2e-test branch March 26, 2025 08:52
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/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. 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/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

5 participants