Skip to content

feat: add global.images registry, pullSecrets, and pullPolicy support to nri-bundle charts#2005

Closed
dpacheconr wants to merge 3 commits into
newrelic:masterfrom
dpacheconr:support/newrelic-logging-final
Closed

feat: add global.images registry, pullSecrets, and pullPolicy support to nri-bundle charts#2005
dpacheconr wants to merge 3 commits into
newrelic:masterfrom
dpacheconr:support/newrelic-logging-final

Conversation

@dpacheconr
Copy link
Copy Markdown
Contributor

@dpacheconr dpacheconr commented Nov 14, 2025

Summary

Add support for cascading global.images.registry, pullSecrets, and pullPolicy from global settings to newrelic-logging.

Phase 1: Global.Images.Registry Support ✅

  • Added newrelic-logging.persistenceInitContainerImage helper in _helpers.tpl
  • Updated daemonset.yaml init container to use the helper instead of hardcoded busybox:1.36
  • Added fluentBit.persistenceInitContainerImage configuration to values.yaml

Phase 2: Global.Images.PullSecrets Support ✅

  • Updated daemonset.yaml to include global.images.pullSecrets alongside chart-level image.pullSecrets
  • Both sources are concatenated (global first) and passed to the existing newrelic.common.images.renderPullSecrets helper

Phase 3: Global.Images.PullPolicy Support ✅

  • Added newrelic-logging.imagePullPolicy helper in _helpers.tpl
  • Added newrelic-logging.persistenceInitContainerImagePullPolicy helper in _helpers.tpl
  • Updated daemonset.yaml to use pullPolicy helpers for both main container and init container
  • Configuration respects hierarchy: chart-level setting → global setting → default (IfNotPresent)

Configuration Hierarchy

For Image Registry:

  1. Explicit fluentBit.persistenceInitContainerImage.repository at chart level (takes precedence)
  2. global.images.registry (used when repository matches default)
  3. Default: busybox

For ImagePullSecrets:

  1. image.pullSecrets (chart level, highest priority)
  2. global.images.pullSecrets

Both sources are concatenated to support flexible secret management.

For ImagePullPolicy:

  1. Chart-level image.pullPolicy / fluentBit.persistenceInitContainerImage.pullPolicy (highest priority)
  2. global.images.pullPolicy
  3. Default: IfNotPresent

Implementation Details

  • If fluentBit.persistenceInitContainerImage.repository is explicitly set to a custom value, it takes precedence over global registry
  • If global.images.registry is set and repository matches the default (busybox), the global registry is prepended
  • If global registry is not set, the chart default (busybox:1.36) is used unchanged
  • PullPolicy helpers ensure chart-level settings always win; global cascades when no explicit chart configuration is provided

Test Plan

Phase 1 (Registry):

  • ✓ Default busybox:1.36 image used when no global registry set
  • ✓ Global registry is prepended when set and repository is default (my-registry.com/busybox:1.36)
  • ✓ Chart-level repository overrides global registry

Phase 2 (PullSecrets):

  • ✓ No pullSecrets set → No imagePullSecrets section rendered
  • ✓ Global pullSecrets only → Used
  • ✓ Both global + chart pullSecrets → Concatenated (global first)

Phase 3 (PullPolicy):

  • ✓ Defaults to IfNotPresent when neither chart nor global value is set (main and init container)
  • ✓ Global pullPolicy is used when no chart-specific value is set
  • ✓ Chart-level pullPolicy overrides global (main and init container)

License Key:

  • LICENSE_KEY env references correct secret name (<release>-newrelic-logging-config) and key (license)
  • customSecretName + customSecretLicenseKey values are used correctly when set

Impact

Once merged, users can configure newrelic-logging image pull behaviour globally:

global:
  images:
    registry: "my.private.registry.com"
    pullSecrets:
      - name: my-registry-credentials
    pullPolicy: Always

