Skip to content

Commit 7c62688

Browse files
feat: Propagate global tolerations to webhook jobs (#668)
* fix: Propagate global tolerations to webhook jobs * test: Add unit test for global tolerations Signed-off-by: Volodymyr Chernetskyi <19735328+chernetskyi@users.noreply.github.com> * chore: Add changelog entry Signed-off-by: Volodymyr Chernetskyi <19735328+chernetskyi@users.noreply.github.com> * Add additional helm unit test --------- Signed-off-by: Volodymyr Chernetskyi <19735328+chernetskyi@users.noreply.github.com> Co-authored-by: Daniel Budziwojski <dbudziwojski@newrelic.com>
1 parent ec69bfe commit 7c62688

File tree

4 files changed

+41
-4
lines changed

4 files changed

+41
-4
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1010
### security
1111
- Allow pre-upgrade job pods to honor global security context settings @dpacheconr [#670](https://github.com/newrelic/k8s-metadata-injection/pull/670)
1212

13+
### enhancement
14+
- Propagate global tolerations to webhook jobs @chernetskyi [#668](https://github.com/newrelic/k8s-metadata-injection/pull/668)
15+
1316
## v1.38.1 - 2025-10-20
1417

1518
### ⛓️ Dependencies

charts/nri-metadata-injection/templates/admission-webhooks/job-patch/job-createSecret.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ spec:
5858
nodeSelector:
5959
kubernetes.io/os: linux
6060
{{ include "newrelic.common.nodeSelector" . | nindent 8 }}
61-
{{- if .Values.tolerations }}
61+
{{- with include "newrelic.common.tolerations" . }}
6262
tolerations:
63-
{{- toYaml .Values.tolerations | nindent 8 }}
63+
{{- . | nindent 8 -}}
6464
{{- end }}
6565
{{- end }}

charts/nri-metadata-injection/templates/admission-webhooks/job-patch/job-patchWebhook.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ spec:
5858
nodeSelector:
5959
kubernetes.io/os: linux
6060
{{ include "newrelic.common.nodeSelector" . | nindent 8 }}
61-
{{- if .Values.tolerations }}
61+
{{- with include "newrelic.common.tolerations" . }}
6262
tolerations:
63-
{{- toYaml .Values.tolerations | nindent 8 }}
63+
{{- . | nindent 8 -}}
6464
{{- end }}
6565
{{- end }}

charts/nri-metadata-injection/tests/job_serviceaccount_test.yaml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,37 @@ tests:
5757
value:
5858
kubernetes.io/os: linux
5959
aCoolTestLabel: aCoolTestValue
60+
61+
- it: has propagated global tolerations
62+
set:
63+
cluster: my-cluster
64+
global.tolerations:
65+
- key: globalTaintKey
66+
operator: Exists
67+
effect: NoExecute
68+
asserts:
69+
- equal:
70+
path: spec.template.spec.tolerations
71+
value:
72+
- key: globalTaintKey
73+
operator: Exists
74+
effect: NoExecute
75+
76+
- it: has overrides global tolerations with chart specific tolerations
77+
set:
78+
cluster: my-cluster
79+
global.tolerations:
80+
- key: globalTaintKey
81+
operator: Exists
82+
effect: NoExecute
83+
tolerations:
84+
- key: localTaintKey
85+
operator: Exists
86+
effect: NoExecute
87+
asserts:
88+
- equal:
89+
path: spec.template.spec.tolerations
90+
value:
91+
- key: localTaintKey
92+
operator: Exists
93+
effect: NoExecute

0 commit comments

Comments
 (0)