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,46 +1,83 @@
{ {
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 = { image = "tombursch/kitchenowl-web:v0.4.20";
kitchenowl-frontend = { envFrom = [{ configMapRef.name = "kitchenowl"; }];
image = "tombursch/kitchenowl-web:v0.4.20";
envFrom = [{ configMapRef.name = "kitchenowl"; }]; ports = [{
containerPort = 80;
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 = [{ ports = [{
containerPort = 80; containerPort = 5000;
protocol = "TCP"; protocol = "TCP";
}]; }];
};
kitchenowl-backend = {
image = "tombursch/kitchenowl:v92";
volumeMounts = [{ volumeMounts = [{
name = "data"; name = "data";
mountPath = "/data"; mountPath = "/data";
}]; }];
}; };
};
volumes = [{ volumes = [{
name = "data"; name = "data";
persistentVolumeClaim.claimName = "kitchenowl"; persistentVolumeClaim.claimName = "kitchenowl";
}]; }];
};
}; };
}; };
}; };
@ -63,14 +100,32 @@
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";
port = 80; port = 80;
targetPort = 80; targetPort = 80;
}]; }];
};
kitchenowl-backend.spec = {
selector = {
app = "kitchenowl";
component = "backend";
};
ports = [{
protocol = "TCP";
port = 5000;
targetPort = 5000;
}];
};
}; };
ingresses.kitchenowl.spec = { ingresses.kitchenowl.spec = {
@ -84,7 +139,7 @@
pathType = "Prefix"; pathType = "Prefix";
backend.service = { backend.service = {
name = "kitchenowl"; name = "kitchenowl-web";
port.number = 80; port.number = 80;
}; };
}]; }];