-
Notifications
You must be signed in to change notification settings - Fork 0
Vesuvius dnsmasq netboot #6
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
Open
mehbark
wants to merge
15
commits into
main
Choose a base branch
from
vesuvius-dnsmasq-netboot
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
6e757d8
vesuvius: netboot prospit
mehbark 3fcba78
corrected netboot configuration to avoid interface leakage and correc…
Ralakus 10ebb8f
corrected dhcp interface
Ralakus eb25e22
hosts/vesuvius: change DNS domain from hephaestus to bastille
mehbark 56bf0e8
hosts/common: refactor to remove k3s-ports.nix
mehbark 7128fff
hosts/prospit: set k3s role
mehbark 4dc169a
hosts/vesuvius: become the k3s cluster init
mehbark 194b9cb
hosts/common/k3s: refactor to take role and clusterInit args
mehbark 3845c0b
hosts/prospit: be adopted by bastille
mehbark 3a8573f
hosts/bastille: fix root password warning
mehbark 6041f78
hosts/bastille: automatically set hostname based on mac address
mehbark 95545c0
hosts/bastille: add some actual names to auto-hostname
mehbark 5364e33
fix(common/k3s): use cluster routing IP for vesuvius
kurisufriend 946ab79
Merge branch 'main' into vesuvius-dnsmasq-netboot
kurisufriend 86cf66c
Merge branch 'main' into vesuvius-dnsmasq-netboot
kurisufriend File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| { pkgs, lib, ... }: | ||
| let | ||
| names = import ./blade-names.nix; | ||
|
|
||
| bash-sets = lib.mapAttrsToList (mac: name: "names['${mac}']='${name}'") names; | ||
|
|
||
| auto-hostname = pkgs.writeShellApplication { | ||
| name = "auto-hostname"; | ||
|
|
||
| runtimeInputs = [ | ||
| pkgs.hostname | ||
| ]; | ||
|
|
||
| text = '' | ||
| if [[ -e "/sys/class/net/eno2/address" ]]; then | ||
| mac_file="/sys/class/net/eno2/address" | ||
| else | ||
| mac_file=/sys/class/net/enp0s25/address | ||
| fi | ||
|
|
||
| mac=$(cat $mac_file | tr -d '\r\n ') | ||
|
|
||
| declare -A names | ||
| ${lib.concatLines bash-sets} | ||
|
|
||
| if [[ -v names[$mac] ]]; then | ||
| name=''${names[$mac]} | ||
| else | ||
| name="node-(echo $mac | tr ':' '-')" | ||
| fi | ||
|
|
||
| echo "mac: '$mac'" | ||
| echo "name: '$name'" | ||
|
|
||
| hostname "$name" | ||
| echo "hostname set to '$(hostname)'" | ||
| ''; | ||
| }; | ||
| in { | ||
| networking.hostName = ""; | ||
|
|
||
| systemd.services."auto-hostname" = { | ||
| wantedBy = [ "multi-user.target" ]; | ||
| after = [ "network.target" ]; | ||
|
|
||
| unitConfig = { | ||
| Description = "Automatically set the hostname "; | ||
| }; | ||
|
|
||
| serviceConfig = { | ||
| Type = "oneshot"; | ||
| ExecStart = "${lib.getExe auto-hostname}"; | ||
| }; | ||
| }; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,16 +1,18 @@ | ||
| # keep-sorted start | ||
| [ | ||
| "backbiter" | ||
| "damocles" | ||
| "durendal" | ||
| "eyelander" | ||
| "excalibur" | ||
| "gram" | ||
| "gryffindor" | ||
| "kusanagi" | ||
| "narsil" | ||
| "oathbringer" | ||
| "riptide" | ||
| "sting" | ||
| ] | ||
| # keep-sorted end | ||
| { | ||
| # TODO: prospit's a special case and won't remain here forever | ||
| "d8:9e:f3:3e:f9:41" = "prospit"; | ||
|
|
||
| "40:f2:e9:c6:65:5f" = "backbiter"; | ||
| "40:f2:e9:c6:69:43" = "damocles"; | ||
| "40:f2:e9:c6:69:67" = "durendal"; | ||
| "40:f2:e9:c6:74:59" = "eyelander"; | ||
| "40:f2:e9:c6:75:f1" = "excalibur"; | ||
| "40:f2:e9:c6:76:21" = "gram"; | ||
|
|
||
| "unassigned-0" = "gryffindor"; | ||
| "unassigned-1" = "kusanagi"; | ||
| "unassigned-2" = "narsil"; | ||
| "unassigned-3" = "oathbringer"; | ||
| "unassigned-4" = "riptide"; | ||
| "unassigned-5" = "sting"; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| { modulesPath, pkgs, lib, ... }: { | ||
| imports = [ | ||
| ./auto-hostname.nix | ||
| (import ../common/k3s.nix {}) | ||
| ../common/nix.nix | ||
| ../common/sshd.nix | ||
| ../common/users-local.nix | ||
| (modulesPath + "/installer/netboot/netboot-minimal.nix") | ||
| ]; | ||
|
|
||
| # when making the ISO, the initialHashedPassword is set to "" for some reason | ||
| # we already set a hashed password, so null this | ||
| users.users.root.initialHashedPassword = lib.mkForce null; | ||
|
|
||
| environment.systemPackages = [ | ||
| pkgs.fastfetch | ||
| ]; | ||
|
|
||
| system.stateVersion = "25.11"; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| { role ? "agent", clusterInit ? false }: { | ||
| networking.firewall.allowedTCPPorts = [ | ||
| 6443 | ||
| ]; | ||
|
|
||
| networking.firewall.allowedUDPPorts = [ | ||
| 8472 | ||
| ]; | ||
|
|
||
| services.k3s = { | ||
| inherit role clusterInit; | ||
|
|
||
| enable = true; | ||
| token = "garbage secret"; | ||
| serverAddr = "https://10.98.3.2:6443"; | ||
| }; | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use real secret
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could be added to the agenix secrets