-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(rl): standarize redis configuration (#12301)
* chore(rl): standarize redis configuration Rate-Limiting right now has new config structure that reuses common redis connection configuration. The same as ACME plugin. KAG-3388 * chore(response-rl): standarize redis configuration Response-RateLimiting right now has new config structure that reuses common redis connection configuration. The same as ACME and RateLimiting plugin. KAG-3388
- Loading branch information
Showing
27 changed files
with
1,325 additions
and
353 deletions.
There are no files selected for viewing
3 changes: 3 additions & 0 deletions
3
changelog/unreleased/kong/standardize-redis-conifguration-rate-limiting.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
message: "**Rate Limiting**: Standardize redis configuration across plugins. The redis configuration right now follows common schema that is shared across other plugins." | ||
type: deprecation | ||
scope: Plugin |
3 changes: 3 additions & 0 deletions
3
changelog/unreleased/kong/standardize-redis-conifguration-response-rl.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
message: "**Response-RateLimiting**: Standardize redis configuration across plugins. The redis configuration right now follows common schema that is shared across other plugins." | ||
type: deprecation | ||
scope: Plugin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
kong/plugins/rate-limiting/clustering/compat/redis_translation.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
local function adapter(config_to_update) | ||
if config_to_update.policy == "redis" then | ||
config_to_update.redis_host = config_to_update.redis.host | ||
config_to_update.redis_port = config_to_update.redis.port | ||
config_to_update.redis_username = config_to_update.redis.username | ||
config_to_update.redis_password = config_to_update.redis.password | ||
config_to_update.redis_database = config_to_update.redis.database | ||
config_to_update.redis_timeout = config_to_update.redis.timeout | ||
config_to_update.redis_ssl = config_to_update.redis.ssl | ||
config_to_update.redis_ssl_verify = config_to_update.redis.ssl_verify | ||
config_to_update.redis_server_name = config_to_update.redis.server_name | ||
|
||
config_to_update.redis = nil | ||
|
||
return true | ||
end | ||
|
||
return false | ||
end | ||
|
||
return { | ||
adapter = adapter | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
return { | ||
postgres = { | ||
up = [[ | ||
DO $$ | ||
BEGIN | ||
UPDATE plugins | ||
SET config = | ||
config::jsonb | ||
- 'redis_host' | ||
- 'redis_port' | ||
- 'redis_password' | ||
- 'redis_username' | ||
- 'redis_ssl' | ||
- 'redis_ssl_verify' | ||
- 'redis_server_name' | ||
- 'redis_timeout' | ||
- 'redis_database' | ||
|| jsonb_build_object( | ||
'redis', | ||
jsonb_build_object( | ||
'host', config->'redis_host', | ||
'port', config->'redis_port', | ||
'password', config->'redis_password', | ||
'username', config->'redis_username', | ||
'ssl', config->'redis_ssl', | ||
'ssl_verify', config->'redis_ssl_verify', | ||
'server_name', config->'redis_server_name', | ||
'timeout', config->'redis_timeout', | ||
'database', config->'redis_database' | ||
) | ||
) | ||
WHERE name = 'rate-limiting'; | ||
EXCEPTION WHEN UNDEFINED_COLUMN OR UNDEFINED_TABLE THEN | ||
-- Do nothing, accept existing state | ||
END$$; | ||
]], | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,4 +3,5 @@ return { | |
"003_10_to_112", | ||
"004_200_to_210", | ||
"005_320_to_330", | ||
"006_350_to_360", | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
kong/plugins/response-ratelimiting/clustering/compat/redis_translation.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
local function adapter(config_to_update) | ||
if config_to_update.policy == "redis" then | ||
config_to_update.redis_host = config_to_update.redis.host | ||
config_to_update.redis_port = config_to_update.redis.port | ||
config_to_update.redis_username = config_to_update.redis.username | ||
config_to_update.redis_password = config_to_update.redis.password | ||
config_to_update.redis_database = config_to_update.redis.database | ||
config_to_update.redis_timeout = config_to_update.redis.timeout | ||
config_to_update.redis_ssl = config_to_update.redis.ssl | ||
config_to_update.redis_ssl_verify = config_to_update.redis.ssl_verify | ||
config_to_update.redis_server_name = config_to_update.redis.server_name | ||
|
||
config_to_update.redis = nil | ||
|
||
return true | ||
end | ||
|
||
return false | ||
end | ||
|
||
return { | ||
adapter = adapter | ||
} |
Oops, something went wrong.