nixos-servers/kubenix-modules/minecraft.nix

65 lines
1.5 KiB
Nix

{ myLib, ... }: {
kubernetes.resources = {
configMaps.minecraft-env.data.EULA = "TRUE";
deployments.minecraft = {
metadata.labels.app = "minecraft";
spec = {
selector.matchLabels.app = "minecraft";
template = {
metadata.labels.app = "minecraft";
spec = {
volumes.data.persistentVolumeClaim.claimName = "minecraft";
containers.minecraft = {
image = "itzg/minecraft-server";
envFrom = [{ configMapRef.name = "minecraft-env"; }];
ports = [{
containerPort = 25565;
protocol = "TCP";
}];
volumeMounts = [{
name = "data";
mountPath = "/data";
}];
};
};
};
};
};
persistentVolumes.minecraft.spec = {
capacity.storage = "1Mi";
accessModes = [ "ReadWriteMany" ];
nfs = {
server = "lewis.dmz";
path = "/mnt/data/nfs/minecraft";
};
};
persistentVolumeClaims.minecraft.spec = {
accessModes = [ "ReadWriteMany" ];
storageClassName = "";
resources.requests.storage = "1Mi";
volumeName = "minecraft";
};
services.minecraft.spec = {
type = "LoadBalancer";
loadBalancerIP = myLib.globals.minecraftIPv4;
selector.app = "minecraft";
ports = [{
port = 25565;
targetPort = 25565;
protocol = "TCP";
}];
};
};
}