newrelic-logging: Add Comprehensive Global Value Inheritance Test Coverage and Fix Critical Bugs #2023
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
This PR adds comprehensive test coverage validating global value inheritance for the newrelic-logging chart, implements 6 missing global values (proxy, priorityClassName, nodeSelector, tolerations, affinity, hostNetwork), and fixes 2 bugs discovered during testing. The chart uses common-library version 1.3.3 for most global value implementations. This work addresses critical gaps identified in the nri-bundle refactor project: proxy support for corporate environments, scheduling constraints, and verbose logging.
Changes
Fixed Pre-Existing Bugs
Bug #1: DaemonSet Selector Label Mismatch
app: newrelic-logging,release: {{.Release.Name}}) while pod template used common-library labels (app.kubernetes.io/name,app.kubernetes.io/instance)selector does not match template labelsdaemonset.yamlanddaemonset-windows.yamlto usenewrelic.common.labels.selectorLabelshelper for selector labelsBug #2: VerboseLog Boolean Evaluation
$verboseLogvariable as string (eq $verboseLog "true") instead of as boolean conditionglobal.verboseLog=truesilently failed—noLOG_LEVEL=debugenv var was setverboseLoghelper returns boolean value, but template used string comparisoneq $verboseLog "true"toif $verboseLogin both Linux and Windows DaemonSetsAdded Comprehensive Global Value Inheritance Tests
Created 47 new test cases in
tests/global-inheritance_test.yamlvalidating all 20 applicable global values:global.verboseLog: truetoLOG_LEVEL=debugenv varAll tests validate BOTH global inheritance and override precedence scenarios.
Implemented Missing Global Values
templates/daemonset.yaml & templates/daemonset-windows.yaml:
proxyenvironment variables (HTTP_PROXY/HTTPS_PROXY) with global/local precedence using nil-safe template logicpriorityClassNamewithnewrelic.common.priorityClassNamehelper (common-library 1.3.3+)nodeSelectorwithnewrelic.common.nodeSelectorhelper while preserving Windows OS labelstolerationswithnewrelic.common.tolerationshelperaffinitylogic withnewrelic.common.affinityhelper while preserving Fargate exclusionhostNetworkwith proper nil-safe global inheritance logic (avoids implicitfalsedefault)verboseLog→ LOG_LEVEL mapping (verboseLog=true sets LOG_LEVEL=debug, overrides local logLevel)newrelic.common.labelsfor resource labels andnewrelic.common.labels.podLabelsfor pod labelsnewrelic.common.labels.selectorLabelshelper (fixes selector mismatch)templates/_helpers.tpl:
newrelic-logging.clusterhelper precedence: now implementslocal > global > default(wasglobal > local)values.yaml:
proxy: ""field with documentation for HTTP/HTTPS proxy configurationfluentBit.logLeveldefault from"info"to""(empty string), enablingglobal.verboseLoginheritanceTest Results
Coverage:
Global Values Coverage
All 27 global values from the nri-bundle global contract assessed:
Legend:
Yes- Chart includes explicit helm-unittest test coverage with dedicated test cases and assertionsNo- Value not applicable to this chart typeTesting Approach: This chart validates ALL applicable global values through comprehensive helm-unittest tests, ensuring each value propagates correctly and respects override precedence. While common-library helpers handle the implementation, independent validation is industry-standard for infrastructure-as-code: it provides confidence that configuration changes work as expected.
global-inheritance_test.yaml(2 tests) - Fixed precedence helper (local > global)global-inheritance_test.yaml(2 tests)global-inheritance_test.yaml(2 tests) - NEWLY ADDED via common-libraryglobal-inheritance_test.yaml(2 tests) - NEWLY ADDED via common-libraryimages_test.yaml(3 tests) - Existing coverage maintainedimages_test.yaml(2 tests) - Existing coverage maintainedimages_test.yaml- Existing coverage maintainedglobal-inheritance_test.yaml(3 tests) - NEWLY ADDEDglobal-inheritance_test.yaml(3 tests) - NEWLY ADDEDserviceAccount_test.yaml- Existing coverage maintainedglobal-inheritance_test.yaml(4 tests) - NEWLY FIXED (now nil-safe)global-inheritance_test.yaml(2 tests) +dns_config_test.yamlglobal-inheritance_test.yaml(3 tests) - NEWLY ADDEDglobal-inheritance_test.yaml(3 tests) - NEWLY FIXED (now uses common-library)global-inheritance_test.yaml(3 tests) - NEWLY FIXED (now uses common-library)global-inheritance_test.yaml(3 tests) - NEWLY FIXED (now uses common-library)global-inheritance_test.yaml(4 tests) - NEWLY FIXED (preserves Fargate exclusion)global-inheritance_test.yaml(2 tests)global-inheritance_test.yaml(2 tests)global-inheritance_test.yaml(3 tests) - Reduces log attributesglobal-inheritance_test.yaml(2 tests) - Endpoint selectionglobal-inheritance_test.yaml(4 tests) - Global inheritance and local precedenceglobal-inheritance_test.yaml(4 tests) - NEWLY FIXED (boolean evaluation)Files Modified
Templates (3 files)
templates/daemonset.yaml- Fixed selector labels, verboseLog boolean evaluation, added proxy env vars, scheduling helpers, hostNetwork, labelstemplates/daemonset-windows.yaml- Identical changes to Linux DaemonSet for Windows node compatibilitytemplates/_helpers.tpl- Fixed cluster helper precedence (local > global)Values (1 file)
values.yaml- Added proxy field with documentation, fixed logLevel default (empty string enables global.verboseLog inheritance)Tests (1 file)
tests/global-inheritance_test.yaml- Added 47 comprehensive helm-unittest test cases validating all applicable global values (new file)No Breaking Changes
All changes maintain backward compatibility:
"info"to""- functionally identical (logLevel honored when explicitly set, global.verboseLog honored when not)Migration Path: Existing deployments continue to work without modification. Users can optionally set global values for cleaner configuration.
Build Status
Changelog Entry