File tree Expand file tree Collapse file tree 5 files changed +58
-1
lines changed
charts/nri-metadata-injection
templates/admission-webhooks Expand file tree Collapse file tree 5 files changed +58
-1
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77
88## Unreleased
99
10+ ### enhancement
11+ - Add default ignoredNamespace and make configurable @dpacheconr [ #600 ] ( https://github.com/newrelic/k8s-metadata-injection/pull/600/ )
12+
1013## v1.36.0 - 2025-08-25
1114
1215### 🚀 Enhancements
Original file line number Diff line number Diff line change 1010service :
1111 port : 443
1212 targetPort : " "
13+
14+ ignoreNamespaces : ['kube-public', 'kube-node-lease', 'kube-system']
Original file line number Diff line number Diff line change @@ -24,11 +24,19 @@ webhooks:
2424 apiGroups : [""]
2525 apiVersions : ["v1"]
2626 resources : ["pods"]
27- {{- if .Values.injectOnlyLabeledNamespaces }}
27+ {{- if or .Values.ignoreNamespaces .Values.injectOnlyLabeledNamespaces }}
2828 scope : Namespaced
2929 namespaceSelector :
30+ {{- if .Values.ignoreNamespaces }}
31+ matchExpressions :
32+ - key : kubernetes.io/metadata.name
33+ operator : NotIn
34+ values : {{ .Values.ignoreNamespaces | toJson }}
35+ {{- end }}
36+ {{- if .Values.injectOnlyLabeledNamespaces }}
3037 matchLabels :
3138 newrelic-metadata-injection : enabled
39+ {{- end }}
3240{{- end }}
3341 failurePolicy : Ignore
3442 timeoutSeconds : {{ .Values.timeoutSeconds }}
Original file line number Diff line number Diff line change 1+ suite : test mutatingwebhookconfiguraton values
2+ templates :
3+ - templates/admission-webhooks/mutatingWebhookConfiguration.yaml
4+ release :
5+ name : release
6+ namespace : ns
7+ tests :
8+ - it : default ignored namespaces are set
9+ set :
10+ cluster : my-cluster
11+ asserts :
12+ - equal :
13+ path : webhooks[0].namespaceSelector.matchExpressions[0].values
14+ value : ['kube-public', 'kube-node-lease', 'kube-system']
15+ - it : custom ignored namespaces are set
16+ set :
17+ cluster : my-cluster
18+ ignoreNamespaces : ['custom-namespace1', 'custom-namespace2']
19+ asserts :
20+ - equal :
21+ path : webhooks[0].namespaceSelector.matchExpressions[0].values
22+ value : [ 'custom-namespace1', 'custom-namespace2' ]
23+ - it : empty ignoreNamespaces results in no namespaceSelector
24+ set :
25+ cluster : my-cluster
26+ ignoreNamespaces : []
27+ asserts :
28+ - notExists :
29+ path : webhooks[0].namespaceSelector
30+ - it : injectOnlyLabeledNamespaces=true results in namespaceSelector with matchLabels
31+ set :
32+ cluster : my-cluster
33+ injectOnlyLabeledNamespaces : true
34+ asserts :
35+ - equal :
36+ path : webhooks[0].namespaceSelector.matchLabels
37+ value :
38+ newrelic-metadata-injection : enabled
39+ - equal :
40+ path : webhooks[0].namespaceSelector.matchExpressions[0].values
41+ value : [ 'kube-public', 'kube-node-lease', 'kube-system' ]
Original file line number Diff line number Diff line change @@ -92,6 +92,9 @@ tolerations: []
9292# with 'newrelic-metadata-injection=enabled'.
9393injectOnlyLabeledNamespaces : false
9494
95+ # -- This is a list of namespaces that will be ignored by the webhook.
96+ ignoreNamespaces : ['kube-public', 'kube-node-lease', 'kube-system']
97+
9598# -- Use custom tls certificates for the webhook, or let the chart handle it
9699# automatically.
97100# Ref: https://docs.newrelic.com/docs/integrations/kubernetes-integration/link-your-applications/link-your-applications-kubernetes#configure-injection
You can’t perform that action at this time.
0 commit comments