@dpacheconr dpacheconr requested review from a team as code owners November 14, 2025 13:57
@dpacheconr dpacheconr changed the title feat(newrelic-logging): support global.images.registry for busybox init container feat: add global.images registry and pullSecrets support to nri-bundle charts Nov 14, 2025
@dpacheconr dpacheconr force-pushed the support/newrelic-logging-final branch from 8fbed24 to 2228ff7 Compare November 14, 2025 16:38
@dpacheconr dpacheconr changed the title feat: add global.images registry and pullSecrets support to nri-bundle charts feat: add global.images registry, pullSecrets, and pullPolicy support to nri-bundle charts Nov 14, 2025
@dpacheconr dpacheconr force-pushed the support/newrelic-logging-final branch 2 times, most recently from fb84891 to 22c6dab Compare November 14, 2025 18:17
dpacheconr and others added 3 commits March 11, 2026 09:38
…onset

Update imagePullSecrets handling to cascade from global.images.pullSecrets:
- Updated daemonset.yaml to include global.images.pullSecrets rendering
- Both global and chart-level pullSecrets are concatenated together

Configuration hierarchy:
1. global.images.pullSecrets (applied first)
2. image.pullSecrets (applied second - chart level)
Both sources are concatenated to support flexible secret management.
Add support for cascading pullPolicy from global.images.pullPolicy setting:
- Added pullPolicy helpers to _helpers.tpl
- Updated main image and init container helpers to support global pullPolicy

Configuration hierarchy for pullPolicy:
1. global.images.pullPolicy (highest priority)
2. Chart-level image.pullPolicy
3. Default: IfNotPresent

Users can now configure pull policy globally:
  global:
    images:
      pullPolicy: Always
…ullPolicy, add tests

- Add missing newrelic-logging.persistenceInitContainerImage helper (was called but undefined)
- Fix pullPolicy precedence on both helpers: chart-specific > global > default (IfNotPresent)
- Wire daemonset.yaml init container to use persistenceInitContainerImagePullPolicy helper
- Wire daemonset.yaml main container to use imagePullPolicy helper (was using .Values directly)
- Restore securityContext on init container dropped during conflict resolution
- Add tests: LICENSE_KEY secret name+key values, main/init pullPolicy precedence, init registry precedence
@dpacheconr dpacheconr force-pushed the support/newrelic-logging-final branch from 22c6dab to 57e9baa Compare March 11, 2026 09:40
@dpacheconr
Copy link
Copy Markdown
Contributor Author

Rebased onto master, resolved conflicts, and fixed several issues found during the rebase: added missing persistenceInitContainerImage helper (was called but undefined), corrected pullPolicy precedence to chart → global → default, wired both containers to use the helpers instead of direct .Values access, and added test coverage.

dpacheconr added a commit to dpacheconr/helm-charts that referenced this pull request Mar 24, 2026
…pullPolicy support

Consolidates changes from PR newrelic#2005 into this branch:

- Add persistenceInitContainerImage helper: global.images.registry is
  prepended to busybox when set; chart-level repository takes precedence
- Add imagePullPolicy helper: chart-specific > global.images.pullPolicy > IfNotPresent
- Add persistenceInitContainerImagePullPolicy helper: same precedence for init container
- Wire daemonset.yaml init container to use image/pullPolicy helpers
- Wire main container imagePullPolicy to use imagePullPolicy helper
- Add fluentBit.persistenceInitContainerImage values block (repo, tag, pullPolicy)
- Add images_test.yaml: LICENSE_KEY secret, pullPolicy precedence, init container
  image/pullPolicy tests (180 lines, 11 new test cases)

Note: global.images.pullSecrets is handled automatically by the common-library
renderPullSecrets helper via context; no custom wiring needed.

Closes newrelic#2005
@dpacheconr
Copy link
Copy Markdown
Contributor Author

Closing in favour of #2023 which now consolidates all changes from this PR. The global.images registry, pullSecrets, and pullPolicy helpers + daemonset wiring + images_test.yaml have been merged into that branch.

@dpacheconr dpacheconr closed this Mar 24, 2026
@dpacheconr dpacheconr deleted the support/newrelic-logging-final branch March 24, 2026 15:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant