kubernetes-deployments/modules/syncthing.nix
Pim Kunis f97f7d4666 Share keepassxc using syncthing
Remove unused syncthing shares
2025-02-08 14:49:38 +01:00

98 lines
2.2 KiB
Nix

{
globals,
config,
lib,
...
}: {
options.syncthing.enable = lib.mkEnableOption "syncthing";
config = lib.mkIf config.syncthing.enable {
kubernetes.resources = {
serviceAccounts.syncthing = {};
deployments.syncthing.spec = {
selector.matchLabels.app = "syncthing";
strategy = {
type = "RollingUpdate";
rollingUpdate = {
maxSurge = 0;
maxUnavailable = 1;
};
};
template = {
metadata.labels.app = "syncthing";
spec = {
serviceAccountName = "syncthing";
containers.syncthing = {
image = globals.images.syncthing;
ports.web.containerPort = 8384;
imagePullPolicy = "IfNotPresent";
env = {
PUID.value = "33";
PGID.value = "33";
TZ.value = "Europe/Amsterdam";
};
volumeMounts = [
{
name = "config";
mountPath = "/config";
}
{
name = "keepassxc";
mountPath = "/keepassxc";
}
];
};
volumes = {
config.persistentVolumeClaim.claimName = "config";
keepassxc.persistentVolumeClaim.claimName = "keepassxc";
};
securityContext = {
fsGroup = 33;
fsGroupChangePolicy = "OnRootMismatch";
};
};
};
};
services.syncthing.spec = {
type = "LoadBalancer";
loadBalancerIP = globals.syncthingIPv4;
selector.app = "syncthing";
ports.web = {
port = 80;
targetPort = "web";
};
};
};
lab = {
longhorn.persistentVolumeClaim = {
config = {
volumeName = "syncthing";
storage = "400Mi";
};
keepassxc = {
volumeName = "keepassxc";
storage = "100Mi";
};
};
tailscaleIngresses.tailscale = {
host = "syncthing";
service.name = "syncthing";
};
};
};
}