diff --git a/helm/helmfile.yaml b/helm/helmfile.yaml deleted file mode 100644 index 556e0b0..0000000 --- a/helm/helmfile.yaml +++ /dev/null @@ -1,10 +0,0 @@ -repositories: - - name: metallb - url: https://metallb.github.io/metallb ---- -releases: - # Load Balancer - - name: metallb - namespace: metallb-system - chart: metallb/metallb - version: 0.14.8 diff --git a/main.ts b/main.ts index 4e84c66..496e1f3 100644 --- a/main.ts +++ b/main.ts @@ -17,6 +17,7 @@ import { PiHole } from "./pihole"; import { MemcachedCluster } from "./memcached"; import { Nginx } from "./nginx"; import { Prometheus } from "./prometheus"; +import { MetalLB } from "./metallb"; dotenv.config(); @@ -69,11 +70,10 @@ class Homelab extends TerraformStack { }, }); - new PiHole(this, "pihole", { - namespace: "pihole-system", + new MetalLB(this, "metallb", { provider: helm, - name: "pihole", - version: "2.26.1", + name: "metallb", + namespace: "metallb-system", }); new Nginx(this, "nginx", { @@ -82,6 +82,13 @@ class Homelab extends TerraformStack { name: "ingress-nginx-internal", }); + new PiHole(this, "pihole", { + namespace: "pihole-system", + provider: helm, + name: "pihole", + version: "2.26.1", + }); + new Prometheus(this, "prometheus", { provider: helm, namespace: "prometheus-system", diff --git a/metallb/index.ts b/metallb/index.ts new file mode 100644 index 0000000..c8b48de --- /dev/null +++ b/metallb/index.ts @@ -0,0 +1,22 @@ +import { HelmProvider } from "@cdktf/provider-helm/lib/provider"; +import { Release } from "@cdktf/provider-helm/lib/release"; +import { Construct } from "constructs"; + +type MetalLBOptions = { + provider: HelmProvider; + name: string; + namespace: string; +}; + +export class MetalLB extends Construct { + constructor(scope: Construct, id: string, options: MetalLBOptions) { + super(scope, id); + + new Release(this, id, { + ...options, + repository: "https://metallb.github.io/metallb", + chart: "metallb", + createNamespace: true, + }); + } +}