kubernetes-deployments/modules/minecraft.nix

60 lines
1.3 KiB
Nix
Raw Normal View History

2024-10-28 15:05:06 +00:00
{
lib,
config,
globals,
...
}: {
2024-09-07 10:35:02 +00:00
options.minecraft.enable = lib.mkEnableOption "minecraft";
config = lib.mkIf config.minecraft.enable {
kubernetes.resources = {
deployments.minecraft.spec = {
selector.matchLabels.app = "minecraft";
template = {
metadata.labels.app = "minecraft";
spec = {
volumes.data.persistentVolumeClaim.claimName = "data";
containers.minecraft = {
image = globals.images.minecraft;
ports.minecraft.containerPort = 25565;
env.EULA.value = "TRUE";
2024-10-28 15:05:06 +00:00
volumeMounts = [
{
name = "data";
mountPath = "/data";
}
];
2024-09-07 10:35:02 +00:00
};
securityContext = {
fsGroup = 1000;
fsGroupChangePolicy = "OnRootMismatch";
};
};
};
};
services.minecraft.spec = {
type = "LoadBalancer";
loadBalancerIP = globals.minecraftIPv4;
selector.app = "minecraft";
ports.minecraft = {
port = 25565;
targetPort = "minecraft";
};
};
};
lab.longhorn.persistentVolumeClaim.data = {
volumeName = "minecraft";
storage = "1Gi";
};
};
}