Move node annotations to Nix

This commit is contained in:
Greg Hellings
2025-09-11 21:39:53 -05:00
parent ce0fd0102a
commit a573f12221
3 changed files with 34 additions and 13 deletions
-11
View File
@@ -6,17 +6,6 @@ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
# Change to the script directory # Change to the script directory
cd "$SCRIPT_DIR" 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 https://github.com/cert-manager/cert-manager/releases/download/v1.18.2/cert-manager.yaml
kubectl apply -f helm/flux.yaml kubectl apply -f helm/flux.yaml
sleep 5 sleep 5
+29
View File
@@ -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"]}
]
+5 -2
View File
@@ -70,8 +70,6 @@ in
services = { services = {
k3s = { k3s = {
enable = true; enable = true;
role = if cfg.agentOnly then "agent" else "server";
tokenFile = config.age.secrets.kubernetesToken.path;
extraFlags = [ extraFlags = [
"--cluster-cidr=10.211.0.0/16" "--cluster-cidr=10.211.0.0/16"
"--service-cidr=10.221.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}.thehellings.lan"
"--tls-san ${config.networking.hostName}.shire-zebra.ts.net" "--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"; serverAddr = lib.mkIf (config.networking.hostName != "isaiah") "https://isaiah.home:6443";
tokenFile = config.age.secrets.kubernetesToken.path;
}; };
keepalived = keepalived =
let let