From 756c3917a516ac9da16eaeae3c1e14505b985353 Mon Sep 17 00:00:00 2001 From: Nick Hoffmann <59148770+NickJHoffmann@users.noreply.github.com> Date: Tue, 12 Mar 2024 13:49:12 -0400 Subject: [PATCH] Add Namespace to Prometheus-Prefect-Exporter Chart (#310) * Add namespace option to prometheus metrics exporter * Add chart repo to prometheus exporter linter --- .github/linters/prometheus-prefect-exporter-ct.yaml | 2 ++ charts/prometheus-prefect-exporter/Chart.yaml | 6 ++++++ charts/prometheus-prefect-exporter/README.md | 6 ++++++ .../prometheus-prefect-exporter/templates/deployment.yaml | 1 + charts/prometheus-prefect-exporter/templates/hpa.yaml | 1 + charts/prometheus-prefect-exporter/templates/pdb.yaml | 1 + .../templates/prometheusrule.yaml | 1 + charts/prometheus-prefect-exporter/templates/service.yaml | 1 + .../templates/serviceaccount.yaml | 1 + .../templates/servicemonitor.yaml | 1 + charts/prometheus-prefect-exporter/values.schema.json | 6 ++++++ 11 files changed, 27 insertions(+) diff --git a/.github/linters/prometheus-prefect-exporter-ct.yaml b/.github/linters/prometheus-prefect-exporter-ct.yaml index bed704db..c54368e1 100644 --- a/.github/linters/prometheus-prefect-exporter-ct.yaml +++ b/.github/linters/prometheus-prefect-exporter-ct.yaml @@ -1,6 +1,8 @@ # See https://github.com/helm/chart-testing#configuration charts: - charts/prometheus-prefect-exporter +chart-repos: + - bitnami=https://charts.bitnami.com/bitnami helm-extra-args: --timeout 600s namespace: default release-label: prefect diff --git a/charts/prometheus-prefect-exporter/Chart.yaml b/charts/prometheus-prefect-exporter/Chart.yaml index ff0b1962..8221f003 100644 --- a/charts/prometheus-prefect-exporter/Chart.yaml +++ b/charts/prometheus-prefect-exporter/Chart.yaml @@ -2,6 +2,12 @@ apiVersion: v2 appVersion: "latest" description: A Helm chart to deploy Prometheus Prefect Exporter home: https://github.com/PrefectHQ +dependencies: + - name: common + repository: https://charts.bitnami.com/bitnami + tags: + - bitnami-common + version: 2.16.1 keywords: - prometheus-prefect-exporter maintainers: diff --git a/charts/prometheus-prefect-exporter/README.md b/charts/prometheus-prefect-exporter/README.md index ed7fab4c..424c009c 100644 --- a/charts/prometheus-prefect-exporter/README.md +++ b/charts/prometheus-prefect-exporter/README.md @@ -49,6 +49,12 @@ Shoutout to @ialejandro for the original work on this chart! | jimid27 | | | | parkedwards | | | +## Requirements + +| Repository | Name | Version | +|------------|------|---------| +| https://charts.bitnami.com/bitnami | common | 2.16.1 | + ## Values | Key | Type | Default | Description | diff --git a/charts/prometheus-prefect-exporter/templates/deployment.yaml b/charts/prometheus-prefect-exporter/templates/deployment.yaml index 66cd7564..cd38a4f5 100644 --- a/charts/prometheus-prefect-exporter/templates/deployment.yaml +++ b/charts/prometheus-prefect-exporter/templates/deployment.yaml @@ -2,6 +2,7 @@ apiVersion: apps/v1 kind: Deployment metadata: name: {{ include "prometheus-prefect-exporter.fullname" . }} + namespace: {{ include "common.names.namespace" . | quote }} labels: {{- include "prometheus-prefect-exporter.labels" . | nindent 4 }} spec: diff --git a/charts/prometheus-prefect-exporter/templates/hpa.yaml b/charts/prometheus-prefect-exporter/templates/hpa.yaml index 5b1f48da..bb581a8e 100644 --- a/charts/prometheus-prefect-exporter/templates/hpa.yaml +++ b/charts/prometheus-prefect-exporter/templates/hpa.yaml @@ -3,6 +3,7 @@ apiVersion: autoscaling/v2 kind: HorizontalPodAutoscaler metadata: name: {{ include "prometheus-prefect-exporter.fullname" . }} + namespace: {{ include "common.names.namespace" . | quote }} labels: {{- include "prometheus-prefect-exporter.labels" . | nindent 4 }} spec: diff --git a/charts/prometheus-prefect-exporter/templates/pdb.yaml b/charts/prometheus-prefect-exporter/templates/pdb.yaml index 63fbf058..75a90c0e 100644 --- a/charts/prometheus-prefect-exporter/templates/pdb.yaml +++ b/charts/prometheus-prefect-exporter/templates/pdb.yaml @@ -3,6 +3,7 @@ apiVersion: policy/v1 kind: PodDisruptionBudget metadata: name: {{ template "prometheus-prefect-exporter.fullname" . }} + namespace: {{ include "common.names.namespace" . | quote }} labels: {{- include "prometheus-prefect-exporter.labels" . | nindent 4 }} spec: diff --git a/charts/prometheus-prefect-exporter/templates/prometheusrule.yaml b/charts/prometheus-prefect-exporter/templates/prometheusrule.yaml index f31d3eb2..b391c54f 100644 --- a/charts/prometheus-prefect-exporter/templates/prometheusrule.yaml +++ b/charts/prometheus-prefect-exporter/templates/prometheusrule.yaml @@ -3,6 +3,7 @@ apiVersion: monitoring.coreos.com/v1 kind: PrometheusRule metadata: name: {{ template "prometheus-prefect-exporter.fullname" . }} + namespace: {{ include "common.names.namespace" . | quote }} labels: {{- include "prometheus-prefect-exporter.labels" . | nindent 4 }} {{- with .Values.prometheusRule.additionalLabels -}} diff --git a/charts/prometheus-prefect-exporter/templates/service.yaml b/charts/prometheus-prefect-exporter/templates/service.yaml index 49f110ac..f7e77c67 100644 --- a/charts/prometheus-prefect-exporter/templates/service.yaml +++ b/charts/prometheus-prefect-exporter/templates/service.yaml @@ -2,6 +2,7 @@ apiVersion: v1 kind: Service metadata: name: {{ include "prometheus-prefect-exporter.fullname" . }} + namespace: {{ include "common.names.namespace" . | quote }} labels: {{- include "prometheus-prefect-exporter.labels" . | nindent 4 }} spec: diff --git a/charts/prometheus-prefect-exporter/templates/serviceaccount.yaml b/charts/prometheus-prefect-exporter/templates/serviceaccount.yaml index 24287b2f..09780488 100644 --- a/charts/prometheus-prefect-exporter/templates/serviceaccount.yaml +++ b/charts/prometheus-prefect-exporter/templates/serviceaccount.yaml @@ -3,6 +3,7 @@ apiVersion: v1 kind: ServiceAccount metadata: name: {{ include "prometheus-prefect-exporter.serviceAccountName" . }} + namespace: {{ include "common.names.namespace" . | quote }} labels: {{- include "prometheus-prefect-exporter.labels" . | nindent 4 }} {{- with .Values.serviceAccount.annotations }} diff --git a/charts/prometheus-prefect-exporter/templates/servicemonitor.yaml b/charts/prometheus-prefect-exporter/templates/servicemonitor.yaml index e8c8543d..a521edad 100644 --- a/charts/prometheus-prefect-exporter/templates/servicemonitor.yaml +++ b/charts/prometheus-prefect-exporter/templates/servicemonitor.yaml @@ -3,6 +3,7 @@ apiVersion: monitoring.coreos.com/v1 kind: ServiceMonitor metadata: name: {{ include "prometheus-prefect-exporter.fullname" . }} + namespace: {{ include "common.names.namespace" . | quote }} labels: {{- include "prometheus-prefect-exporter.labels" . | nindent 4 }} spec: diff --git a/charts/prometheus-prefect-exporter/values.schema.json b/charts/prometheus-prefect-exporter/values.schema.json index 475cf6bd..40e14513 100644 --- a/charts/prometheus-prefect-exporter/values.schema.json +++ b/charts/prometheus-prefect-exporter/values.schema.json @@ -311,6 +311,12 @@ "title": "Affinity", "description": "Affinity", "form": true + }, + "common": { + "type": "object", + "title": "Common", + "description": "common configuration. Not set by user but required as common vars are passed to all manifests.", + "form": true } } }