Purge Longhorn

This commit is contained in:
Pim Kunis 2025-05-29 12:37:50 +02:00
parent 850af1b1bf
commit 3999016b78
6 changed files with 0 additions and 314 deletions

View file

@ -15,28 +15,9 @@
chart = nixhelm.chartsDerivations.${system}.metallb.metallb;
includeCRDs = true;
};
longhorn = {
chart = nixhelm.chartsDerivations.${system}.longhorn.longhorn;
includeCRDs = true;
values = {
persistence.defaultClassReplicaCount = 2;
service.ui.type = "LoadBalancer";
defaultSettings = {
defaultDataPath = "/mnt/longhorn";
storageMinimalAvailablePercentage = 0;
allowRecurringJobWhileVolumeDetached = true;
backupTarget = "nfs://lewis.dmz:/mnt/longhorn/persistent/longhorn-backup";
};
};
};
};
resources = {
services.longhorn-frontend.spec.loadBalancerIP = globals.longhornIPv4;
namespaces = {
static-websites = {};
freshrss = {};
@ -67,32 +48,9 @@
})
globals.nodeLabels;
recurringJobs.backup-nfs.spec = {
cron = "0 1 * * *"; # One o'clock at night
task = "backup";
retain = 2; # We don't need many, as we also make Borg backups.
concurrency = 1;
};
backuptargets.backup.spec = {
backupTargetURL = "nfs://lewis.dmz:/mnt/longhorn/persistent/longhorn-backup";
pollInterval = "5m0s";
};
ipAddressPools.main.spec.addresses = ["192.168.30.128-192.168.30.200" "2a0d:6e00:1a77:30::2-2a0d:6e00:1a77:30:ffff:ffff:ffff:fffe"];
l2Advertisements.main.metadata = {};
};
};
lab = {
tailscaleIngresses.tailscale-longhorn = {
host = "longhorn";
service = {
name = "longhorn-frontend";
portName = "http";
};
};
};
};
}

View file

@ -2,7 +2,6 @@
imports = [
./inbucket.nix
./tailscale-ingress.nix
./longhorn-volume.nix
./ingress.nix
./dummy-types.nix
./dnsmasq.nix

View file

@ -32,25 +32,11 @@
kind = "ClusterIssuer";
};
recurringJob = {
attrName = "recurringJobs";
group = "longhorn.io";
version = "v1beta1";
kind = "RecurringJob";
};
middlewares = {
attrName = "middlewares";
group = "traefik.io";
version = "v1alpha1";
kind = "Middleware";
};
backuptargets = {
attrName = "backuptargets";
group = "longhorn.io";
version = "v1beta1";
kind = "BackupTarget";
};
};
}

View file

@ -1,157 +0,0 @@
{
lib,
config,
...
}: let
longhornVolumeOpts = _: {
options = {
storage = lib.mkOption {
type = lib.types.str;
};
namespace = lib.mkOption {
type = lib.types.str;
default = "default";
};
};
};
longhornPVOpts = _: {
options = {
storage = lib.mkOption {
type = lib.types.str;
};
};
};
longhornPVCOpts = {name, ...}: {
options = {
volumeName = lib.mkOption {
type = lib.types.str;
default = name;
};
# TODO: ideally we take this from the longhornPV so we don't duplicate this information.
storage = lib.mkOption {
type = lib.types.str;
};
};
};
in {
options = {
lab.longhornVolumes = lib.mkOption {
type = with lib.types; attrsOf (submodule longhornVolumeOpts);
default = {};
};
lab.longhorn = {
persistentVolume = lib.mkOption {
type = with lib.types; attrsOf (submodule longhornPVOpts);
default = {};
};
persistentVolumeClaim = lib.mkOption {
type = with lib.types; attrsOf (submodule longhornPVCOpts);
default = {};
};
};
};
config = {
kubernetes.resources = {
persistentVolumes =
lib.mergeAttrs
(builtins.mapAttrs
(name: longhornVolume: {
spec = {
accessModes = ["ReadWriteOnce"];
capacity.storage = longhornVolume.storage;
persistentVolumeReclaimPolicy = "Delete";
volumeMode = "Filesystem";
claimRef = {
inherit name;
inherit (longhornVolume) namespace;
};
csi = {
driver = "driver.longhorn.io";
fsType = "ext4";
volumeHandle = name;
volumeAttributes = {
dataLocality = "disabled";
fromBackup = "";
fsType = "ext4";
numberOfReplicas = "2";
staleReplicaTimeout = "30";
unmapMarkSnapChainRemoved = "ignored";
recurringJobSelector = lib.generators.toYAML {} [
{
name = "backup-nfs";
isGroup = false;
}
];
};
};
};
})
config.lab.longhornVolumes)
(builtins.mapAttrs
(name: longhornPV: {
spec = {
accessModes = ["ReadWriteOnce"];
capacity.storage = longhornPV.storage;
persistentVolumeReclaimPolicy = "Delete";
volumeMode = "Filesystem";
csi = {
driver = "driver.longhorn.io";
fsType = "ext4";
volumeHandle = name;
volumeAttributes = {
dataLocality = "disabled";
fromBackup = "";
fsType = "ext4";
numberOfReplicas = "2";
staleReplicaTimeout = "30";
unmapMarkSnapChainRemoved = "ignored";
recurringJobSelector = lib.generators.toYAML {} [
{
name = "backup-nfs";
isGroup = false;
}
];
};
};
};
})
config.lab.longhorn.persistentVolume);
persistentVolumeClaims =
lib.mergeAttrs
(builtins.mapAttrs
(_name: longhornVolume: {
spec = {
accessModes = ["ReadWriteOnce"];
resources.requests.storage = longhornVolume.storage;
storageClassName = "";
};
})
config.lab.longhornVolumes)
(builtins.mapAttrs
(_name: longhornPVC: {
spec = {
accessModes = ["ReadWriteOnce"];
resources.requests.storage = longhornPVC.storage;
storageClassName = "";
inherit (longhornPVC) volumeName;
};
})
config.lab.longhorn.persistentVolumeClaim);
};
};
}