refactor(traefik): Deploy resources in kube-system namespace

This commit is contained in:
Pim Kunis 2024-07-17 14:26:17 +02:00
parent c7624baa78
commit dfe457c894
7 changed files with 77 additions and 74 deletions

View file

@ -71,6 +71,7 @@ Currently, the applications being deployed like this are:
- `dnsmasq` - `dnsmasq`
- `bind9` - `bind9`
- `media` - `media`
- `traefik`
## Known bugs ## Known bugs

View file

@ -44,7 +44,9 @@
{ {
imports = [ imports = [
kubenix.modules.k8s kubenix.modules.k8s
kubenix.modules.helm
"${self}/kubenix-modules/custom" "${self}/kubenix-modules/custom"
"${self}/kubenix-modules/custom-types.nix"
module module
]; ];
@ -102,4 +104,6 @@
"${self}/kubenix-modules/bind9" "bind9" "dns"; "${self}/kubenix-modules/bind9" "bind9" "dns";
kubenix.media = mkDeployScriptAndManifest kubenix.media = mkDeployScriptAndManifest
"${self}/kubenix-modules/media.nix" "media" "media"; "${self}/kubenix-modules/media.nix" "media" "media";
kubenix.traefik = mkDeployScriptAndManifest
"${self}/kubenix-modules/traefik.nix" "traefik" "kube-system";
}) })

View file

@ -4,12 +4,9 @@
# ./minecraft.nix # ./minecraft.nix
./base.nix ./base.nix
./longhorn.nix ./longhorn.nix
./esrom.nix
./ek2024.nix
./metallb.nix ./metallb.nix
./cert-manager.nix ./cert-manager.nix
./custom ./custom
./traefik.nix
./volumes.nix ./volumes.nix
./custom-types.nix ./custom-types.nix
]; ];

View file

@ -36,10 +36,10 @@
includeCRDs = false; includeCRDs = false;
}; };
argo-workflows = { # argo-workflows = {
chart = nixhelm.chartsDerivations.${system}.argoproj.argo-workflows; # chart = nixhelm.chartsDerivations.${system}.argoproj.argo-workflows;
includeCRDs = true; # includeCRDs = true;
}; # };
longhorn = { longhorn = {
chart = nixhelm.chartsDerivations.${system}.longhorn.longhorn; chart = nixhelm.chartsDerivations.${system}.longhorn.longhorn;
@ -76,6 +76,7 @@
inbucket = { }; inbucket = { };
dns = { }; dns = { };
media = { }; media = { };
traefik = { };
}; };
nodes = nodes =

View file

@ -1,22 +0,0 @@
{
kubernetes.resources = {
services.ek2024.spec = {
type = "ExternalName";
externalName = "ek2024.dmz";
ports.web = {
port = 80;
targetPort = 80;
};
};
};
lab.ingresses.ek2024 = {
host = "ek2024.kun.is";
service = {
name = "ek2024";
portName = "web";
};
};
}

View file

@ -1,22 +0,0 @@
{
kubernetes.resources = {
services.esrom.spec = {
type = "ExternalName";
externalName = "esrom.dmz";
ports.web = {
port = 80;
targetPort = 80;
};
};
};
lab.ingresses.esrom = {
host = "esrom.kun.is";
service = {
name = "esrom";
portName = "web";
};
};
}

View file

@ -1,11 +1,12 @@
{ lib, myLib, ... }: { { lib, myLib, ... }: {
kubernetes.resources.helmChartConfigs = { kubernetes.resources = {
helmChartConfigs = {
traefik = { traefik = {
metadata.namespace = "kube-system"; metadata.namespace = lib.mkForce "kube-system";
# Override Traefik's service with a static load balancer IP. # Override Traefik's service with a static load balancer IP.
# Create endpoint for HTTPS on port 444. # Create endpoint for HTTPS on port 444.
# Allow external name services for esrom. # Allow external name services for servers in LAN.
spec.valuesContent = lib.generators.toYAML { } { spec.valuesContent = lib.generators.toYAML { } {
# service.annotations."metallb.universe.tf/loadBalancerIPs" = myLib.globals.traefikIPv4; # service.annotations."metallb.universe.tf/loadBalancerIPs" = myLib.globals.traefikIPv4;
providers.kubernetesIngress.allowExternalNameServices = true; providers.kubernetesIngress.allowExternalNameServices = true;
@ -31,4 +32,47 @@
}; };
}; };
}; };
services = {
ek2024.spec = {
type = "ExternalName";
externalName = "ek2024.dmz";
ports.web = {
port = 80;
targetPort = 80;
};
};
esrom.spec = {
type = "ExternalName";
externalName = "esrom.dmz";
ports.web = {
port = 80;
targetPort = 80;
};
};
};
};
lab.ingresses = {
ek2024 = {
host = "ek2024.kun.is";
service = {
name = "ek2024";
portName = "web";
};
};
esrom = {
host = "esrom.kun.is";
service = {
name = "esrom";
portName = "web";
};
};
};
} }