From e5b5c059681bd343b1c75b2b7b1309a32f5cb68a Mon Sep 17 00:00:00 2001 From: Anuj Agrawal Date: Sun, 1 Mar 2026 16:55:18 +0530 Subject: [PATCH] fix: handle nil annotations in mse.lua Previously, mse.lua directly assigned obj.annotations to the annotations variable without checking for nil, which would cause a runtime error when the ingress object has no annotations. This aligns mse.lua with the nil-guard pattern already used in higress.lua, nginx.lua, and aliyun-alb.lua. Fixes openkruise/rollouts#228 Signed-off-by: Anuj Agrawal --- lua_configuration/trafficrouting_ingress/mse.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lua_configuration/trafficrouting_ingress/mse.lua b/lua_configuration/trafficrouting_ingress/mse.lua index d39ba7dc..c285adf1 100644 --- a/lua_configuration/trafficrouting_ingress/mse.lua +++ b/lua_configuration/trafficrouting_ingress/mse.lua @@ -4,7 +4,11 @@ function split(input, delimiter) return arr end -annotations = obj.annotations +annotations = {} +if ( obj.annotations ) +then + annotations = obj.annotations +end annotations["nginx.ingress.kubernetes.io/canary"] = "true" annotations["nginx.ingress.kubernetes.io/canary-by-cookie"] = nil annotations["nginx.ingress.kubernetes.io/canary-by-header"] = nil