From 6327ea163aea226729d0b9635d471b0374c1bd42 Mon Sep 17 00:00:00 2001
From: Vincent Mercier <vmercier@gmail.com>
Date: Tue, 7 Nov 2023 12:55:22 +0100
Subject: [PATCH] chore(helm): Use chart name as part-of label

---
 configs/helm/templates/_helpers.tpl     | 2 +-
 configs/helm/tests/deployment_test.yaml | 3 +++
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/configs/helm/templates/_helpers.tpl b/configs/helm/templates/_helpers.tpl
index 77a7a7b..3381ac9 100644
--- a/configs/helm/templates/_helpers.tpl
+++ b/configs/helm/templates/_helpers.tpl
@@ -40,7 +40,7 @@ helm.sh/chart: {{ include "prometheus-rds-exporter.chart" . }}
 app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
 {{- end }}
 app.kubernetes.io/component: exporter
-app.kubernetes.io/part-of: database-monitoring-framework
+app.kubernetes.io/part-of: {{ template "prometheus-rds-exporter.name" . }}
 app.kubernetes.io/managed-by: {{ .Release.Service }}
 {{- range $key, $value := .Values.additionalLabels }}
 {{ $key }}: {{ $value | quote }}
diff --git a/configs/helm/tests/deployment_test.yaml b/configs/helm/tests/deployment_test.yaml
index b2d3c30..df0e728 100644
--- a/configs/helm/tests/deployment_test.yaml
+++ b/configs/helm/tests/deployment_test.yaml
@@ -11,6 +11,9 @@ tests:
       - equal:
           path: metadata.name
           value: RELEASE-NAME-prometheus-rds-exporter-chart
+      - equal:
+          path: spec.template.metadata.labels["app.kubernetes.io/part-of"]
+          value: prometheus-rds-exporter-chart
       - equal:
           path: spec.template.spec.containers[0].image
           value: public.ecr.aws/qonto/prometheus-rds-exporter:0.0.0