run the log store and its auth responders as pods
swarm-logs-auth and swarm-metrics-auth take --listen for a TCP address beside --socket. The log store is a Deployment on a static local volume that is its old container's data directory, behind a ClusterIP Service the gateway dials by name. Its two auth_request responders are one unpinned pod with a jwt role. The renderer gains a plain HTTP listener, a probe path, fsGroupChangePolicy, and one policy for a pod with both a listener and egress.
This commit is contained in:
parent
279f97e5ca
commit
71b2e9310c
1 changed files with 1385 additions and 746 deletions
|
|
@ -203,7 +203,6 @@ let
|
|||
"swarm-ci-runner"
|
||||
"swarm-grafana"
|
||||
"swarm-otel"
|
||||
"swarm-victorialogs"
|
||||
"swarm-victoriametrics"
|
||||
];
|
||||
|
||||
|
|
@ -265,7 +264,6 @@ let
|
|||
"grafana.service"
|
||||
"opentelemetry-collector.service"
|
||||
"tuwunel.service"
|
||||
"victorialogs.service"
|
||||
"victoriametrics.service"
|
||||
];
|
||||
}
|
||||
|
|
@ -772,7 +770,6 @@ let
|
|||
"swarm-authelia"
|
||||
"swarm-bao"
|
||||
"swarm-grafana"
|
||||
"swarm-victorialogs"
|
||||
"swarm-victoriametrics"
|
||||
"swarm-otel"
|
||||
"hive-matrix"
|
||||
|
|
@ -821,7 +818,7 @@ let
|
|||
# that lost a container can't pass by comparing fewer of them.
|
||||
name = "every service container restates its host-side privateNetwork";
|
||||
ok =
|
||||
lib.length (lib.attrNames serviceContainers) == 11
|
||||
lib.length (lib.attrNames serviceContainers) == 10
|
||||
&& lib.all (
|
||||
c: c.privateNetwork == (c.config.services.hyperhive.swarmContainer.privateNetwork or null)
|
||||
) (lib.attrValues serviceContainers);
|
||||
|
|
@ -975,50 +972,6 @@ let
|
|||
&& bridge.serviceConfig.Group == "gateway-nginx"
|
||||
&& lib.elem dir unit.serviceConfig.ReadWritePaths;
|
||||
}
|
||||
{
|
||||
# On the bridge by DHCP, listening on a socket only the gateway's group can
|
||||
# reach, so the store binds no host port. Every location that forwards to
|
||||
# it goes through the socket (the authelia subrequests are the `https://`
|
||||
# upstream); the read, ingest, scrape and catch-all locations are named so
|
||||
# an empty filter can't pass, and the old loopback port is named nowhere.
|
||||
name = "the log store runs on a netns of its own and the gateway reaches it over its socket";
|
||||
ok =
|
||||
let
|
||||
host = serviceContainersWithCi;
|
||||
net = host.services.hyperhive.network;
|
||||
c = host.containers.swarm-victorialogs;
|
||||
dir = "/run/swarm-victorialogs";
|
||||
sock = "${dir}/victorialogs.sock";
|
||||
viaSock = path: "http://unix:${sock}:${path}";
|
||||
locs =
|
||||
host.services.nginx.virtualHosts.${host.services.hyperhive.swarm.victorialogs.domain}.locations;
|
||||
toStore = lib.filter (
|
||||
p: p != null && !(lib.hasPrefix "https://" p) && !(lib.hasPrefix "http://unix:/run/swarm-logs" p)
|
||||
) (map (l: l.proxyPass) (lib.attrValues locs));
|
||||
unit = c.config.systemd.services.victorialogs;
|
||||
nginxGid = host.ids.gids.nginx;
|
||||
in
|
||||
c.privateNetwork
|
||||
&& c.hostBridge == net.bridgeName
|
||||
&& c.hostAddress == null
|
||||
&& c.localAddress == null
|
||||
&& c.config.networking.interfaces.eth0.useDHCP
|
||||
&& c.config.services.victorialogs.listenAddress == "unix:${sock}"
|
||||
&& locs."/".proxyPass == viaSock "/"
|
||||
&& locs."= /insert/opentelemetry/v1/logs".proxyPass == viaSock "/insert/opentelemetry/v1/logs"
|
||||
&& locs."^~ /select/logsql/".proxyPass == "http://unix:${sock}"
|
||||
&& locs."= /metrics".proxyPass == viaSock "/metrics"
|
||||
&& toStore != [ ]
|
||||
&& lib.all (lib.hasPrefix "http://unix:${sock}") toStore
|
||||
&& !(lib.any (lib.hasInfix "127.0.0.1") toStore)
|
||||
&& c.bindMounts.${dir}.hostPath == dir
|
||||
&& builtins.elem "d ${dir} 0770 root ${toString nginxGid} - -" host.systemd.tmpfiles.rules
|
||||
&& c.config.users.groups.gateway-nginx.gid == nginxGid
|
||||
&& unit.serviceConfig.Group == "gateway-nginx"
|
||||
&& !unit.serviceConfig.DynamicUser
|
||||
&& unit.serviceConfig.UMask == "0007"
|
||||
&& lib.hasInfix "--unix-socket ${sock}" unit.postStart;
|
||||
}
|
||||
{
|
||||
# On the bridge by DHCP, listening on a socket (protocol `socket` ignores the
|
||||
# upstream-default `http_port`, which stays in the settings): the
|
||||
|
|
|
|||
Loading…
Reference in a new issue