diff --git a/manifests/apply.sh b/manifests/apply.sh index 622b8fe..3cd6c81 100755 --- a/manifests/apply.sh +++ b/manifests/apply.sh @@ -6,17 +6,6 @@ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" # Change to the script directory cd "$SCRIPT_DIR" -# Now, configure longhorn settings for each node -kubectl annotate nodes --overwrite isaiah 'node.longhorn.io/default-disks-config=[ - { "path": "/var/lib/longhorn", "allowScheduling" : true, "tags": ["hdd", "large"]} -]' -kubectl annotate nodes --overwrite jeremiah 'node.longhorn.io/default-disks-config=[ - { "path": "/var/lib/longhorn", "allowScheduling" : true, "tags": ["hdd", "large"]} -]' -kubectl annotate nodes --overwrite zeke 'node.longhorn.io/default-disks-config=[ - { "path": "/var/lib/longhorn", "allowScheduling" : trues, "tags": ["ssd", "fast"]} -]' - kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.18.2/cert-manager.yaml kubectl apply -f helm/flux.yaml sleep 5 diff --git a/manifests/nodes.yaml b/manifests/nodes.yaml new file mode 100644 index 0000000..379f0bd --- /dev/null +++ b/manifests/nodes.yaml @@ -0,0 +1,29 @@ +apiVersion: v1 +kind: Node +metadata: + name: isaiah + annotations: + "node.longhorn.io/default-disks-config": |- + [ + { "path": "/var/lib/longhorn", "allowScheduling" : true, "tags": ["hdd", "large"]} + ] +--- +apiVersion: v1 +kind: Node +metadata: + name: jeremiah + annotations: + "node.longhorn.io/default-disks-config": |- + [ + { "path": "/var/lib/longhorn", "allowScheduling" : true, "tags": ["hdd", "large"]} + ] +--- +apiVersion: v1 +kind: Node +metadata: + name: zeke + annotations: + "node.longhorn.io/default-disks-config": |- + [ + { "path": "/var/lib/longhorn", "allowScheduling" : trues, "tags": ["ssd", "fast"]} + ] diff --git a/modules/nixos/kubernetes.nix b/modules/nixos/kubernetes.nix index 7a36810..79ce4f2 100644 --- a/modules/nixos/kubernetes.nix +++ b/modules/nixos/kubernetes.nix @@ -70,8 +70,6 @@ in services = { k3s = { enable = true; - role = if cfg.agentOnly then "agent" else "server"; - tokenFile = config.age.secrets.kubernetesToken.path; extraFlags = [ "--cluster-cidr=10.211.0.0/16" "--service-cidr=10.221.0.0/16" @@ -83,7 +81,12 @@ in "--tls-san ${config.networking.hostName}.thehellings.lan" "--tls-san ${config.networking.hostName}.shire-zebra.ts.net" ]; + manifests = { + node-annotations.content = ../../manifests/nodes.yaml; + }; + role = if cfg.agentOnly then "agent" else "server"; serverAddr = lib.mkIf (config.networking.hostName != "isaiah") "https://isaiah.home:6443"; + tokenFile = config.age.secrets.kubernetesToken.path; }; keepalived = let