-
Notifications
You must be signed in to change notification settings - Fork 74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implementing a generic Ingress based on Lua And A/B Testing Release #86
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Ignore results from vendor directories | ||
ignoreFiles = """ | ||
vendor/ | ||
lua_configuration/ | ||
""" |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,35 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
annotations = {} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💬 5 similar findings have been found in this PR W111: setting non-standard global variable 'annotations' 🔎 Expand here to view all instances of this finding
Visit the Lift Web Console to find more details in your report. ℹ️ Learn about @sonatype-lift commandsYou can reply with the following commands. For example, reply with @sonatype-lift ignoreall to leave out all findings.
Note: When talking to LiftBot, you need to refresh the page to see its response. Was this a good recommendation? |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
if ( obj.annotations ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💬 5 similar findings have been found in this PR W113: accessing undefined variable 'obj' 🔎 Expand here to view all instances of this finding
Visit the Lift Web Console to find more details in your report. ℹ️ Learn about @sonatype-lift commandsYou can reply with the following commands. For example, reply with @sonatype-lift ignoreall to leave out all findings.
Note: When talking to LiftBot, you need to refresh the page to see its response. Was this a good recommendation? |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
then | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
annotations = obj.annotations | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
end | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
annotations["alb.ingress.kubernetes.io/canary"] = "true" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💬 32 similar findings have been found in this PR W112: mutating non-standard global variable 'annotations' 🔎 Expand here to view all instances of this finding
Showing 10 of 32 findings. Visit the Lift Web Console to see all. ℹ️ Learn about @sonatype-lift commandsYou can reply with the following commands. For example, reply with @sonatype-lift ignoreall to leave out all findings.
Note: When talking to LiftBot, you need to refresh the page to see its response. Was this a good recommendation? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @sonatype-lift ignore There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've recorded this as ignored for this pull request. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💬 32 similar findings have been found in this PR W112: mutating non-standard global variable 'annotations' 🔎 Expand here to view all instances of this finding
Showing 10 of 32 findings. Visit the Lift Web Console to see all. ℹ️ Learn about @sonatype-lift commandsYou can reply with the following commands. For example, reply with @sonatype-lift ignoreall to leave out all findings.
Note: When talking to LiftBot, you need to refresh the page to see its response. Was this a good recommendation? |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
annotations["alb.ingress.kubernetes.io/canary-by-cookie"] = nil | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
annotations["alb.ingress.kubernetes.io/canary-by-header"] = nil | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
annotations["alb.ingress.kubernetes.io/canary-by-header-pattern"] = nil | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
annotations["alb.ingress.kubernetes.io/canary-by-header-value"] = nil | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
annotations["alb.ingress.kubernetes.io/canary-weight"] = nil | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
if ( obj.weight ~= "-1" ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
then | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
annotations["alb.ingress.kubernetes.io/canary-weight"] = obj.weight | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
end | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
if ( not obj.matches ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
then | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
return annotations | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
end | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
for _,match in ipairs(obj.matches) do | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
local header = match.headers[1] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
if ( header.name == "canary-by-cookie" ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
then | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
annotations["alb.ingress.kubernetes.io/canary-by-cookie"] = header.value | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
annotations["alb.ingress.kubernetes.io/canary-by-header"] = header.name | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
if ( header.type == "RegularExpression" ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
then | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
annotations["alb.ingress.kubernetes.io/canary-by-header-pattern"] = header.value | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
annotations["alb.ingress.kubernetes.io/canary-by-header-value"] = header.value | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
end | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
end | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
end | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
return annotations |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
annotations = {} | ||
-- obj.annotations is ingress annotations, it is recommended not to remove the part of the lua script, it must be kept | ||
if ( obj.annotations ) | ||
then | ||
annotations = obj.annotations | ||
end | ||
-- indicates the ingress is nginx canary api | ||
annotations["nginx.ingress.kubernetes.io/canary"] = "true" | ||
-- First, set all canary api to nil | ||
annotations["nginx.ingress.kubernetes.io/canary-by-cookie"] = nil | ||
annotations["nginx.ingress.kubernetes.io/canary-by-header"] = nil | ||
annotations["nginx.ingress.kubernetes.io/canary-by-header-pattern"] = nil | ||
annotations["nginx.ingress.kubernetes.io/canary-by-header-value"] = nil | ||
annotations["nginx.ingress.kubernetes.io/canary-weight"] = nil | ||
-- if rollout.spec.strategy.canary.steps.weight is nil, obj.weight will be -1, | ||
-- then we need remove the canary-weight annotation | ||
if ( obj.weight ~= "-1" ) | ||
then | ||
annotations["nginx.ingress.kubernetes.io/canary-weight"] = obj.weight | ||
end | ||
-- if don't contains headers, immediate return annotations | ||
if ( not obj.matches ) | ||
then | ||
return annotations | ||
end | ||
-- headers & cookie apis | ||
-- traverse matches | ||
for _,match in ipairs(obj.matches) do | ||
local header = match.headers[1] | ||
-- cookie | ||
if ( header.name == "canary-by-cookie" ) | ||
then | ||
annotations["nginx.ingress.kubernetes.io/canary-by-cookie"] = header.value | ||
else | ||
annotations["nginx.ingress.kubernetes.io/canary-by-header"] = header.name | ||
-- if regular expression | ||
if ( header.type == "RegularExpression" ) | ||
then | ||
annotations["nginx.ingress.kubernetes.io/canary-by-header-pattern"] = header.value | ||
else | ||
annotations["nginx.ingress.kubernetes.io/canary-by-header-value"] = header.value | ||
end | ||
end | ||
end | ||
-- must be return annotations | ||
return annotations |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lift Configuration Added: Key: ignoreFiles
New value: vendor/
lua_configuration/
ℹ️ Learn about @sonatype-lift commands
You can reply with the following commands. For example, reply with @sonatype-lift ignoreall to leave out all findings.
@sonatype-lift ignore
@sonatype-lift ignoreall
@sonatype-lift exclude <file|issue|path|tool>
file|issue|path|tool
from Lift findings by updating your config.toml fileNote: When talking to LiftBot, you need to refresh the page to see its response.
Click here to add LiftBot to another repo.
Was this a good recommendation?
[ 🙁 Not relevant ] - [ 😕 Won't fix ] - [ 😑 Not critical, will fix ] - [ 🙂 Critical, will fix ] - [ 😊 Critical, fixing now ]