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