feat: CDKTF | migrate DNS system to cdktf

This commit is contained in:
2025-07-15 11:25:22 +05:00
parent 5b352cbb7e
commit 910f1d06a3
4 changed files with 53 additions and 4 deletions

42
pihole/index.ts Normal file
View File

@@ -0,0 +1,42 @@
import * as fs from "fs";
import { HelmProvider } from "@cdktf/provider-helm/lib/provider";
import { Release } from "@cdktf/provider-helm/lib/release";
import { Construct } from "constructs";
type PiHoleOptions = {
provider: HelmProvider;
version: string;
name: string;
namespace: string;
};
export class PiHole extends Construct {
constructor(scope: Construct, id: string, options: PiHoleOptions) {
super(scope, id);
new Release(this, id, {
...options,
repository: "https://mojo2600.github.io/pihole-kubernetes",
chart: "pihole",
createNamespace: true,
values: [
fs.readFileSync("helm/values/pihole.values.yaml", {
encoding: "utf8",
}),
],
});
new Release(this, "external-dns", {
provider: options.provider,
name: "externaldns-pihole",
namespace: options.namespace,
repository: "https://charts.bitnami.com/bitnami",
chart: "external-dns",
values: [
fs.readFileSync("helm/values/externaldns.values.yaml", {
encoding: "utf8",
}),
],
});
}
}