Skip to content

fix: handle nil annotations in mse.lua#334

Open
AdeshDeshmukh wants to merge 1 commit intoopenkruise:masterfrom
AdeshDeshmukh:fix-mse-lua-nil-check
Open

fix: handle nil annotations in mse.lua#334
AdeshDeshmukh wants to merge 1 commit intoopenkruise:masterfrom
AdeshDeshmukh:fix-mse-lua-nil-check

Conversation

@AdeshDeshmukh
Copy link
Copy Markdown

What this PR does / why we need it

Added nil check for obj.annotations in mse.lua before using it. This follows the same pattern already used in higress.lua and prevents potential nil reference errors when annotations are not present.

Which issue(s) this PR fixes

Fixes #228

Changes made

Added nil handling for obj.annotations in lua_configuration/trafficrouting_ingress/mse.lua:

annotations = {}
-- obj.annotations is ingress annotations, handle nil case
if ( obj.annotations )
then
    annotations = obj.annotations
end

This matches the pattern used in higress.lua (line 1-6).

Testing done

  • Verified the fix matches the pattern in higress.lua
  • No other code changes needed

Does this PR introduce a user-facing change?

NONE

Added nil check for obj.annotations before using it, following
the same pattern used in higress.lua. This prevents potential
nil reference errors when annotations are not present.

Fixes openkruise#228

Signed-off-by: AdeshDeshmukh <adeshkd123@gmail.com>
@kruise-bot kruise-bot requested review from FillZpp and veophi March 24, 2026 12:53
@kruise-bot
Copy link
Copy Markdown

[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 furykerry for approval by writing /assign @furykerry 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

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 24, 2026

Codecov Report

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

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #334   +/-   ##
=======================================
  Coverage   51.38%   51.38%           
=======================================
  Files          66       66           
  Lines        8559     8559           
=======================================
  Hits         4398     4398           
  Misses       3575     3575           
  Partials      586      586           
Flag Coverage Δ
unittests 51.38% <ø> (ø)

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.

annotations in mse.lua may be nil

2 participants