fix: resolve env-value-from references within their namespace - #1249
fix: resolve env-value-from references within their namespace#1249darkweaver87 wants to merge 1 commit into
Conversation
31ffb2e to
5678814
Compare
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Central YAML (base), Organization UI (inherited) Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 8 included reviews per hour; 6 remain after this review. 📝 WalkthroughSummary by CodeRabbit
WalkthroughThe env-value-from template now preserves resource namespaces and resolves Secret and ConfigMap references against the consuming object’s namespace. Tests cover same-name resources, namespace-only mismatches, and namespace-less Secrets. ChangesNamespace-aware env reference resolution
Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: ⚪ Minimal · up to The PR scopes Secret and ConfigMap reference resolution by namespace while preserving empty-namespace matching; no actionable merge-blocking risk remains after normal checks and review. Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1249 +/- ##
===========================================
- Coverage 62.36% 31.39% -30.97%
===========================================
Files 197 239 +42
Lines 4854 6564 +1710
===========================================
- Hits 3027 2061 -966
- Misses 1439 4327 +2888
+ Partials 388 176 -212
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Fixes #1248.
env-value-fromcollected Secrets and ConfigMaps into maps keyed by name alone, so two same-named objects in different namespaces overwrote each other, and references to the shadowed one were reported as unknown.Objects are now kept per name and namespace, and a reference resolves against the objects visible from the namespace of the workload making it. An empty namespace on either side still matches, so manifests templated before install — which carry no namespace yet — keep linting exactly as they do today.
Two of the new tests fail without the change:
TestSecretOfAnotherNamespaceDoesNotShadow(the false positive from the issue) andTestSecretOfAnotherNamespaceIsUnknown(the reverse hole, where a reference to a key that only exists in another namespace used to pass).TestSecretWithoutNamespaceStillResolvesguards the lenient case above.