nixos-servers/kubenix-modules/forgejo/default.nix

99 lines
2.1 KiB
Nix
Raw Normal View History

{ lib, myLib, ... }: {
2024-03-29 14:49:34 +00:00
kubernetes.resources = {
secrets.forgejo.stringData.config = lib.generators.toINI { } (import ./config.nix);
2024-03-29 14:49:34 +00:00
deployments.server.spec = {
selector.matchLabels.app = "forgejo";
strategy = {
type = "RollingUpdate";
rollingUpdate = {
maxSurge = 0;
maxUnavailable = 1;
};
2024-07-12 12:00:11 +00:00
};
template = {
metadata.labels.app = "forgejo";
2024-03-29 14:49:34 +00:00
spec = {
# This disables services from becoming environmental variables
# to prevent SSH_PORT clashing with Forgejo config.
enableServiceLinks = false;
2024-07-12 12:00:11 +00:00
containers.forgejo = {
2024-07-30 19:28:35 +00:00
image = myLib.globals.images.forgejo;
imagePullPolicy = "IfNotPresent";
2024-03-29 14:49:34 +00:00
env = {
USER_UID.value = "1000";
USER_GID.value = "1000";
2024-07-12 12:00:11 +00:00
};
ports = {
web.containerPort = 3000;
ssh.containerPort = 22;
2024-04-17 21:19:08 +00:00
};
volumeMounts = [
{
name = "data";
mountPath = "/data";
}
{
name = "config";
mountPath = "/data/gitea/conf/app.ini";
subPath = "config";
}
];
};
volumes = {
data.persistentVolumeClaim.claimName = "data";
config.secret.secretName = "forgejo";
2024-04-17 21:19:08 +00:00
};
};
};
2024-03-29 14:49:34 +00:00
};
services = {
web.spec = {
2024-07-12 12:00:11 +00:00
selector.app = "forgejo";
2024-03-29 14:49:34 +00:00
2024-04-14 19:43:31 +00:00
ports.web = {
2024-03-29 14:49:34 +00:00
port = 80;
2024-04-14 19:43:31 +00:00
targetPort = "web";
};
2024-03-29 14:49:34 +00:00
};
ssh.spec = {
2024-03-29 14:49:34 +00:00
type = "LoadBalancer";
loadBalancerIP = myLib.globals.gitIPv4;
2024-03-29 14:49:34 +00:00
selector.app = "forgejo";
2024-04-14 19:43:31 +00:00
ports.ssh = {
2024-03-29 14:49:34 +00:00
port = 56287;
2024-04-14 19:43:31 +00:00
targetPort = "ssh";
};
2024-03-29 14:49:34 +00:00
};
};
};
2024-03-29 14:49:34 +00:00
lab = {
ingresses.web = {
host = "git.kun.is";
service = {
name = "web";
portName = "web";
};
2024-03-29 14:49:34 +00:00
};
longhorn.persistentVolumeClaim.data = {
volumeName = "forgejo";
storage = "20Gi";
};
2024-03-29 14:49:34 +00:00
};
}