feat: CDKTF | migrate prometheus into cdktf
This commit is contained in:
@@ -1,8 +1,6 @@
|
|||||||
repositories:
|
repositories:
|
||||||
- name: metallb
|
- name: metallb
|
||||||
url: https://metallb.github.io/metallb
|
url: https://metallb.github.io/metallb
|
||||||
- name: prometheus-community
|
|
||||||
url: https://prometheus-community.github.io/helm-charts
|
|
||||||
---
|
---
|
||||||
releases:
|
releases:
|
||||||
# Load Balancer
|
# Load Balancer
|
||||||
@@ -10,11 +8,3 @@ releases:
|
|||||||
namespace: metallb-system
|
namespace: metallb-system
|
||||||
chart: metallb/metallb
|
chart: metallb/metallb
|
||||||
version: 0.14.8
|
version: 0.14.8
|
||||||
|
|
||||||
# Prometheus Operator
|
|
||||||
- name: prometheus-operator
|
|
||||||
namespace: prometheus-system
|
|
||||||
chart: prometheus-community/kube-prometheus-stack
|
|
||||||
version: 62.3.0
|
|
||||||
values:
|
|
||||||
- ./values/prometheus.values.yaml
|
|
||||||
|
|||||||
7
main.ts
7
main.ts
@@ -16,6 +16,7 @@ import { Manifest } from "@cdktf/provider-kubernetes/lib/manifest";
|
|||||||
import { PiHole } from "./pihole";
|
import { PiHole } from "./pihole";
|
||||||
import { MemcachedCluster } from "./memcached";
|
import { MemcachedCluster } from "./memcached";
|
||||||
import { Nginx } from "./nginx";
|
import { Nginx } from "./nginx";
|
||||||
|
import { Prometheus } from "./prometheus";
|
||||||
|
|
||||||
dotenv.config();
|
dotenv.config();
|
||||||
|
|
||||||
@@ -81,6 +82,12 @@ class Homelab extends TerraformStack {
|
|||||||
name: "ingress-nginx-internal",
|
name: "ingress-nginx-internal",
|
||||||
});
|
});
|
||||||
|
|
||||||
|
new Prometheus(this, "prometheus", {
|
||||||
|
provider: helm,
|
||||||
|
namespace: "prometheus-system",
|
||||||
|
name: "prometheus-operator",
|
||||||
|
});
|
||||||
|
|
||||||
const certManagerApiVersion = "cert-manager.io/v1";
|
const certManagerApiVersion = "cert-manager.io/v1";
|
||||||
|
|
||||||
new CertManager(this, "cert-manager", {
|
new CertManager(this, "cert-manager", {
|
||||||
|
|||||||
28
prometheus/index.ts
Normal file
28
prometheus/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 PrometheusOptions = {
|
||||||
|
provider: HelmProvider;
|
||||||
|
name: string;
|
||||||
|
namespace: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export class Prometheus extends Construct {
|
||||||
|
constructor(scope: Construct, id: string, options: PrometheusOptions) {
|
||||||
|
super(scope, id);
|
||||||
|
|
||||||
|
new Release(this, id, {
|
||||||
|
...options,
|
||||||
|
repository: "https://prometheus-community.github.io/helm-charts",
|
||||||
|
chart: "kube-prometheus-stack",
|
||||||
|
createNamespace: true,
|
||||||
|
values: [
|
||||||
|
fs.readFileSync("helm/values/prometheus.values.yaml", {
|
||||||
|
encoding: "utf8",
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user