dotfiles/terranix/lib/kube/pv_and_pvc.nix
magic_rb 87400566be
Move Gitea over to the kubernetes "cluster"
Signed-off-by: magic_rb <magic_rb@redalder.org>
2024-07-12 22:04:52 +02:00

50 lines
1 KiB
Nix

{lib, ...}: {
name,
capacity,
namespace,
labels,
hostPath,
}: {...}: {
resource."kubernetes_manifest"."${name}-persistent-volume" = {
manifest = {
apiVersion = "v1";
kind = "PersistentVolume";
metadata = {
inherit name labels;
};
spec = {
capacity.storage = capacity;
claimRef = {
inherit name namespace;
};
volumeMode = "Filesystem";
accessModes = [
"ReadWriteOnce"
];
persistentVolumeReclaimPolicy = "Retain";
storageClassName = "hostpath";
hostPath.path = hostPath;
};
};
};
resource."kubernetes_manifest"."${name}-persistent-volume-clain" = {
manifest = {
kind = "PersistentVolumeClaim";
apiVersion = "v1";
metadata = {
inherit name namespace;
};
spec = {
volumeName = name;
storageClassName = "hostpath";
accessModes = [
"ReadWriteOnce"
];
resources.requests.storage = capacity;
};
};
};
}