From 18e2d2ee9b67401b085b6552120bd97c79343453 Mon Sep 17 00:00:00 2001 From: Volodymyr Chernetskyi <19735328+chernetskyi@users.noreply.github.com> Date: Thu, 13 Nov 2025 11:33:46 +0100 Subject: [PATCH 1/4] fix: Propagate global tolerations to webhook jobs --- .../admission-webhooks/job-patch/job-createSecret.yaml | 4 ++-- .../admission-webhooks/job-patch/job-patchWebhook.yaml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/charts/nri-metadata-injection/templates/admission-webhooks/job-patch/job-createSecret.yaml b/charts/nri-metadata-injection/templates/admission-webhooks/job-patch/job-createSecret.yaml index fb6db371..019f875f 100644 --- a/charts/nri-metadata-injection/templates/admission-webhooks/job-patch/job-createSecret.yaml +++ b/charts/nri-metadata-injection/templates/admission-webhooks/job-patch/job-createSecret.yaml @@ -58,8 +58,8 @@ spec: nodeSelector: kubernetes.io/os: linux {{ include "newrelic.common.nodeSelector" . | nindent 8 }} - {{- if .Values.tolerations }} + {{- with include "newrelic.common.tolerations" . }} tolerations: - {{- toYaml .Values.tolerations | nindent 8 }} + {{- . | nindent 8 -}} {{- end }} {{- end }} diff --git a/charts/nri-metadata-injection/templates/admission-webhooks/job-patch/job-patchWebhook.yaml b/charts/nri-metadata-injection/templates/admission-webhooks/job-patch/job-patchWebhook.yaml index ef7fd5a0..521b56c7 100644 --- a/charts/nri-metadata-injection/templates/admission-webhooks/job-patch/job-patchWebhook.yaml +++ b/charts/nri-metadata-injection/templates/admission-webhooks/job-patch/job-patchWebhook.yaml @@ -58,8 +58,8 @@ spec: nodeSelector: kubernetes.io/os: linux {{ include "newrelic.common.nodeSelector" . | nindent 8 }} - {{- if .Values.tolerations }} + {{- with include "newrelic.common.tolerations" . }} tolerations: - {{- toYaml .Values.tolerations | nindent 8 }} + {{- . | nindent 8 -}} {{- end }} {{- end }} From 1701b323ddf9bee8c16cce0d0ccc34f54fab487f Mon Sep 17 00:00:00 2001 From: Volodymyr Chernetskyi <19735328+chernetskyi@users.noreply.github.com> Date: Mon, 17 Nov 2025 20:33:06 +0100 Subject: [PATCH 2/4] test: Add unit test for global tolerations Signed-off-by: Volodymyr Chernetskyi <19735328+chernetskyi@users.noreply.github.com> --- .../tests/job_serviceaccount_test.yaml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/charts/nri-metadata-injection/tests/job_serviceaccount_test.yaml b/charts/nri-metadata-injection/tests/job_serviceaccount_test.yaml index 63b6f053..310d98ac 100644 --- a/charts/nri-metadata-injection/tests/job_serviceaccount_test.yaml +++ b/charts/nri-metadata-injection/tests/job_serviceaccount_test.yaml @@ -57,3 +57,18 @@ tests: value: kubernetes.io/os: linux aCoolTestLabel: aCoolTestValue + + - it: has propagated global tolerations + set: + cluster: my-cluster + global.tolerations: + - key: taintKey + operator: Exists + effect: NoExecute + asserts: + - equal: + path: spec.template.spec.tolerations + value: + - key: taintKey + operator: Exists + effect: NoExecute From 65a67aa1255e88c7cd498d05190671890261cc5d Mon Sep 17 00:00:00 2001 From: Volodymyr Chernetskyi <19735328+chernetskyi@users.noreply.github.com> Date: Mon, 17 Nov 2025 20:43:28 +0100 Subject: [PATCH 3/4] chore: Add changelog entry Signed-off-by: Volodymyr Chernetskyi <19735328+chernetskyi@users.noreply.github.com> --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4edcdd0e..472b1fc2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## Unreleased +### enhancement +- Propagate global tolerations to webhook jobs @chernetskyi [#668](https://github.com/newrelic/k8s-metadata-injection/pull/668) + ## v1.38.1 - 2025-10-20 ### ⛓️ Dependencies From 8162ce1b3a1b59bfbc5a36a099ef177b4ca2984f Mon Sep 17 00:00:00 2001 From: Daniel Budziwojski Date: Thu, 20 Nov 2025 18:31:18 -0800 Subject: [PATCH 4/4] Add additional helm unit test --- .../tests/job_serviceaccount_test.yaml | 23 +++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/charts/nri-metadata-injection/tests/job_serviceaccount_test.yaml b/charts/nri-metadata-injection/tests/job_serviceaccount_test.yaml index 310d98ac..d6a73950 100644 --- a/charts/nri-metadata-injection/tests/job_serviceaccount_test.yaml +++ b/charts/nri-metadata-injection/tests/job_serviceaccount_test.yaml @@ -62,13 +62,32 @@ tests: set: cluster: my-cluster global.tolerations: - - key: taintKey + - key: globalTaintKey operator: Exists effect: NoExecute asserts: - equal: path: spec.template.spec.tolerations value: - - key: taintKey + - key: globalTaintKey + operator: Exists + effect: NoExecute + + - it: has overrides global tolerations with chart specific tolerations + set: + cluster: my-cluster + global.tolerations: + - key: globalTaintKey + operator: Exists + effect: NoExecute + tolerations: + - key: localTaintKey + operator: Exists + effect: NoExecute + asserts: + - equal: + path: spec.template.spec.tolerations + value: + - key: localTaintKey operator: Exists effect: NoExecute