Add a bootstrap role.

This commit is contained in:
Tom Alexander
2025-12-20 22:14:28 -05:00
parent b0fe14adfc
commit a113cccb52
6 changed files with 12 additions and 6 deletions

View File

@@ -17,7 +17,7 @@
};
bootstrap.manifests = lib.mkOption {
type = lib.types.listOf lib.types.path;
type = lib.types.listOf lib.types.str;
default = [ ];
example = lib.literalExpression ''[ ${./files/clusterrole.yaml} ]'';
description = "List of kubernetes manifests to load into the cluster.";
@@ -29,8 +29,9 @@
{
systemd.services.kube-bootstrap = {
enable = true;
description = "Load initial kubernetes manifests into the cluster.";
description = "Load initial kubernetes manifests into the cluster";
after = [ "kubernetes.target" ];
wantedBy = [ "multi-user.target" ];
path = with pkgs; [
kubectl
];
@@ -40,13 +41,13 @@
};
script =
let
manifests = (lib.concatMapStringsSep " " lib.escapeShellArgs config.me.bootstrap.manifests);
manifests = (lib.concatMapStringsSep "," lib.escapeShellArg config.me.bootstrap.manifests);
in
''
set -o pipefail
IFS=$'\n\t'
kubectl apply --server-side --force-conflicts -f ${manifests}
kubectl --kubeconfig=/.persist/keys/kube/kubelet.kubeconfig apply --server-side --force-conflicts -f ${manifests}
'';
};
};