feat(forgejo): Move to separate k8s namespace

This commit is contained in:
Pim Kunis 2024-07-14 20:14:48 +02:00
parent 17f507d277
commit f606cb2f1c
6 changed files with 59 additions and 54 deletions

View file

@ -61,6 +61,7 @@ Currently, the applications being deployed like this are:
- `nextcloud` - `nextcloud`
- `hedgedoc` - `hedgedoc`
- `kitchenowl` - `kitchenowl`
- `forgejo`
## Known bugs ## Known bugs

View file

@ -82,4 +82,6 @@
"${self}/kubenix-modules/hedgedoc.nix" "hedgedoc" "hedgedoc"; "${self}/kubenix-modules/hedgedoc.nix" "hedgedoc" "hedgedoc";
kubenix.kitchenowl = mkDeployScriptAndManifest kubenix.kitchenowl = mkDeployScriptAndManifest
"${self}/kubenix-modules/kitchenowl.nix" "kitchenowl" "kitchenowl"; "${self}/kubenix-modules/kitchenowl.nix" "kitchenowl" "kitchenowl";
kubenix.forgejo = mkDeployScriptAndManifest
"${self}/kubenix-modules/forgejo" "forgejo" "forgejo";
}) })

View file

@ -4,7 +4,6 @@ let
./syncthing.nix ./syncthing.nix
./pihole.nix ./pihole.nix
./paperless.nix ./paperless.nix
./forgejo
./media.nix ./media.nix
./bind9 ./bind9
./dnsmasq.nix ./dnsmasq.nix

View file

@ -69,6 +69,7 @@
nextcloud = { }; nextcloud = { };
hedgedoc = { }; hedgedoc = { };
kitchenowl = { }; kitchenowl = { };
forgejo = { };
}; };
nodes = nodes =

View file

@ -1,23 +1,12 @@
{ lib, myLib, ... }: { { lib, myLib, ... }: {
kubernetes.resources = { kubernetes.resources = {
configMaps = { configMaps = {
forgejo-config.data = { config.data = {
config = lib.generators.toINI { } (import ./config.nix); config = lib.generators.toINI { } (import ./config.nix);
}; };
forgejo-env.data = {
USER_UID = "1000";
USER_GID = "1000";
};
}; };
deployments.forgejo = { deployments.server.spec = {
metadata.labels = {
app = "forgejo";
component = "forgejo";
};
spec = {
selector.matchLabels.app = "forgejo"; selector.matchLabels.app = "forgejo";
strategy = { strategy = {
@ -33,9 +22,18 @@
metadata.labels.app = "forgejo"; metadata.labels.app = "forgejo";
spec = { spec = {
# This disables services from becoming environmental variables
# to prevent SSH_PORT clashing with Forgejo config.
enableServiceLinks = false;
containers.forgejo = { containers.forgejo = {
image = "codeberg.org/forgejo/forgejo:7.0.5"; image = "codeberg.org/forgejo/forgejo:7.0.5";
envFrom = [{ configMapRef.name = "forgejo-env"; }]; imagePullPolicy = "Always";
env = {
USER_UID.value = "1000";
USER_GID.value = "1000";
};
ports = { ports = {
web.containerPort = 3000; web.containerPort = 3000;
@ -56,16 +54,15 @@
}; };
volumes = { volumes = {
data.persistentVolumeClaim.claimName = "forgejo"; data.persistentVolumeClaim.claimName = "data";
config.configMap.name = "forgejo-config"; config.configMap.name = "config";
};
}; };
}; };
}; };
}; };
services = { services = {
forgejo-web.spec = { web.spec = {
selector.app = "forgejo"; selector.app = "forgejo";
ports.web = { ports.web = {
@ -74,7 +71,7 @@
}; };
}; };
forgejo-ssh.spec = { ssh.spec = {
type = "LoadBalancer"; type = "LoadBalancer";
loadBalancerIP = myLib.globals.gitIPv4; loadBalancerIP = myLib.globals.gitIPv4;
selector.app = "forgejo"; selector.app = "forgejo";
@ -88,13 +85,18 @@
}; };
lab = { lab = {
ingresses.forgejo = { ingresses.web = {
host = "git.kun.is"; host = "git.kun.is";
service = { service = {
name = "forgejo-web"; name = "web";
portName = "web"; portName = "web";
}; };
}; };
longhorn.persistentVolumeClaim.data = {
volumeName = "forgejo";
storage = "20Gi";
};
}; };
} }

View file

@ -17,7 +17,6 @@
minecraft.storage = "1Gi"; minecraft.storage = "1Gi";
pihole-data.storage = "750Mi"; pihole-data.storage = "750Mi";
pihole-dnsmasq.storage = "16Mi"; pihole-dnsmasq.storage = "16Mi";
forgejo.storage = "20Gi";
syncthing.storage = "400Mi"; syncthing.storage = "400Mi";
paperless-data.storage = "10Gi"; paperless-data.storage = "10Gi";
paperless-redisdata.storage = "20Mi"; paperless-redisdata.storage = "20Mi";
@ -45,6 +44,7 @@
hedgedoc-uploads.storage = "50Mi"; hedgedoc-uploads.storage = "50Mi";
hedgedoc-db.storage = "100Mi"; hedgedoc-db.storage = "100Mi";
kitchenowl.storage = "100Mi"; kitchenowl.storage = "100Mi";
forgejo.storage = "20Gi";
}; };
nfsVolumes = { nfsVolumes = {