diff --git a/longhorn/index.ts b/longhorn/index.ts index 0307252..02d794a 100644 --- a/longhorn/index.ts +++ b/longhorn/index.ts @@ -11,7 +11,6 @@ type LonghornOptions = { helm: HelmProvider; }; name: string; - namespace: string; }; export class Longhorn extends Construct { @@ -19,15 +18,15 @@ export class Longhorn extends Construct { super(scope, id); const { helm, kubernetes } = options.providers; + const namespace = "longhorn-system"; new Release(this, id, { name: options.name, - namespace: options.namespace, + namespace, provider: helm, repository: "https://charts.longhorn.io", chart: "longhorn", createNamespace: true, - upgradeInstall: true, values: [ fs.readFileSync("helm/values/longhorn.values.yaml", { encoding: "utf8", @@ -38,44 +37,19 @@ export class Longhorn extends Construct { new Manifest(this, "recurring-backup-job", { provider: kubernetes, manifest: { - apiVersion: "longhorn.io/v1beta1", + apiVersion: "longhorn.io/v1beta2", kind: "RecurringJob", metadata: { name: "daily-backup", - namespace: options.namespace, + namespace, }, spec: { cron: "0 0 * * *", task: "backup", - retain: 30, - groups: ["default"], + retain: 7, concurrency: 3, }, }, }); - - new Manifest(this, "longhorn-crypto-storage-class", { - provider: kubernetes, - manifest: { - kind: "StorageClass", - apiVersion: "storage.k8s.io/v1", - metadata: { - name: "longhorn-crypto", - }, - provisioner: "driver.longhorn.io", - allowVolumeExpansion: true, - parameters: { - numberOfReplicas: "3", - staleReplicaTimeout: "2880", // 48 hours in minutes - encrypted: "true", - "csi.storage.k8s.io/provisioner-secret-name": "longhorn-encryption", - "csi.storage.k8s.io/provisioner-secret-namespace": options.namespace, - "csi.storage.k8s.io/node-publish-secret-name": "longhorn-encryption", - "csi.storage.k8s.io/node-publish-secret-namespace": options.namespace, - "csi.storage.k8s.io/node-stage-secret-name": "longhorn-encryption", - "csi.storage.k8s.io/node-stage-secret-namespace": options.namespace, - }, - }, - }); } }