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

Do not hardcode vagrant network details #136

Merged
merged 3 commits into from
May 13, 2022

Conversation

mmlb
Copy link
Contributor

@mmlb mmlb commented May 13, 2022

Description

Allows for overriding the default vagrant/libvirt network details.

Why is this needed

Lets us use the vagrant and compose setup in a sort of hybrid mode with a real hw machine as machine1 instead of the VM.

How Has This Been Tested?

Ran vagrant up and verified defaults still work and overrides do in fact show up.

How are existing users impacted? What migration steps/scripts do we need?

A way to test with real hardware while using the vagrant setup for the services.

@mmlb mmlb force-pushed the configurable-machine1-macs-in-vagrant branch from ed58eb9 to 78dab2e Compare May 13, 2022 15:45
@mmlb mmlb requested a review from nshalman May 13, 2022 15:48
@mmlb mmlb force-pushed the configurable-machine1-macs-in-vagrant branch 2 times, most recently from 5b09a3b to ffd1627 Compare May 13, 2022 15:57
mmlb added 3 commits May 13, 2022 11:58
This is both more accurate (macs are also addrs) and matches the names in
the Vagrantfile.

Signed-off-by: Manuel Mendez <github@i.m.mmlb.dev>
This way its not hard coded in setup.sh and thus soon able to be changed.

Signed-off-by: Manuel Mendez <github@i.m.mmlb.dev>
This is nice to be able to have a hybrid setup with some things in vagrant
and actual hardware as long as its all bridged up nicely.  We can pretend
that machine1 is going to be used and thus go through all the tink setup
for it but then boot our real machine.

Signed-off-by: Manuel Mendez <github@i.m.mmlb.dev>
@mmlb mmlb force-pushed the configurable-machine1-macs-in-vagrant branch 2 times, most recently from 6403222 to 77b43e9 Compare May 13, 2022 15:58
Copy link
Member

@nshalman nshalman left a comment

Choose a reason for hiding this comment

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

The use of downcase seems odd when the hardcoded MAC in the Vagrantfile was using upppercase. But if it all works, then presumably the code that uses that value doesn't care.

@mmlb
Copy link
Contributor Author

mmlb commented May 13, 2022

The use of downcase seems odd when the hardcoded MAC in the Vagrantfile was using upppercase. But if it all works, then presumably the code that uses that value doesn't care.

Yeah, but the hardcoded mac in ../compose/.env is lowercase so I decided to keep it that way.

@mmlb mmlb added the ready-to-merge Signal to Mergify to merge the PR. label May 13, 2022
@mergify mergify bot merged commit fb4bc1d into tinkerbell:main May 13, 2022
@mmlb mmlb deleted the configurable-machine1-macs-in-vagrant branch May 13, 2022 16:10
@double-p
Copy link

To use a dedicated adapter (real hardware, and not everybody can tinker(!) the surrounding network to isolate VLANs etc..) one has to switch to public networking and add the hardware.
I am doing this for quite a while now:

    provisioner.vm.network "public_network", ip: PROVISIONER_IP, bridge: ENV['MYTINK_BRIDGEDEV'],

and if the real MACHINE_1 shall get network/internet access:

    provisioner.vm.provision "shell", name: "iptables", inline: <<-SCRIPT.gsub(/^ {6}/, "")
      set -x
      /usr/sbin/iptables --policy FORWARD ACCEPT
      /usr/sbin/iptables -t nat -A POSTROUTING -s #{MACHINE1_IP} -j MASQUERADE
    SCRIPT

the policy could be more strict, but "it works".

('Philipp' from chat)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready-to-merge Signal to Mergify to merge the PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants