mirror of
https://github.com/ryan4yin/nix-config.git
synced 2026-11-13 12:13:36 +01:00
refactor: rename the three VM hosts to 12kingdoms-*
Drop the now-meaningless kubevirt- prefix and move the hosts out of hosts/k8s/, following the existing 12kingdoms-shoukei layout: the directory and output carry the theme prefix while the configuration, hostname and colmena target are the bare name (shoryu, shushou, youko). - hosts/k8s/kubevirt-* -> hosts/12kingdoms-*; the shared disko config becomes host-disko-fs.nix; the now-different relative imports are fixed - outputs, vars/networking.nix keys, the Justfile recipes/tags, the eval tests and the docs follow - colmena reaches these hosts by IP (a new targetHost override), since their DNS name changes with the hostname and is not resolvable until the router learns it
This commit is contained in:
1 parent
3aec8341dd
commit
2c7629000f
103 files changed
+78
-54
No files matched your search
@@ -61,7 +61,7 @@ deployments. Keep repository guidance here; reusable global rules live in `agent
|
||||
- Deployment and upload recipes change systems; use eval/build commands for validation. Remote
|
||||
deployment requires an explicit request. When deployment behavior changes, report the exact `just`
|
||||
command to run.
|
||||
- KubeVirt hosts (`kubevirt-shoryu`/`shushou`/`youko`): avoid mid-flight restarts of the network
|
||||
- KubeVirt hosts (`shoryu`/`shushou`/`youko`): avoid mid-flight restarts of the network
|
||||
stack (`systemd-networkd` / the `br0` bridge) — that can drop the VM network. Use `boot` + serial
|
||||
reboot for networking or nixpkgs changes. See
|
||||
[hosts/README.md](./hosts/README.md#deploying-kubevirt-hosts).
|
||||
|
||||
@@ -197,7 +197,7 @@ upload-vm name size verbosity="normal":
|
||||
use {{utils_nu}} *;
|
||||
upload-vm {{name}} {{size}} {{verbosity}}
|
||||
|
||||
# Deploy all the KubeVirt nodes(Physical machines running KubeVirt)
|
||||
# Deploy all the VM hosts (physical machines running the VMs)
|
||||
[linux]
|
||||
[group('homelab')]
|
||||
lab mode="switch":
|
||||
@@ -206,17 +206,17 @@ lab mode="switch":
|
||||
[linux]
|
||||
[group('homelab')]
|
||||
shoryu mode="switch":
|
||||
colmena apply {{mode}} --on '@kubevirt-shoryu' --verbose --show-trace
|
||||
colmena apply {{mode}} --on '@shoryu' --verbose --show-trace
|
||||
|
||||
[linux]
|
||||
[group('homelab')]
|
||||
shushou mode="switch":
|
||||
colmena apply {{mode}} --on '@kubevirt-shushou' --verbose --show-trace
|
||||
colmena apply {{mode}} --on '@shushou' --verbose --show-trace
|
||||
|
||||
[linux]
|
||||
[group('homelab')]
|
||||
youko mode="switch":
|
||||
colmena apply {{mode}} --on '@kubevirt-youko' --verbose --show-trace
|
||||
colmena apply {{mode}} --on '@youko' --verbose --show-trace
|
||||
|
||||
############################################################################
|
||||
#
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
## How to create & managage KubeVirt's Virtual Machine from this flake?
|
||||
|
||||
> [!NOTE] KubeVirt is being retired. aquamarine runs natively on `kubevirt-youko` and the k3s-test
|
||||
> [!NOTE] KubeVirt is being retired. aquamarine runs natively on `youko` and the k3s-test
|
||||
> nodes run as [microVMs](./hosts/k8s/README.md); this document only covers the KubeVirt VMs that
|
||||
> are left to move (currently the Windows VM).
|
||||
|
||||
@@ -22,7 +22,7 @@ commands:
|
||||
|
||||
```shell
|
||||
just col aquamarine
|
||||
just col kubevirt-shoryu
|
||||
just col shoryu
|
||||
|
||||
# Set a configuration for the next boot instead of switching immediately
|
||||
just col aquamarine boot
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
}:
|
||||
let
|
||||
# MoreFine - S500Plus
|
||||
hostName = "kubevirt-shoryu"; # Define your hostname.
|
||||
hostName = "shoryu"; # Define your hostname.
|
||||
|
||||
coreModule = mylib.genVmHostModule {
|
||||
inherit pkgs hostName;
|
||||
@@ -18,7 +18,7 @@ in
|
||||
{
|
||||
imports = (mylib.scanPaths ./.) ++ [
|
||||
disko.nixosModules.default
|
||||
../disko-config/kubevirt-disko-fs.nix
|
||||
../k8s/disko-config/host-disko-fs.nix
|
||||
./hardware-configuration.nix
|
||||
./preservation.nix
|
||||
coreModule
|
||||
File renamed without changes.
File renamed without changes.
@@ -21,7 +21,7 @@
|
||||
mysecrets
|
||||
;
|
||||
};
|
||||
config.imports = [ ../k3s-test-1-master-1 ];
|
||||
config.imports = [ ../k8s/k3s-test-1-master-1 ];
|
||||
};
|
||||
|
||||
# Attach the guest's tap to the VM bridge, the same way the physical NIC is
|
||||
File renamed without changes.
@@ -7,7 +7,7 @@
|
||||
...
|
||||
}:
|
||||
let
|
||||
hostName = "kubevirt-shushou"; # Define your hostname.
|
||||
hostName = "shushou"; # Define your hostname.
|
||||
|
||||
coreModule = mylib.genVmHostModule {
|
||||
inherit pkgs hostName;
|
||||
@@ -17,9 +17,9 @@ in
|
||||
{
|
||||
imports = (mylib.scanPaths ./.) ++ [
|
||||
disko.nixosModules.default
|
||||
../disko-config/kubevirt-disko-fs.nix
|
||||
../kubevirt-shoryu/hardware-configuration.nix
|
||||
../kubevirt-shoryu/preservation.nix
|
||||
../k8s/disko-config/host-disko-fs.nix
|
||||
../12kingdoms-shoryu/hardware-configuration.nix
|
||||
../12kingdoms-shoryu/preservation.nix
|
||||
coreModule
|
||||
];
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
mysecrets
|
||||
;
|
||||
};
|
||||
config.imports = [ ../k3s-test-1-master-3 ];
|
||||
config.imports = [ ../k8s/k3s-test-1-master-3 ];
|
||||
};
|
||||
|
||||
# Attach the guest's tap to the VM bridge, the same way the physical NIC is
|
||||
@@ -1,6 +1,6 @@
|
||||
{ myvars, ... }:
|
||||
let
|
||||
hostAddress = myvars.networking.hostsAddr.kubevirt-shushou.ipv4;
|
||||
hostAddress = myvars.networking.hostsAddr.shushou.ipv4;
|
||||
in
|
||||
{
|
||||
power.ups = {
|
||||
@@ -7,7 +7,7 @@
|
||||
...
|
||||
}:
|
||||
let
|
||||
hostName = "kubevirt-youko"; # Define your hostname.
|
||||
hostName = "youko"; # Define your hostname.
|
||||
|
||||
coreModule = mylib.genVmHostModule {
|
||||
inherit pkgs hostName;
|
||||
@@ -17,9 +17,9 @@ in
|
||||
{
|
||||
imports = (mylib.scanPaths ./.) ++ [
|
||||
disko.nixosModules.default
|
||||
../disko-config/kubevirt-disko-fs.nix
|
||||
../kubevirt-shoryu/hardware-configuration.nix
|
||||
../kubevirt-shoryu/preservation.nix
|
||||
../k8s/disko-config/host-disko-fs.nix
|
||||
../12kingdoms-shoryu/hardware-configuration.nix
|
||||
../12kingdoms-shoryu/preservation.nix
|
||||
coreModule
|
||||
];
|
||||
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
+2
-2
@@ -1,7 +1,7 @@
|
||||
# Auto disk partitioning (from repo root: nix-config):
|
||||
# nix run github:nix-community/disko -- --mode destroy,format,mount hosts/k8s/kubevirt-youko/homelab-services/disko-fs.nix
|
||||
# nix run github:nix-community/disko -- --mode destroy,format,mount hosts/12kingdoms-youko/homelab-services/disko-fs.nix
|
||||
# Mount only (after first format):
|
||||
# nix run github:nix-community/disko -- --mode mount hosts/k8s/kubevirt-youko/homelab-services/disko-fs.nix
|
||||
# nix run github:nix-community/disko -- --mode mount hosts/12kingdoms-youko/homelab-services/disko-fs.nix
|
||||
let
|
||||
cryptKeyFile = "/etc/agenix/hdd-luks-crypt-key";
|
||||
unlockDisk = "data-encrypted";
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
+2
-2
@@ -101,10 +101,10 @@ in
|
||||
params.ups = [ "homelab" ];
|
||||
static_configs = [
|
||||
{
|
||||
targets = [ "${myvars.networking.hostsAddr.kubevirt-shushou.ipv4}:9199" ];
|
||||
targets = [ "${myvars.networking.hostsAddr.shushou.ipv4}:9199" ];
|
||||
labels.type = "app";
|
||||
labels.app = "nut";
|
||||
labels.host = "kubevirt-shushou";
|
||||
labels.host = "shushou";
|
||||
labels.env = "homelab";
|
||||
labels.cluster = "homelab";
|
||||
}
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
+3
-3
@@ -44,9 +44,9 @@ in
|
||||
backupPrepareCommand = ''
|
||||
${pkgs.nushell}/bin/nu -c '
|
||||
let kubevirt_nodes = [
|
||||
"kubevirt-shoryu"
|
||||
"kubevirt-shushou"
|
||||
"kubevirt-youko"
|
||||
"shoryu"
|
||||
"shushou"
|
||||
"youko"
|
||||
]
|
||||
|
||||
kubevirt_nodes | each {|it|
|
||||
File renamed without changes.
File renamed without changes.
@@ -21,7 +21,7 @@
|
||||
mysecrets
|
||||
;
|
||||
};
|
||||
config.imports = [ ../k3s-test-1-master-2 ];
|
||||
config.imports = [ ../k8s/k3s-test-1-master-2 ];
|
||||
};
|
||||
|
||||
# Attach the guest's tap to the VM bridge, the same way the physical NIC is
|
||||
File renamed without changes.
File renamed without changes.
+2
-2
@@ -104,13 +104,13 @@ Use existing hosts as templates. The key files typically include:
|
||||
### Examples to Reference
|
||||
|
||||
- **Desktop systems**: See `idols-ai/` for gaming/workstation setup
|
||||
- **Server systems**: See `kubevirt-shoryu/` for K8s/KubeVirt hosts
|
||||
- **Server systems**: See `shoryu/` for K8s/KubeVirt hosts
|
||||
- **macOS systems**: See `darwin-fern/` for macOS configurations
|
||||
- **Apple Silicon**: See `12kingdoms-shoukei/` for ARM Linux setup
|
||||
|
||||
## Deploying KubeVirt Hosts
|
||||
|
||||
The three KubeVirt hosts (`kubevirt-shoryu`, `kubevirt-shushou`, `kubevirt-youko`) put their VMs'
|
||||
The three KubeVirt hosts (`shoryu`, `shushou`, `youko`) put their VMs'
|
||||
secondary network on the Linux bridge `br0` (attached by the `bridge` CNI plugin); the pod network
|
||||
is Cilium (flannel disabled).
|
||||
|
||||
|
||||
+2
-2
@@ -39,11 +39,11 @@ keeps its identity and etcd membership instead of bootstraping a new cluster.
|
||||
|
||||
## TODO / Known issues
|
||||
|
||||
- **Retire KubeVirt.** aquamarine now runs natively on `kubevirt-youko`, and the k3s-test masters
|
||||
- **Retire KubeVirt.** aquamarine now runs natively on `youko`, and the k3s-test masters
|
||||
run as microVMs. Remove KubeVirt/CDI/multus from the cluster (k8s-gitops) once nothing else needs
|
||||
them, and the Windows VM is the only KubeVirt VM left to move.
|
||||
- **The USB HDD bridge is flaky.** aquamarine's two HDDs sit behind a JMicron JMS567 USB-SATA bridge
|
||||
that keeps resetting (`dmesg` on `kubevirt-youko`). Find out how often it resets and how much it
|
||||
that keeps resetting (`dmesg` on `youko`). Find out how often it resets and how much it
|
||||
matters before putting anything critical (e.g. an NFS export) on it.
|
||||
|
||||
## Kubernetes Resources
|
||||
|
||||
@@ -17,7 +17,7 @@ sudo nix --experimental-features "nix-command flakes" run github:nix-community/d
|
||||
systemd-cryptenroll --tpm2-device=auto --tpm2-pcrs=0+7 /dev/<encrypted-disk-part-path>
|
||||
|
||||
## 3. install nixos
|
||||
sudo nixos-install --root /mnt --no-root-password --show-trace --verbose --flake .#kubevirt-shoryu
|
||||
sudo nixos-install --root /mnt --no-root-password --show-trace --verbose --flake .#shoryu
|
||||
|
||||
# enter into the installed system, check password & users
|
||||
# `su ryan` => `sudo -i` => enter ryan's password => successfully login
|
||||
|
||||
File renamed without changes.
@@ -8,6 +8,9 @@
|
||||
system,
|
||||
tags,
|
||||
ssh-user,
|
||||
# optional override; defaults to the host name. Use an IP when the host's
|
||||
# DNS name is not resolvable yet (e.g. right after a hostname change).
|
||||
targetHost ? null,
|
||||
genSpecialArgs,
|
||||
specialArgs ? (genSpecialArgs system),
|
||||
...
|
||||
@@ -20,7 +23,7 @@ in
|
||||
deployment = {
|
||||
inherit tags;
|
||||
targetUser = ssh-user;
|
||||
targetHost = name; # hostName or IP address
|
||||
targetHost = if targetHost != null then targetHost else name;
|
||||
};
|
||||
|
||||
imports =
|
||||
|
||||
+3
-3
@@ -97,9 +97,9 @@ All the outputs of this flake are defined here.
|
||||
│ ├── k3s-test-1-worker-1.nix
|
||||
│ ├── k3s-test-1-worker-2.nix
|
||||
│ ├── k3s-test-1-worker-3.nix
|
||||
│ ├── kubevirt-shoryu.nix
|
||||
│ ├── kubevirt-shushou.nix
|
||||
│ └── kubevirt-youko.nix
|
||||
│ ├── shoryu.nix
|
||||
│ ├── shushou.nix
|
||||
│ └── youko.nix
|
||||
└── tests # eval tests
|
||||
├── home-manager
|
||||
│ ├── expected.nix
|
||||
|
||||
+10
-3
@@ -11,7 +11,7 @@
|
||||
...
|
||||
}@args:
|
||||
let
|
||||
name = "kubevirt-shoryu";
|
||||
name = "shoryu";
|
||||
tags = [
|
||||
name
|
||||
"virt-shoryu"
|
||||
@@ -25,7 +25,7 @@ let
|
||||
"secrets/nixos.nix"
|
||||
"modules/nixos/server/server.nix"
|
||||
# host specific
|
||||
"hosts/k8s/${name}"
|
||||
"hosts/12kingdoms-${name}"
|
||||
])
|
||||
++ [
|
||||
{
|
||||
@@ -43,7 +43,14 @@ in
|
||||
{
|
||||
nixosConfigurations.${name} = mylib.nixosSystem systemArgs;
|
||||
|
||||
colmena.${name} = mylib.colmenaSystem (systemArgs // { inherit tags ssh-user; });
|
||||
colmena.${name} = mylib.colmenaSystem (
|
||||
systemArgs
|
||||
// {
|
||||
inherit tags ssh-user;
|
||||
# reach the host by IP: its DNS name changes with the hostname
|
||||
targetHost = myvars.networking.hostsAddr.${name}.ipv4;
|
||||
}
|
||||
);
|
||||
|
||||
packages.${name} = inputs.self.nixosConfigurations.${name}.config.system.build.images.iso;
|
||||
}
|
||||
+10
-3
@@ -11,7 +11,7 @@
|
||||
...
|
||||
}@args:
|
||||
let
|
||||
name = "kubevirt-shushou";
|
||||
name = "shushou";
|
||||
tags = [
|
||||
name
|
||||
"virt-shushou"
|
||||
@@ -25,7 +25,7 @@ let
|
||||
"secrets/nixos.nix"
|
||||
"modules/nixos/server/server.nix"
|
||||
# host specific
|
||||
"hosts/k8s/${name}"
|
||||
"hosts/12kingdoms-${name}"
|
||||
])
|
||||
++ [
|
||||
{
|
||||
@@ -40,7 +40,14 @@ in
|
||||
{
|
||||
nixosConfigurations.${name} = mylib.nixosSystem systemArgs;
|
||||
|
||||
colmena.${name} = mylib.colmenaSystem (systemArgs // { inherit tags ssh-user; });
|
||||
colmena.${name} = mylib.colmenaSystem (
|
||||
systemArgs
|
||||
// {
|
||||
inherit tags ssh-user;
|
||||
# reach the host by IP: its DNS name changes with the hostname
|
||||
targetHost = myvars.networking.hostsAddr.${name}.ipv4;
|
||||
}
|
||||
);
|
||||
|
||||
packages.${name} = inputs.self.nixosConfigurations.${name}.config.system.build.images.iso;
|
||||
}
|
||||
+10
-3
@@ -11,7 +11,7 @@
|
||||
...
|
||||
}@args:
|
||||
let
|
||||
name = "kubevirt-youko";
|
||||
name = "youko";
|
||||
tags = [
|
||||
name
|
||||
"virt-youko"
|
||||
@@ -25,7 +25,7 @@ let
|
||||
"secrets/nixos.nix"
|
||||
"modules/nixos/server/server.nix"
|
||||
# host specific
|
||||
"hosts/k8s/${name}"
|
||||
"hosts/12kingdoms-${name}"
|
||||
])
|
||||
++ [
|
||||
{
|
||||
@@ -40,7 +40,14 @@ in
|
||||
{
|
||||
nixosConfigurations.${name} = mylib.nixosSystem systemArgs;
|
||||
|
||||
colmena.${name} = mylib.colmenaSystem (systemArgs // { inherit tags ssh-user; });
|
||||
colmena.${name} = mylib.colmenaSystem (
|
||||
systemArgs
|
||||
// {
|
||||
inherit tags ssh-user;
|
||||
# reach the host by IP: its DNS name changes with the hostname
|
||||
targetHost = myvars.networking.hostsAddr.${name}.ipv4;
|
||||
}
|
||||
);
|
||||
|
||||
packages.${name} = inputs.self.nixosConfigurations.${name}.config.system.build.images.iso;
|
||||
}
|
||||
@@ -3,7 +3,7 @@
|
||||
outputs,
|
||||
}:
|
||||
let
|
||||
aqua = outputs.nixosConfigurations.kubevirt-youko.config;
|
||||
aqua = outputs.nixosConfigurations.youko.config;
|
||||
in
|
||||
{
|
||||
v2rayExporter = aqua.services.prometheus.exporters.v2ray.listenAddress;
|
||||
|
||||
Loaded 100 of 103 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user