From cdc4b778318befbf7d3ecfeae198a3d7d352f2e1 Mon Sep 17 00:00:00 2001 From: Garry O'Donnell Date: Thu, 14 Mar 2024 09:49:58 +0000 Subject: [PATCH] Setup prometheus for monitoring --- .github/workflows/charts.yml | 4 + charts/data-gateway/Chart.lock | 6 ++ charts/data-gateway/Chart.yaml | 7 +- charts/data-gateway/values.yaml | 129 ++++++++++++++++++++++++++++++++ 4 files changed, 145 insertions(+), 1 deletion(-) create mode 100644 charts/data-gateway/Chart.lock diff --git a/.github/workflows/charts.yml b/.github/workflows/charts.yml index 134d02a..c7c0ee2 100644 --- a/.github/workflows/charts.yml +++ b/.github/workflows/charts.yml @@ -21,6 +21,10 @@ jobs: - name: Setup chart-testing uses: helm/chart-testing-action@v2.6.1 + - name: Install chart dependencies + run: | + helm repo add prometheus https://prometheus-community.github.io/helm-charts + - name: Lint run: > ct diff --git a/charts/data-gateway/Chart.lock b/charts/data-gateway/Chart.lock new file mode 100644 index 0000000..f64e164 --- /dev/null +++ b/charts/data-gateway/Chart.lock @@ -0,0 +1,6 @@ +dependencies: +- name: prometheus + repository: https://prometheus-community.github.io/helm-charts + version: 25.17.0 +digest: sha256:1567645f0c8c096eb44cd7eadb5e6a694dc19a01911ae41b75dec83ab0e96d4c +generated: "2024-03-14T09:36:26.799022195Z" diff --git a/charts/data-gateway/Chart.yaml b/charts/data-gateway/Chart.yaml index 9ca9139..9824e64 100644 --- a/charts/data-gateway/Chart.yaml +++ b/charts/data-gateway/Chart.yaml @@ -3,5 +3,10 @@ name: data-gateway description: A GraphQL router deployment forming the Diamond Data Gateway type: application -version: 0.1.0 +version: 0.2.0 +dependencies: + - name: prometheus + repository: https://prometheus-community.github.io/helm-charts + version: 25.17.0 + condition: prometheus.enabled diff --git a/charts/data-gateway/values.yaml b/charts/data-gateway/values.yaml index e69de29..4bd926b 100644 --- a/charts/data-gateway/values.yaml +++ b/charts/data-gateway/values.yaml @@ -0,0 +1,129 @@ +prometheus: + enabled: true + kube-state-metrics: + enabled: false + prometheus-node-exporter: + enabled: false + prometheus-pushgateway: + enabled: false + rbac: + create: false + configmapReload: + prometheus: + resources: + limits: + cpu: 50m + memory: 400Mi + serviceAccounts: + prometheus-node-exporter: + create: false + name: default-full-access-mounted + pushgateway: + create: false + name: default-full-access-mounted + server: + create: false + name: default-full-access-mounted + alertmanager: + persistence: + enabled: false + server: + persistentVolume: + enabled: false + serverFiles: + prometheus.yml: + scrape_configs: + - job_name: prometheus + static_configs: + - targets: + - localhost:9090 + - job_name: "kubernetes-service-endpoints" + kubernetes_sd_configs: + - role: endpoints + namespaces: + own_namespace: true + relabel_configs: + - source_labels: + [__meta_kubernetes_service_annotation_prometheus_io_scrape] + action: keep + regex: true + - source_labels: + [__meta_kubernetes_service_annotation_prometheus_io_scheme] + action: replace + target_label: __scheme__ + regex: (https?) + - source_labels: + [__meta_kubernetes_service_annotation_prometheus_io_path] + action: replace + target_label: __metrics_path__ + regex: (.+) + - source_labels: + [ + __address__, + __meta_kubernetes_service_annotation_prometheus_io_port, + ] + action: replace + target_label: __address__ + regex: (.+?)(?::\d+)?;(\d+) + replacement: $1:$2 + - action: labelmap + regex: __meta_kubernetes_service_annotation_prometheus_io_param_(.+) + replacement: __param_$1 + - action: labelmap + regex: __meta_kubernetes_service_label_(.+) + - source_labels: [__meta_kubernetes_namespace] + action: replace + target_label: namespace + - source_labels: [__meta_kubernetes_service_name] + action: replace + target_label: service + - source_labels: [__meta_kubernetes_pod_node_name] + action: replace + target_label: node + - job_name: "kubernetes-pods" + kubernetes_sd_configs: + - role: pod + namespaces: + own_namespace: true + relabel_configs: + - source_labels: + [__meta_kubernetes_pod_annotation_prometheus_io_scrape] + action: keep + regex: true + - source_labels: + [__meta_kubernetes_pod_annotation_prometheus_io_scrape] + action: keep + regex: true + - source_labels: + [__meta_kubernetes_pod_annotation_prometheus_io_scheme] + action: replace + regex: (https?) + target_label: __scheme__ + - source_labels: + [__meta_kubernetes_pod_annotation_prometheus_io_path] + action: replace + target_label: __metrics_path__ + regex: (.+) + - source_labels: + [ + __address__, + __meta_kubernetes_pod_annotation_prometheus_io_port, + ] + action: replace + regex: ([^:]+)(?::\d+)?;(\d+) + replacement: $1:$2 + target_label: __address__ + - action: labelmap + regex: __meta_kubernetes_pod_annotation_prometheus_io_param_(.+) + replacement: __param_$1 + - action: labelmap + regex: __meta_kubernetes_pod_label_(.+) + - source_labels: [__meta_kubernetes_namespace] + action: replace + target_label: namespace + - source_labels: [__meta_kubernetes_pod_name] + action: replace + target_label: pod + - source_labels: [__meta_kubernetes_pod_phase] + regex: Pending|Succeeded|Failed|Completed + action: drop