Skip to content
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

fix(clustering): session renamed fields #10354

Merged
merged 1 commit into from
Feb 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@

- Fix an issue where control plane does not downgrade config for `aws_lambda` and `zipkin` for older version of data planes.
[#10346](https://github.com/Kong/kong/pull/10346)
- Fix an issue where control plane does not rename fields correctly for `session` for older version of data planes.
[#10352](https://github.com/Kong/kong/pull/10352)

## 3.2.0

Expand Down
1 change: 1 addition & 0 deletions kong/clustering/compat/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@ end
local function rename_field(config, name_from, name_to, has_update)
if config[name_from] ~= nil then
config[name_to] = config[name_from]
config[name_from] = nil
return true
end
return has_update
Expand Down
34 changes: 34 additions & 0 deletions spec/01-unit/19-hybrid/03-compat_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,9 @@ describe("kong.clustering.compat", function()
"goodbye",
"my.nested.field",
},
session = {
"anything",
},
},
})
end)
Expand Down Expand Up @@ -275,6 +278,37 @@ describe("kong.clustering.compat", function()
},
},
},

{
name = "renamed fields",
version = "1.0.0",
plugins = {
{
name = "session",
config = {
idling_timeout = 60,
rolling_timeout = 60,
stale_ttl = 60,
cookie_same_site = "Default",
cookie_http_only = false,
remember = true,
},
},
},
expect = {
{
name = "session",
config = {
cookie_idletime = 60,
cookie_lifetime = 60,
cookie_discard = 60,
cookie_samesite = "Lax",
cookie_httponly = false,
cookie_persistent = true,
},
},
},
},
}

for _, case in ipairs(cases) do
Expand Down