feat: CDKTF | migrate redis to cdktf

This commit is contained in:
2025-07-15 09:28:50 +05:00
parent 6f782e4775
commit 5475a25b94
3 changed files with 37 additions and 8 deletions

View File

@@ -66,11 +66,3 @@ releases:
version: 62.3.0 version: 62.3.0
values: values:
- ./values/prometheus.values.yaml - ./values/prometheus.values.yaml
# Redis
- name: redis
namespace: redis-system
chart: bitnami/redis
version: 20.2.0
values:
- ./values/redis.values.yaml

View File

@@ -10,6 +10,7 @@ import { OnePassword } from "./1password";
import { PostgresCluster } from "./postgres"; import { PostgresCluster } from "./postgres";
import { Longhorn } from "./longhorn"; import { Longhorn } from "./longhorn";
import { AuthentikServer } from "./authentik"; import { AuthentikServer } from "./authentik";
import { RedisCluster } from "./redis";
dotenv.config(); dotenv.config();
@@ -57,6 +58,13 @@ class Homelab extends TerraformStack {
initSecretName: "postgres-password", initSecretName: "postgres-password",
}); });
new RedisCluster(this, "redis-cluster", {
provider: helm,
namespace: "redis-system",
name: "redis",
version: "20.2.0",
});
new AuthentikServer(this, "authentik-server", { new AuthentikServer(this, "authentik-server", {
provider: helm, provider: helm,
name: "authentik", name: "authentik",

29
redis/index.ts Normal file
View File

@@ -0,0 +1,29 @@
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 RedisClusterOptions = {
provider: HelmProvider;
version: string;
name: string;
namespace: string;
};
export class RedisCluster extends Construct {
constructor(scope: Construct, id: string, options: RedisClusterOptions) {
super(scope, id);
new Release(this, id, {
...options,
repository: "https://charts.bitnami.com/bitnami",
chart: "redis",
createNamespace: true,
values: [
fs.readFileSync("helm/values/redis.values.yaml", {
encoding: "utf8",
}),
],
});
}
}