Skip to content

Commit 88e44d8

Browse files
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 #228
1 parent 8416512 commit 88e44d8

File tree

1 file changed

+5
-1
lines changed
  • lua_configuration/trafficrouting_ingress

1 file changed

+5
-1
lines changed

lua_configuration/trafficrouting_ingress/mse.lua

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,11 @@ function split(input, delimiter)
44
return arr
55
end
66

7-
annotations = obj.annotations
7+
annotations = {}
8+
if ( obj.annotations )
9+
then
10+
annotations = obj.annotations
11+
end
812
annotations["nginx.ingress.kubernetes.io/canary"] = "true"
913
annotations["nginx.ingress.kubernetes.io/canary-by-cookie"] = nil
1014
annotations["nginx.ingress.kubernetes.io/canary-by-header"] = nil

0 commit comments

Comments
 (0)