Replies: 4 comments
-
|
found how to achieve it |
Beta Was this translation helpful? Give feedback.
-
|
no, doesnt work. reopen |
Beta Was this translation helpful? Give feedback.
-
|
PR is here #1800 Basically how you can use it now longhorn_values = <<EOT
defaultSettings:
nodeDrainPolicy: allow-if-replica-is-stopped
defaultDataPath: /var/longhorn
persistence:
defaultFsType: ext4
defaultClassReplicaCount: 3
defaultClass: true
EOTAfter that later after cluster creation you can fetch nodes by some labels where you know that external ssd disk mounted. In my case nodes with label data "kubernetes_nodes" "ssd_nodes" {
metadata {
labels = {
"ssd" = "true"
}
}
}
# Patch nodes only with this label
resource "null_resource" "longhorn_patch_external_disk" {
for_each = {
for node in data.kubernetes_nodes.ssd_nodes.nodes : node.metadata[0].name => node.metadata[0].name
}
triggers = {
always_run = timestamp() # triggers re-run on every apply
}
provisioner "local-exec" {
command = <<-EOT
KUBECONFIG=${var.kubeconfig_path} kubectl -n longhorn-system patch nodes.longhorn.io ${each.key} --type merge -p '{
"spec": {
"disks": {
"external-ssd": {
"path": "/var/lib/longhorn",
"allowScheduling": true,
"tags": ["ssd"]
}
}
}
}'
EOT
}
}
resource "kubernetes_manifest" "longhorn_ssd_replica" {
manifest = {
apiVersion = "storage.k8s.io/v1"
kind = "StorageClass"
metadata = {
name = "longhorn-ssd-replica"
}
provisioner = "driver.longhorn.io"
parameters = {
numberOfReplicas = "1"
staleReplicaTimeout = "30"
diskSelector = "ssd"
# nodeSelector = "ssd=true"
fromBackup = ""
}
reclaimPolicy = "Delete"
allowVolumeExpansion = true
volumeBindingMode = "Immediate"
}
depends_on = [null_resource.longhorn_patch_external_disk]
}
|
Beta Was this translation helpful? Give feedback.
-
|
PR for this already completed #1800 |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Description
It is pain to make work longhorn by default on nvme and ssd. Because module has hardcoded value for mount path of disk and longhorn values file also pin path to
/var/longhornSo just customising mount path will give ability to create secondstorage class in longhorn with path and use both storages nvme and ssd
Beta Was this translation helpful? Give feedback.
All reactions