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

103 lines
2.1 KiB
Nix
Raw Normal View History

{ lib, myLib, ... }: {
2024-03-29 14:49:34 +00:00
kubernetes.resources = {
configMaps = {
config.data = {
2024-05-01 20:34:59 +00:00
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 = {
image = "codeberg.org/forgejo/forgejo:7.0.5";
imagePullPolicy = "Always";
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.configMap.name = "config";
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
};
}