Watch
0
0
Fork
You've already forked hyperhive
0

k8s: deploy.k8s.enable runs a single-node k3s that holds the service images

This commit is contained in:
atlas 2026-11-21 12:37:45 +01:00 • committed by maia
commit 9654aa0ac7

View file

@ -17,8 +17,12 @@ let
# so the YAML carries no string context: building it builds no image and
# no daemon.
withoutContext = v: builtins.fromJSON (builtins.unsafeDiscardStringContext (builtins.toJSON v));
rendered = import ./render.nix { inherit lib pkgs config; };
in
{
imports = [ ./node.nix ];
options.services.hyperhive.k8s = {
enable = lib.mkOption {
type = lib.types.bool;
@ -27,7 +31,8 @@ in
Render Kubernetes manifests for the in-cluster swarm services this
host deploys (swarm-controller, swarm-notify-router and
swarm-ci-metrics) into `system.build.k8sManifests`, one YAML file per
object. The manifests reference their Secrets by name only.
object, and the images their pods run into `system.build.k8sImages`.
The manifests reference their Secrets by name only.
Rendering only: the host's units stay as they are, and nothing
applies the manifests to a cluster.
@ -42,11 +47,14 @@ in
};
config = lib.mkIf cfg.enable {
# The images those pods run, for a node to load: ./node.nix.
system.build.k8sImages = rendered.images;
system.build.k8sManifests = pkgs.linkFarm "hyperhive-k8s-manifests" (
lib.mapAttrsToList (path: object: {
name = "${path}.yaml";
path = yaml.generate "${baseNameOf path}.yaml" (withoutContext object);
}) (import ./render.nix { inherit lib pkgs config; })
}) rendered.objects
);
};
}