Skip to content

fix: prioritize ConfigMap over built-in Lua configurations#326

Open
Hadyaziz05 wants to merge 1 commit intoopenkruise:masterfrom
Hadyaziz05:fix/configurable-lua-defaults
Open

fix: prioritize ConfigMap over built-in Lua configurations#326
Hadyaziz05 wants to merge 1 commit intoopenkruise:masterfrom
Hadyaziz05:fix/configurable-lua-defaults

Conversation

@Hadyaziz05
Copy link

The default Lua configuration for Istio DestinationRule contains hardcoded values (e.g., 'gray' label) that could not be overridden by users. This was because getLuaScript() checked built-in scripts first, making the ConfigMap fallback unreachable.

Changes:

  • Reversed script loading order: ConfigMap → built-in (was: built-in → ConfigMap)
  • Users can now override hardcoded values via kruise-rollout-configuration ConfigMap
  • Added TestGetLuaScriptPriority to verify ConfigMap takes precedence
  • All existing tests pass with no regressions

Fixes the issue where users couldn't change hardcoded Lua values like 'istio.service.tag=gray' to custom values such as 'canary'.

Fixes #322

The default Lua configuration for Istio DestinationRule contains hardcoded
values (e.g., 'gray' label) that could not be overridden by users. This was
because getLuaScript() checked built-in scripts first, making the ConfigMap
fallback unreachable.

Changes:
- Reversed script loading order: ConfigMap → built-in (was: built-in → ConfigMap)
- Users can now override hardcoded values via kruise-rollout-configuration ConfigMap
- Added TestGetLuaScriptPriority to verify ConfigMap takes precedence
- All existing tests pass with no regressions

Fixes the issue where users couldn't change hardcoded Lua values like
'istio.service.tag=gray' to custom values such as 'canary'.
@kruise-bot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign fillzpp for approval by writing /assign @fillzpp in a comment. For more information see:The Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kruise-bot
Copy link

Welcome @Hadyaziz05! It looks like this is your first PR to openkruise/rollouts 🎉

@codecov
Copy link

codecov bot commented Feb 23, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 51.42%. Comparing base (8416512) to head (b189917).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #326      +/-   ##
==========================================
+ Coverage   51.38%   51.42%   +0.04%     
==========================================
  Files          66       66              
  Lines        8559     8556       -3     
==========================================
+ Hits         4398     4400       +2     
+ Misses       3575     3573       -2     
+ Partials      586      583       -3     
Flag Coverage Δ
unittests 51.42% <100.00%> (+0.04%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make default Lua config removable or configurable to avoid hardcoded KV conflicts

2 participants