2024-04-20 11:00:41 +00:00
|
|
|
{ lib, myLib, ... }: {
|
2024-03-29 14:49:34 +00:00
|
|
|
kubernetes.resources = {
|
|
|
|
configMaps = {
|
2024-07-14 18:14:48 +00:00
|
|
|
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
|
|
|
};
|
|
|
|
|
2024-07-14 18:14:48 +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
|
|
|
};
|
|
|
|
|
2024-07-14 18:14:48 +00:00
|
|
|
template = {
|
|
|
|
metadata.labels.app = "forgejo";
|
2024-03-29 14:49:34 +00:00
|
|
|
|
2024-07-14 18:14:48 +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
|
|
|
|
2024-07-14 18:14:48 +00:00
|
|
|
containers.forgejo = {
|
|
|
|
image = "codeberg.org/forgejo/forgejo:7.0.5";
|
|
|
|
imagePullPolicy = "Always";
|
2024-03-29 14:49:34 +00:00
|
|
|
|
2024-07-14 18:14:48 +00:00
|
|
|
env = {
|
|
|
|
USER_UID.value = "1000";
|
|
|
|
USER_GID.value = "1000";
|
2024-07-12 12:00:11 +00:00
|
|
|
};
|
|
|
|
|
2024-07-14 18:14:48 +00:00
|
|
|
ports = {
|
|
|
|
web.containerPort = 3000;
|
|
|
|
ssh.containerPort = 22;
|
2024-04-17 21:19:08 +00:00
|
|
|
};
|
2024-07-14 18:14:48 +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 = {
|
2024-07-14 18:14:48 +00:00
|
|
|
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
|
|
|
};
|
|
|
|
|
2024-07-14 18:14:48 +00:00
|
|
|
ssh.spec = {
|
2024-03-29 14:49:34 +00:00
|
|
|
type = "LoadBalancer";
|
2024-04-13 21:25:48 +00:00
|
|
|
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-04-14 21:11:19 +00:00
|
|
|
};
|
2024-03-29 14:49:34 +00:00
|
|
|
|
2024-04-14 21:34:54 +00:00
|
|
|
lab = {
|
2024-07-14 18:14:48 +00:00
|
|
|
ingresses.web = {
|
2024-04-14 21:34:54 +00:00
|
|
|
host = "git.kun.is";
|
|
|
|
|
|
|
|
service = {
|
2024-07-14 18:14:48 +00:00
|
|
|
name = "web";
|
2024-04-14 21:34:54 +00:00
|
|
|
portName = "web";
|
|
|
|
};
|
2024-03-29 14:49:34 +00:00
|
|
|
};
|
2024-07-14 18:14:48 +00:00
|
|
|
|
|
|
|
longhorn.persistentVolumeClaim.data = {
|
|
|
|
volumeName = "forgejo";
|
|
|
|
storage = "20Gi";
|
|
|
|
};
|
2024-03-29 14:49:34 +00:00
|
|
|
};
|
|
|
|
}
|