Skip to content

fix: update init container config refs in primary spec#1925

Merged
aryan9600 merged 1 commit into
fluxcd:mainfrom
immanuwell:fix/init-container-primary-config-refs
Jun 27, 2026
Merged

fix: update init container config refs in primary spec#1925
aryan9600 merged 1 commit into
fluxcd:mainfrom
immanuwell:fix/init-container-primary-config-refs

Conversation

@immanuwell

Copy link
Copy Markdown
Contributor

ApplyPrimaryConfigs rewrites ConfigMap/Secret refs in spec.Containers to use -primary copies, but skips spec.InitContainers entirely. GetTargetConfigs already tracks init container refs, so the primary copies get created, but the init containers in the primary deployment still point to the originals. Not great.

How to reproduce: deploy anything with an init container that pulls config from a ConfigMap or Secret via env/envFrom, let flagger init the primary, check the primary deployment spec - init containers still reference the original names.

Fix mirrors the existing containers loop for InitContainers. Also squashed a double-space typo in an error message while in the file.

Tests added to TestConfigTracker_ConfigMaps and TestConfigTracker_Secrets for both deployment and daemonset subtests.

Signed-off-by: immanuwell <pchpr.00@list.ru>

@aryan9600 aryan9600 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm - thank you for the fix! 🏅

@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 30.08%. Comparing base (61582f7) to head (aecdbf4).
⚠️ Report is 4 commits behind head on main.
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1925      +/-   ##
==========================================
+ Coverage   30.00%   30.08%   +0.08%     
==========================================
  Files         288      288              
  Lines       18455    18477      +22     
==========================================
+ Hits         5537     5559      +22     
  Misses      12189    12189              
  Partials      729      729              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@aryan9600
aryan9600 merged commit f2821a5 into fluxcd:main Jun 27, 2026
30 of 31 checks passed
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.

3 participants