custom longhorn storage class

This commit is contained in:
azykov@mail.ru
2026-10-13 14:58:00 +03:00
parent 406678fdc2
commit d909f3e317
5 changed files with 37 additions and 6 deletions
@@ -61,10 +61,9 @@ spec:
# чтобы не разъезжались реплики при 3 нодах # чтобы не разъезжались реплики при 3 нодах
replicaSoftAntiAffinity: false replicaSoftAntiAffinity: false
persistence: persistence:
defaultClass: true # the default "longhorn" StorageClass lives in ../storage-classes/longhorn.yaml -
defaultClassReplicaCount: 3 # the chart hardcodes staleReplicaTimeout: "30" and offers no value to override it
defaultFsType: ext4 createStorageClass: false
reclaimPolicy: Retain
csi: csi:
attacherReplicaCount: 3 attacherReplicaCount: 3
provisionerReplicaCount: 3 provisionerReplicaCount: 3
@@ -1,5 +1,6 @@
apiVersion: kustomize.config.k8s.io/v1beta1 apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization kind: Kustomization
resources: resources:
- longhorn.yaml
- longhorn-no-retain.yaml - longhorn-no-retain.yaml
- longhorn-single-replica.yaml - longhorn-single-replica.yaml
@@ -4,9 +4,11 @@ metadata:
name: longhorn-no-retain name: longhorn-no-retain
annotations: annotations:
storageclass.kubernetes.io/is-default-class: "false" storageclass.kubernetes.io/is-default-class: "false"
# StorageClass parameters are immutable - let Flux recreate the object on change
kustomize.toolkit.fluxcd.io/force: enabled
provisioner: driver.longhorn.io provisioner: driver.longhorn.io
reclaimPolicy: Delete reclaimPolicy: Delete
allowVolumeExpansion: true allowVolumeExpansion: true
parameters: parameters:
numberOfReplicas: "3" numberOfReplicas: "3"
staleReplicaTimeout: "30" staleReplicaTimeout: "2880"
@@ -4,9 +4,11 @@ metadata:
name: longhorn-single-replica name: longhorn-single-replica
annotations: annotations:
storageclass.kubernetes.io/is-default-class: "false" storageclass.kubernetes.io/is-default-class: "false"
# StorageClass parameters are immutable - let Flux recreate the object on change
kustomize.toolkit.fluxcd.io/force: enabled
provisioner: driver.longhorn.io provisioner: driver.longhorn.io
reclaimPolicy: Retain reclaimPolicy: Retain
allowVolumeExpansion: true allowVolumeExpansion: true
parameters: parameters:
numberOfReplicas: "1" numberOfReplicas: "1"
staleReplicaTimeout: "30" staleReplicaTimeout: "2880"
@@ -0,0 +1,27 @@
# Default Longhorn class. Managed here instead of by the chart (persistence.createStorageClass: false
# in the HelmRelease) because the chart hardcodes staleReplicaTimeout: "30".
# Parameters otherwise mirror what chart 1.12.1 rendered.
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: longhorn
annotations:
storageclass.kubernetes.io/is-default-class: "true"
# StorageClass parameters are immutable - let Flux recreate the object on change
kustomize.toolkit.fluxcd.io/force: enabled
provisioner: driver.longhorn.io
reclaimPolicy: Retain
allowVolumeExpansion: true
volumeBindingMode: Immediate
parameters:
numberOfReplicas: "3"
# minutes a failed replica is kept for reuse before it is discarded and fully rebuilt;
# 30 was shorter than a planned node shutdown and caused a ~1.2TB full rebuild of kube-3
staleReplicaTimeout: "1440"
fromBackup: ""
fsType: ext4
dataLocality: disabled
unmapMarkSnapChainRemoved: ignored
disableRevisionCounter: "true"
dataEngine: v1
backupTargetName: default