The controller's api port was a hostPort on the node, which Pod Security baseline and restricted forbid. It is a ClusterIP Service now, behind a NetworkPolicy that admits only the node. The host's resolver (the hive's dnsmasq) forwards cluster.local to CoreDNS, and the gateway dials the Service by name through nginx's resolver. tcp.hostAddress goes.
150 lines
5.1 KiB
Nix
150 lines
5.1 KiB
Nix
# The fixtures more than one `checks.module-eval-*` cluster reads, each
|
|
# evaluated once. ../checks.nix imports this file once and hands the result to
|
|
# every cluster that uses one; a cluster rebinds the fixture under its own
|
|
# local name.
|
|
#
|
|
# ⚠️ Sharing only pays when ../checks.nix instantiates this file ONCE: a
|
|
# cluster that ran `import ./shared.nix` itself would get its own copy of
|
|
# every fixture, the same as defining them locally. The cost is that each
|
|
# fixture here stays live for the whole evaluation rather than one cluster's.
|
|
#
|
|
# Holds only configs that are identical across their users. A cluster whose
|
|
# claim needs one more option set defines its own fixture.
|
|
{
|
|
pkgs,
|
|
lib,
|
|
self,
|
|
nixosSystem,
|
|
}:
|
|
let
|
|
inherit
|
|
(import ./lib.nix {
|
|
inherit
|
|
pkgs
|
|
lib
|
|
self
|
|
nixosSystem
|
|
;
|
|
})
|
|
hive
|
|
hiveWithController
|
|
agent
|
|
agentWith
|
|
;
|
|
|
|
# The four auth responder packages pinned to four distinct derivations, so
|
|
# a unit's ExecStart names which option it read. Nothing else reads them.
|
|
marker = name: pkgs.runCommand "auth-marker-${name}" { } "mkdir $out";
|
|
|
|
# The all-local host with the k3s node on, and the controller's TCP listener
|
|
# that a controller in the cluster needs and the one on the host serves as
|
|
# well. It does not set `k8s.enable`: the node turns the rendering on.
|
|
k8sNodeSettings = {
|
|
deploy.singleHostSwarm = true;
|
|
deploy.k8s.enable = true;
|
|
deploy.victorialogs.authPackage = marker "logs";
|
|
deploy.victorialogs.grafanaAuthPackage = marker "logs-grafana";
|
|
deploy.victoriametrics.authPackage = marker "metrics";
|
|
deploy.victoriametrics.agentAuthPackage = marker "metrics-agent";
|
|
swarm.controller.tcp = {
|
|
enable = true;
|
|
domain = "controller.t.local";
|
|
};
|
|
};
|
|
in
|
|
{
|
|
agentBare = agent { };
|
|
|
|
agentWithBao = agentWith { services.hyperhive.agent.bao.addr = "https://bao.t.local:8200"; };
|
|
|
|
bare = hive { };
|
|
|
|
bareWithController = hiveWithController { };
|
|
|
|
# With the k8s manifests rendered too, which changes no unit.
|
|
allLocal = hiveWithController {
|
|
deploy.singleHostSwarm = true;
|
|
k8s.enable = true;
|
|
deploy.victorialogs.authPackage = marker "logs";
|
|
deploy.victorialogs.grafanaAuthPackage = marker "logs-grafana";
|
|
deploy.victoriametrics.authPackage = marker "metrics";
|
|
deploy.victoriametrics.agentAuthPackage = marker "metrics-agent";
|
|
};
|
|
|
|
inherit k8sNodeSettings;
|
|
k8sNode = hiveWithController k8sNodeSettings;
|
|
|
|
autheliaOnly = hive { deploy.authelia.enable = true; };
|
|
|
|
forgeHere = hive { deploy.forgejo.enable = true; };
|
|
|
|
baoOnly = hive { deploy.bao.enable = true; };
|
|
|
|
servicesHere = hive { deploy.allSwarmServices = true; };
|
|
|
|
# The all-swarm-services switch on the controller's host, the services box
|
|
# shape that hives elsewhere join.
|
|
swarmServicesWithController = hiveWithController { deploy.allSwarmServices = true; };
|
|
|
|
# The queue with no store identity.
|
|
natsQueueOnly = hive {
|
|
deploy.nats.enable = true;
|
|
deploy.nats.authPackage = pkgs.emptyDirectory;
|
|
};
|
|
|
|
# The queue on the store's host with the hive's own reader pointed
|
|
# somewhere else.
|
|
natsOnStoreHostReaderMoved = hive {
|
|
deploy.bao.enable = true;
|
|
deploy.nats.enable = true;
|
|
deploy.bao.clientCertFile = "/etc/pki/h1.pem";
|
|
deploy.bao.clientKeyFile = "/etc/pki/h1-key.pem";
|
|
};
|
|
|
|
controllerAlone = hive { deploy.swarm-controller.enable = true; };
|
|
|
|
# On a non-default gateway TLS port, so the URLs it renders (discovery, the
|
|
# hive-domain redirect) show whether they follow it.
|
|
matrixNoBaoIdentity = hiveWithController {
|
|
deploy.matrix.enable = true;
|
|
gateway.httpsPort = 8443;
|
|
};
|
|
|
|
baoWithMatrix = hiveWithController {
|
|
deploy.bao.enable = true;
|
|
deploy.matrix.enable = true;
|
|
};
|
|
|
|
# A second job declared as bare `host:port`, so a case can read one rendered
|
|
# scrape list where the store's entry carries a path and this one carries
|
|
# none.
|
|
baoWithCollector = hive {
|
|
deploy.bao.enable = true;
|
|
deploy.swarm-otel.enable = true;
|
|
deploy.swarm-otel.scrapeTargets.plain = "127.0.0.1:9999";
|
|
};
|
|
|
|
# `clientSecretFile` is what ../host-modules/otel.nix's identity assertion
|
|
# demands of any host running a hive.
|
|
baoWithHiveOtel = hiveWithController {
|
|
deploy.bao.enable = true;
|
|
otel.clientSecretFile = "/var/lib/hive-otel-oidc/client.secret";
|
|
};
|
|
|
|
# The swarm collector with the IdP on another host and the store leaf placed
|
|
# by hand, without and with the collector's own OIDC pair.
|
|
otelReaderMissingLeaf = hive {
|
|
deploy.swarm-otel.enable = true;
|
|
swarm.authelia.url = "https://auth.example.invalid";
|
|
deploy.bao.clientCertFile = "/etc/pki/bao-client.pem";
|
|
deploy.bao.clientKeyFile = "/etc/pki/bao-client-key.pem";
|
|
};
|
|
otelReaderNamedInFull = hive {
|
|
deploy.swarm-otel.enable = true;
|
|
swarm.authelia.url = "https://auth.example.invalid";
|
|
deploy.bao.clientCertFile = "/etc/pki/bao-client.pem";
|
|
deploy.bao.clientKeyFile = "/etc/pki/bao-client-key.pem";
|
|
deploy.bao.otelOidcClientCertFile = "/etc/pki/bao-otel-oidc.pem";
|
|
deploy.bao.otelOidcClientKeyFile = "/etc/pki/bao-otel-oidc-key.pem";
|
|
};
|
|
}
|