Skip to content

Vagrant: Ensure IP Subnet not in use by localhost #12332

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

Conversation

munchtoast
Copy link
Contributor

@munchtoast munchtoast commented Jun 21, 2025

What this PR does / why we need it:
If Vagrantfile targets a subnet in use by localhost, VMs will not be able to deploy successfully. This PR checks localhost subnets in use and determines if Vagrantfile subnet is non-conflicting.

Which issue(s) this PR fixes:

Fixes #12331

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

NONE

@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. kind/feature Categorizes issue or PR as related to a new feature. labels Jun 21, 2025
Copy link

linux-foundation-easycla bot commented Jun 21, 2025

CLA Signed

The committers listed above are authorized under a signed CLA.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. label Jun 21, 2025
@k8s-ci-robot
Copy link
Contributor

Welcome @munchtoast!

It looks like this is your first PR to kubernetes-sigs/kubespray 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes-sigs/kubespray has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot k8s-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jun 21, 2025
@k8s-ci-robot
Copy link
Contributor

Hi @munchtoast. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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 cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels Jun 21, 2025
@yankay
Copy link
Member

yankay commented Jun 24, 2025

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jun 24, 2025
@VannTen
Copy link
Contributor

VannTen commented Jun 27, 2025

I don't see anything immediatly wrong with this.
/approve

You'll need to rebase on master to catch-up with ansible and CI changes though
Be aware that the vagrant stuff is probably gonna be axed soon (see #12237 ) though

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: munchtoast, VannTen

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 27, 2025
@munchtoast munchtoast force-pushed the add-dynamic-ruby-subnetting branch from 815ae3c to aec120c Compare June 27, 2025 13:08
@VannTen
Copy link
Contributor

VannTen commented Jun 27, 2025

/label ci-extended
/retest
(to exercise the few remaining vagrant tests and ensure this does not break them).

@k8s-ci-robot k8s-ci-robot added the ci-extended Run additional tests label Jun 27, 2025
@munchtoast
Copy link
Contributor Author

I don't see anything immediatly wrong with this. /approve

You'll need to rebase on master to catch-up with ansible and CI changes though Be aware that the vagrant stuff is probably gonna be axed soon (see #12237 ) though

Thank you! This is also a good point regarding the vagrant licensing changes. I have some bandwidth so I will try and see if I can get some MVP PR with Lima..

@VannTen
Copy link
Contributor

VannTen commented Jun 27, 2025

Hum the retest does not seem to work 🤔 ( @ant31 )

Could you re-push to retrigger the tests please ?

Thank you! This is also a good point regarding the vagrant licensing changes. I have some bandwidth so I will try and see if I can get some MVP PR with Lima..

Would be great ! Another option I've been thinking about is using opentofu with the libvirt provider, but it covers a narrower range of hypervisors (not sure what contributors usually use)

@VannTen VannTen closed this Jun 28, 2025
@VannTen VannTen reopened this Jun 28, 2025
This commit ensures that Vagrantfile supplied $subnet is not in use by
the localhost. Previously, if the subnet is in use by localhost (i.e.
bridge network), Vagrant VM boxes can not communicate.
This commit reverts the usage of Ruby .scan() which may result in
failure if program is not provided. Instead, this commit refactors to
use Socket library to determine interfaces in use, then proceeds to
compare with Vagrantfile supplied subnets. Additionally, the commit
supports IPv6 comparisons.
@munchtoast munchtoast force-pushed the add-dynamic-ruby-subnetting branch from aec120c to 0e7081c Compare July 3, 2025 18:16
@VannTen
Copy link
Contributor

VannTen commented Jul 4, 2025

/retest-failed
I think flatcar is a bit flaky.

@VannTen
Copy link
Contributor

VannTen commented Jul 4, 2025

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jul 4, 2025
@k8s-ci-robot k8s-ci-robot merged commit 1e5a203 into kubernetes-sigs:master Jul 4, 2025
60 checks passed
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. ci-extended Run additional tests cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/feature Categorizes issue or PR as related to a new feature. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. release-note-none Denotes a PR that doesn't merit a release note. 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.

Vagrant: Vagrantfile should error if subnet in use
4 participants