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 issue with starting multiple test envs #1913

Conversation

k8s-infra-cherrypick-robot

This is an automated cherry-pick of #1910

/assign alvaroaleman

When starting a single test environment [1], the control plane start-up
logic [2] launches an etcd and kube-apiserver process. The start-up
logic needs to bind these processes to multiple ports, and when none are
configured in advance, the logic looks for unused ports, and then
creates files in the user cache directory to reserve them (for example,
[3]).

However, the same logic used to reserve ports  also has logic that
deletes files corresponding to "outdated" ports [4].

Therefore, if there are multiple processes/threads starting a test
environment, they may sometimes end up trying to delete the same file
which causes a "file not found" error.

This commit adds logic so that trying to start multiple test
environments does not fail if more than one tries to delete the same
file corresponding to an outdated port.

[1] https://github.com/kubernetes-sigs/controller-runtime/blob/7fb8534b80339a5b8158cee3dc9e5f9439d679dc/pkg/envtest/server.go#L197
[2] https://github.com/kubernetes-sigs/controller-runtime/blob/7fb8534b80339a5b8158cee3dc9e5f9439d679dc/pkg/internal/testing/controlplane/plane.go#L49
[3] https://github.com/kubernetes-sigs/controller-runtime/blob/7fb8534b80339a5b8158cee3dc9e5f9439d679dc/pkg/internal/testing/controlplane/etcd.go#L120
[4] https://github.com/kubernetes-sigs/controller-runtime/blob/7fb8534b80339a5b8158cee3dc9e5f9439d679dc/pkg/internal/testing/addr/manager.go#L64
@k8s-ci-robot k8s-ci-robot requested review from alexeldeib and mengqiy May 24, 2022
@k8s-ci-robot k8s-ci-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label May 24, 2022
@k8s-ci-robot k8s-ci-robot added the lgtm Indicates that a PR is ready to be merged. label May 24, 2022
@k8s-ci-robot
Copy link
Contributor

k8s-ci-robot commented May 24, 2022

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: alvaroaleman, k8s-infra-cherrypick-robot

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 May 24, 2022
@alvaroaleman alvaroaleman changed the title [release-0.12] 🐛 Fix issue with starting multiple test envs 🐛 Fix issue with starting multiple test envs May 24, 2022
@alvaroaleman
Copy link
Member

alvaroaleman commented May 24, 2022

/check-cla

@alvaroaleman
Copy link
Member

alvaroaleman commented May 24, 2022

/easycla

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label May 24, 2022
@k8s-ci-robot k8s-ci-robot merged commit 160efcb into kubernetes-sigs:release-0.12 May 24, 2022
7 of 8 checks passed
@jcanseco
Copy link
Contributor

jcanseco commented May 24, 2022

Thanks @alvaroaleman. What happens from here? Is there an automated process that will cut a release now, or is there some action I need to take?

@jcanseco
Copy link
Contributor

jcanseco commented May 27, 2022

Just a gentle ping on the above question

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. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm Indicates that a PR is ready to be merged. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants