k8s: deploy.k8s.enable runs a single-node k3s that holds the service images
This commit is contained in:
parent
0328954a78
commit
53e43a990d
1 changed files with 357 additions and 18 deletions
|
|
@ -1,6 +1,7 @@
|
|||
# The Kubernetes objects that run each in-cluster swarm service this host
|
||||
# deploys, read from that service's systemd unit as this host renders it.
|
||||
# Imported by ./default.nix, which writes them out as YAML.
|
||||
# Imported by ./default.nix, which writes the objects out as YAML. Returns
|
||||
# `objects` and the `images` the pods run.
|
||||
#
|
||||
# The pod takes the unit's environment, credential ids, state and runtime
|
||||
# directories, and timer. Every file the unit names is mounted at the path the
|
||||
|
|
@ -375,16 +376,24 @@ let
|
|||
else if missingCreds != { } then
|
||||
fail name "${lib.concatStringsSep ", " (lib.attrNames missingCreds)} names a credential the unit does not load"
|
||||
else
|
||||
objects;
|
||||
{ inherit objects image; };
|
||||
|
||||
enabled = lib.mapAttrs workload (lib.filterAttrs (_: svc: svc.enable) services);
|
||||
in
|
||||
{
|
||||
"namespace" = {
|
||||
apiVersion = "v1";
|
||||
kind = "Namespace";
|
||||
metadata = {
|
||||
name = k8sCfg.namespace;
|
||||
labels."app.kubernetes.io/part-of" = "hyperhive";
|
||||
objects = {
|
||||
"namespace" = {
|
||||
apiVersion = "v1";
|
||||
kind = "Namespace";
|
||||
metadata = {
|
||||
name = k8sCfg.namespace;
|
||||
labels."app.kubernetes.io/part-of" = "hyperhive";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
// lib.concatMapAttrs (_: w: w.objects) enabled;
|
||||
|
||||
# The image each enabled service's pod runs: what a node has to hold,
|
||||
# since there is no registry to pull from.
|
||||
images = lib.mapAttrsToList (_: w: w.image) enabled;
|
||||
}
|
||||
// lib.concatMapAttrs (name: svc: lib.optionalAttrs svc.enable (workload name svc)) services
|
||||
|
|
|
|||
Loading…
Reference in a new issue