fix: longhorn | update to 1.10.0 and use longhorn-system namespace

This commit is contained in:
2025-11-15 13:20:51 +05:00
parent 6c419454d8
commit d1aae53fa6

View File

@@ -11,7 +11,6 @@ type LonghornOptions = {
helm: HelmProvider; helm: HelmProvider;
}; };
name: string; name: string;
namespace: string;
}; };
export class Longhorn extends Construct { export class Longhorn extends Construct {
@@ -19,15 +18,15 @@ export class Longhorn extends Construct {
super(scope, id); super(scope, id);
const { helm, kubernetes } = options.providers; const { helm, kubernetes } = options.providers;
const namespace = "longhorn-system";
new Release(this, id, { new Release(this, id, {
name: options.name, name: options.name,
namespace: options.namespace, namespace,
provider: helm, provider: helm,
repository: "https://charts.longhorn.io", repository: "https://charts.longhorn.io",
chart: "longhorn", chart: "longhorn",
createNamespace: true, createNamespace: true,
upgradeInstall: true,
values: [ values: [
fs.readFileSync("helm/values/longhorn.values.yaml", { fs.readFileSync("helm/values/longhorn.values.yaml", {
encoding: "utf8", encoding: "utf8",
@@ -38,44 +37,19 @@ export class Longhorn extends Construct {
new Manifest(this, "recurring-backup-job", { new Manifest(this, "recurring-backup-job", {
provider: kubernetes, provider: kubernetes,
manifest: { manifest: {
apiVersion: "longhorn.io/v1beta1", apiVersion: "longhorn.io/v1beta2",
kind: "RecurringJob", kind: "RecurringJob",
metadata: { metadata: {
name: "daily-backup", name: "daily-backup",
namespace: options.namespace, namespace,
}, },
spec: { spec: {
cron: "0 0 * * *", cron: "0 0 * * *",
task: "backup", task: "backup",
retain: 30, retain: 7,
groups: ["default"],
concurrency: 3, 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,
},
},
});
} }
} }