From 5150e1e37fbd7d8fcd80f125a836a91c95ac2886 Mon Sep 17 00:00:00 2001 From: PaoloGallina <43335750+paologallinaharbur@users.noreply.github.com> Date: Tue, 21 Jun 2022 10:48:45 +0200 Subject: [PATCH] fix(chart): mergeOverride changed the user values (#312) --- charts/nri-prometheus/Chart.yaml | 2 +- charts/nri-prometheus/templates/configmap.yaml | 2 +- charts/nri-prometheus/tests/configmap_test.yaml | 4 ++++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/charts/nri-prometheus/Chart.yaml b/charts/nri-prometheus/Chart.yaml index f2db2d40..5eae156f 100644 --- a/charts/nri-prometheus/Chart.yaml +++ b/charts/nri-prometheus/Chart.yaml @@ -7,7 +7,7 @@ sources: - https://github.com/newrelic/nri-prometheus - https://github.com/newrelic/nri-prometheus/tree/master/charts/nri-prometheus -version: 2.1.5 +version: 2.1.6 appVersion: 2.16.1 dependencies: diff --git a/charts/nri-prometheus/templates/configmap.yaml b/charts/nri-prometheus/templates/configmap.yaml index 36cf26a5..5daeed64 100644 --- a/charts/nri-prometheus/templates/configmap.yaml +++ b/charts/nri-prometheus/templates/configmap.yaml @@ -13,7 +13,7 @@ data: {{- include "nri-prometheus.mergeTransformations" . -}} {{- else if (include "newrelic.common.lowDataMode" .) -}} {{ $lowDataDefault := .Files.Get "static/lowdatamodedefaults.yaml" | fromYaml }} - {{- mergeOverwrite .Values.config $lowDataDefault | toYaml | nindent 4 -}} + {{- mergeOverwrite (deepCopy .Values.config) $lowDataDefault | toYaml | nindent 4 -}} {{- else }} {{- .Values.config | toYaml | nindent 4 -}} {{- end -}} diff --git a/charts/nri-prometheus/tests/configmap_test.yaml b/charts/nri-prometheus/tests/configmap_test.yaml index 5498b385..78a12726 100644 --- a/charts/nri-prometheus/tests/configmap_test.yaml +++ b/charts/nri-prometheus/tests/configmap_test.yaml @@ -1,6 +1,7 @@ suite: test nri-prometheus configmap templates: - templates/configmap.yaml + - templates/deployment.yaml tests: - it: creates the config map with default config in values.yaml and cluster_name. set: @@ -18,6 +19,7 @@ tests: scrape_endpoints: false scrape_services: true transformations: [] + template: templates/configmap.yaml - it: creates the config map with lowDataMode. set: @@ -43,6 +45,7 @@ tests: - container_ - machine_ - cadvisor_ + template: templates/configmap.yaml - it: merges existing transformation with lowDataMode. set: @@ -80,3 +83,4 @@ tests: - container_ - machine_ - cadvisor_ + template: templates/configmap.yaml