feat: CDKTF | migrate memcached to cdktf

This commit is contained in:
2025-07-15 12:12:40 +05:00
parent d8da2c3c05
commit 8b191095b2
4 changed files with 35 additions and 12 deletions

View File

@@ -3,8 +3,6 @@ repositories:
url: https://metallb.github.io/metallb
- name: ingress-nginx
url: https://kubernetes.github.io/ingress-nginx
- name: bitnami
url: https://charts.bitnami.com/bitnami
- name: prometheus-community
url: https://prometheus-community.github.io/helm-charts
---
@@ -23,14 +21,6 @@ releases:
values:
- ./values/nginx-internal.values.yaml
# Memcached
- name: memcached
namespace: memcached-system
chart: bitnami/memcached
version: 7.4.16
values:
- ./values/memcached.values.yaml
# Prometheus Operator
- name: prometheus-operator
namespace: prometheus-system

View File

@@ -14,6 +14,7 @@ import { RedisCluster } from "./redis";
import { CertManager } from "./cert-manager";
import { Manifest } from "@cdktf/provider-kubernetes/lib/manifest";
import { PiHole } from "./pihole";
import { MemcachedCluster } from "./memcached";
dotenv.config();
@@ -104,7 +105,12 @@ class Homelab extends TerraformStack {
provider: helm,
namespace: "redis-system",
name: "redis",
version: "20.2.0",
});
new MemcachedCluster(this, "memcached-cluster", {
provider: helm,
namespace: "memcached-system",
name: "memcached",
});
new AuthentikServer(this, "authentik-server", {

28
memcached/index.ts Normal file
View 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 MemcachedClusterOptions = {
provider: HelmProvider;
name: string;
namespace: string;
};
export class MemcachedCluster extends Construct {
constructor(scope: Construct, id: string, options: MemcachedClusterOptions) {
super(scope, id);
new Release(this, id, {
...options,
repository: "https://charts.bitnami.com/bitnami",
chart: "memcached",
createNamespace: true,
values: [
fs.readFileSync("helm/values/memcached.values.yaml", {
encoding: "utf8",
}),
],
});
}
}

View File

@@ -5,7 +5,6 @@ import { Construct } from "constructs";
type RedisClusterOptions = {
provider: HelmProvider;
version: string;
name: string;
namespace: string;
};