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 = {
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";
deployments.kitchenowl = {
metadata.labels.app = "kitchenowl";
deployments = {
# 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 = {
selector.matchLabels.app = "kitchenowl";
selector.matchLabels = {
app = "kitchenowl";
component = "frontend";
};
template = {
metadata.labels.app = "kitchenowl";
metadata.labels = {
app = "kitchenowl";
component = "frontend";
};
spec = {
containers = {
kitchenowl-frontend = {
spec.containers.kitchenowl-frontend = {
image = "tombursch/kitchenowl-web:v0.4.20";
envFrom = [{ configMapRef.name = "kitchenowl"; }];
@ -26,16 +36,42 @@
protocol = "TCP";
}];
};
};
};
};
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";
ports = [{
containerPort = 5000;
protocol = "TCP";
}];
volumeMounts = [{
name = "data";
mountPath = "/data";
}];
};
};
volumes = [{
name = "data";
@ -45,6 +81,7 @@
};
};
};
};
persistentVolumes.kitchenowl.spec = {
capacity.storage = "1Mi";
@ -63,8 +100,12 @@
volumeName = "kitchenowl";
};
services.kitchenowl.spec = {
selector.app = "kitchenowl";
services = {
kitchenowl-web.spec = {
selector = {
app = "kitchenowl";
component = "frontend";
};
ports = [{
protocol = "TCP";
@ -73,6 +114,20 @@
}];
};
kitchenowl-backend.spec = {
selector = {
app = "kitchenowl";
component = "backend";
};
ports = [{
protocol = "TCP";
port = 5000;
targetPort = 5000;
}];
};
};
ingresses.kitchenowl.spec = {
ingressClassName = "traefik";
@ -84,7 +139,7 @@
pathType = "Prefix";
backend.service = {
name = "kitchenowl";
name = "kitchenowl-web";
port.number = 80;
};
}];