feat: CDKTF | migrate DNS system to cdktf
This commit is contained in:
42
pihole/index.ts
Normal file
42
pihole/index.ts
Normal 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",
|
||||
}),
|
||||
],
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user