feat: CDKTF | migrate longhorn to cdktf

This commit is contained in:
2025-07-15 09:10:04 +05:00
parent 5bfb72ef81
commit 452cfe37df
6 changed files with 77 additions and 13 deletions

46
1password/index.ts Normal file
View File

@@ -0,0 +1,46 @@
import * as fs from "fs";
import { Construct } from "constructs";
import { Manifest } from "@cdktf/provider-kubernetes/lib/manifest";
import { KubernetesProvider } from "@cdktf/provider-kubernetes/lib/provider";
type OnePasswordSecret = {
name: string;
namespace: string;
itemPath: string;
};
type OnePasswordOptions = {
provider: KubernetesProvider;
};
export class OnePassword extends Construct {
constructor(scope: Construct, id: string, options: OnePasswordOptions) {
super(scope, id);
const secrets: OnePasswordSecret[] = JSON.parse(
fs.readFileSync("1password/secrets.json", {
encoding: "utf8",
}),
);
secrets.forEach((secret) => {
new Manifest(this, secret.name, {
provider: options.provider,
manifest: {
apiVersion: "onepassword.com/v1",
kind: "OnePasswordItem",
metadata: {
name: secret.name,
namespace: secret.namespace,
annotations: {
"operator.1password.io/auto-restart": "true",
},
},
spec: {
itemPath: secret.itemPath,
},
},
});
});
}
}