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

101 lines
2.1 KiB
Nix
Raw Normal View History

{ lib, myLib, ... }: {
2024-03-29 14:49:34 +00:00
kubernetes.resources = {
configMaps = {
2024-05-01 20:34:59 +00:00
forgejo-config.data = {
config = lib.generators.toINI { } (import ./config.nix);
};
2024-03-29 14:49:34 +00:00
forgejo-env.data = {
USER_UID = "1000";
USER_GID = "1000";
};
};
2024-07-12 12:00:11 +00:00
deployments.forgejo = {
metadata.labels = {
app = "forgejo";
component = "forgejo";
};
spec = {
selector.matchLabels.app = "forgejo";
2024-03-29 14:49:34 +00:00
2024-07-12 12:00:11 +00:00
strategy = {
type = "RollingUpdate";
rollingUpdate = {
maxSurge = 0;
maxUnavailable = 1;
2024-04-17 21:19:08 +00:00
};
2024-07-12 12:00:11 +00:00
};
2024-03-29 14:49:34 +00:00
2024-07-12 12:00:11 +00:00
template = {
metadata.labels.app = "forgejo";
2024-03-29 14:49:34 +00:00
2024-07-12 12:00:11 +00:00
spec = {
containers.forgejo = {
image = "codeberg.org/forgejo/forgejo:7.0.5";
envFrom = [{ configMapRef.name = "forgejo-env"; }];
2024-03-29 14:49:34 +00:00
2024-07-12 12:00:11 +00:00
ports = {
web.containerPort = 3000;
ssh.containerPort = 22;
2024-04-14 19:43:31 +00:00
};
2024-07-12 12:00:11 +00:00
volumeMounts = [
{
name = "data";
mountPath = "/data";
}
{
name = "config";
mountPath = "/data/gitea/conf/app.ini";
subPath = "config";
}
];
};
volumes = {
data.persistentVolumeClaim.claimName = "forgejo";
config.configMap.name = "forgejo-config";
2024-04-17 21:19:08 +00:00
};
};
};
};
2024-03-29 14:49:34 +00:00
};
services = {
forgejo-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
};
forgejo-ssh.spec = {
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.forgejo = {
host = "git.kun.is";
service = {
name = "forgejo-web";
portName = "web";
};
2024-03-29 14:49:34 +00:00
};
};
}