split kitchenowl into multiple deployments

This commit is contained in:
Pim Kunis 2024-04-03 21:19:37 +02:00
parent c29a9967a0
commit 18601e30b6

View file

@ -1,23 +1,33 @@
{ {
kubernetes.resources = { kubernetes.resources = {
configMaps.kitchenowl.data = { configMaps.kitchenowl.data = {
BACK_URL = "localhost:5000"; BACK_URL = "kitchenowl-backend.default.svc.cluster.local:5000";
}; };
secrets.kitchenowl.stringData.jwtSecretKey = "ref+file:///home/pim/.config/home/vals.yaml#/kitchenowl/jwtSecretKey"; secrets.kitchenowl.stringData.jwtSecretKey = "ref+file:///home/pim/.config/home/vals.yaml#/kitchenowl/jwtSecretKey";
deployments.kitchenowl = { deployments = {
metadata.labels.app = "kitchenowl"; # TODO: this is quite a lot of boilerplate to create these deployments
# Create custom nixos module for this?
kitchenowl-frontend = {
metadata.labels = {
app = "kitchenowl";
component = "frontend";
};
spec = { spec = {
selector.matchLabels.app = "kitchenowl"; selector.matchLabels = {
app = "kitchenowl";
component = "frontend";
};
template = { template = {
metadata.labels.app = "kitchenowl"; metadata.labels = {
app = "kitchenowl";
component = "frontend";
};
spec = { spec.containers.kitchenowl-frontend = {
containers = {
kitchenowl-frontend = {
image = "tombursch/kitchenowl-web:v0.4.20"; image = "tombursch/kitchenowl-web:v0.4.20";
envFrom = [{ configMapRef.name = "kitchenowl"; }]; envFrom = [{ configMapRef.name = "kitchenowl"; }];
@ -26,16 +36,42 @@
protocol = "TCP"; protocol = "TCP";
}]; }];
}; };
};
};
};
kitchenowl-backend = { kitchenowl-backend = {
metadata.labels = {
app = "kitchenowl";
component = "backend";
};
spec = {
selector.matchLabels = {
app = "kitchenowl";
component = "backend";
};
template = {
metadata.labels = {
app = "kitchenowl";
component = "backend";
};
spec = {
containers.kitchenowl-backend = {
image = "tombursch/kitchenowl:v92"; image = "tombursch/kitchenowl:v92";
ports = [{
containerPort = 5000;
protocol = "TCP";
}];
volumeMounts = [{ volumeMounts = [{
name = "data"; name = "data";
mountPath = "/data"; mountPath = "/data";
}]; }];
}; };
};
volumes = [{ volumes = [{
name = "data"; name = "data";
@ -45,6 +81,7 @@
}; };
}; };
}; };
};
persistentVolumes.kitchenowl.spec = { persistentVolumes.kitchenowl.spec = {
capacity.storage = "1Mi"; capacity.storage = "1Mi";
@ -63,8 +100,12 @@
volumeName = "kitchenowl"; volumeName = "kitchenowl";
}; };
services.kitchenowl.spec = { services = {
selector.app = "kitchenowl"; kitchenowl-web.spec = {
selector = {
app = "kitchenowl";
component = "frontend";
};
ports = [{ ports = [{
protocol = "TCP"; protocol = "TCP";
@ -73,6 +114,20 @@
}]; }];
}; };
kitchenowl-backend.spec = {
selector = {
app = "kitchenowl";
component = "backend";
};
ports = [{
protocol = "TCP";
port = 5000;
targetPort = 5000;
}];
};
};
ingresses.kitchenowl.spec = { ingresses.kitchenowl.spec = {
ingressClassName = "traefik"; ingressClassName = "traefik";
@ -84,7 +139,7 @@
pathType = "Prefix"; pathType = "Prefix";
backend.service = { backend.service = {
name = "kitchenowl"; name = "kitchenowl-web";
port.number = 80; port.number = 80;
}; };
}]; }];