diff --git a/03-k8s-infra/index.ts b/03-k8s-infra/index.ts index e437d27..1af3eab 100644 --- a/03-k8s-infra/index.ts +++ b/03-k8s-infra/index.ts @@ -122,7 +122,7 @@ new k8s.apiextensions.CustomResource( // ── Longhorn ────────────────────────────────────────────────────────────── - new k8s.helm.v3.Release( +const longhorn = new k8s.helm.v3.Release( "longhorn", { name: "longhorn", @@ -134,13 +134,45 @@ new k8s.apiextensions.CustomResource( values: { defaultSettings: { defaultReplicaCount: 2, - podDeletionPolicyWhenNodeIsDown: "delete-pod-and-force-delete-pod", + nodeDownPodDeletionPolicy: "delete-both-statefulset-and-deployment-pod", + createDefaultDiskLabeledNodes: true, }, }, }, opts(), ); +// Patches Longhorn instances to use the mountend Longhorn storage on the worker nodes. +const workerLonghornDiskPatches = ["k3s-worker-1", "k3s-worker-2"].map( + (nodeName) => + new k8s.apiextensions.CustomResourcePatch( + `${nodeName}-longhorn-disks`, + { + apiVersion: "longhorn.io/v1beta2", + kind: "Node", + metadata: { + name: nodeName, + namespace: "longhorn-system", + annotations: { "pulumi.com/patchForce": "true" }, + }, + spec: { + disks: { + "longhorn-extra": { + allowScheduling: true, + diskDriver: "", + diskType: "filesystem", + evictionRequested: false, + path: "/mnt/longhorn-extra", + storageReserved: 0, + tags: [], + }, + }, + }, + }, + opts({ dependsOn: [longhorn] }), + ), +); + // ── kube-vip ──────────── const kubeVipNamespace = "kube-system";