feat: Traefik | add traefik ingress class
This commit is contained in:
18
helm/values/traefik.values.yaml
Normal file
18
helm/values/traefik.values.yaml
Normal file
@@ -0,0 +1,18 @@
|
||||
ingress:
|
||||
ingressClass:
|
||||
enabled: true
|
||||
isDefaultClass: false
|
||||
name: traefik
|
||||
deployment:
|
||||
replicas: 3
|
||||
podLabels:
|
||||
app: traefik
|
||||
nodeSelector:
|
||||
nodepool: worker
|
||||
topologySpreadConstraints:
|
||||
- maxSkew: 1
|
||||
topologyKey: "kubernetes.io/hostname"
|
||||
whenUnsatisfiable: "ScheduleAnyway"
|
||||
labelSelector:
|
||||
matchLabels:
|
||||
app: traefik
|
||||
7
main.ts
7
main.ts
@@ -14,6 +14,7 @@ import { AuthentikServer } from "./authentik";
|
||||
import { ValkeyCluster } from "./valkey";
|
||||
import { CertManager } from "./cert-manager";
|
||||
import { Nginx } from "./nginx";
|
||||
import { Traefik } from "./traefik";
|
||||
import { Prometheus } from "./prometheus";
|
||||
import { MetalLB } from "./metallb";
|
||||
import { ExternalDNS } from "./external-dns";
|
||||
@@ -74,6 +75,12 @@ class Homelab extends TerraformStack {
|
||||
name: "nginx-ingress",
|
||||
});
|
||||
|
||||
new Traefik(this, "traefik", {
|
||||
provider: helm,
|
||||
namespace,
|
||||
name: "traefik",
|
||||
});
|
||||
|
||||
const certManagerApiVersion = "cert-manager.io/v1";
|
||||
|
||||
const cm = new CertManager(this, "cert-manager", {
|
||||
|
||||
28
traefik/index.ts
Normal file
28
traefik/index.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
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 TraefikOptions = {
|
||||
provider: HelmProvider;
|
||||
name: string;
|
||||
namespace: string;
|
||||
};
|
||||
|
||||
export class Traefik extends Construct {
|
||||
constructor(scope: Construct, id: string, options: TraefikOptions) {
|
||||
super(scope, id);
|
||||
|
||||
new Release(this, id, {
|
||||
...options,
|
||||
repository: "https://traefik.github.io/charts",
|
||||
chart: "traefik",
|
||||
createNamespace: true,
|
||||
values: [
|
||||
fs.readFileSync("helm/values/traefik.values.yaml", {
|
||||
encoding: "utf8",
|
||||
}),
|
||||
],
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user