Skip to content

Commit

Permalink
Merge branch 'master' into next
Browse files Browse the repository at this point in the history
  • Loading branch information
hishamhm committed May 5, 2020
2 parents 43aeddf + 6e005c1 commit 679e323
Show file tree
Hide file tree
Showing 31 changed files with 960 additions and 156 deletions.
2 changes: 1 addition & 1 deletion .requirements
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ KONG_LICENSE="ASL 2.0"

RESTY_VERSION=1.15.8.3
RESTY_LUAROCKS_VERSION=3.3.1
RESTY_OPENSSL_VERSION=1.1.1f
RESTY_OPENSSL_VERSION=1.1.1g
RESTY_PCRE_VERSION=8.44
LIBYAML_VERSION=0.2.3
KONG_GO_PLUGINSERVER_VERSION=v0.3.0
84 changes: 59 additions & 25 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Table of Contents


- [2.0.4](#204)
- [2.0.3](#203)
- [2.0.2](#202)
- [2.0.1](#201)
Expand Down Expand Up @@ -42,6 +43,38 @@
- [0.9.9 and prior](#099---20170202)


## [2.0.4]

> Released 2020/04/22
### Fixes

##### Core

- Disable JIT mlcache:get_bulk() on ARM64
[#5797](https://github.com/Kong/kong/pull/5797)
- Don't incrementing log counters on unexpected errors
[#5783](https://github.com/Kong/kong/pull/5783)
- Invalidate target history at cleanup so balancers stay synced
[#5775](https://github.com/Kong/kong/pull/5775)
- Set a log prefix with the upstream name
[#5773](https://github.com/Kong/kong/pull/5773)
- Fix memory leaks when loading a declarative config that fails schema validation
[#5766](https://github.com/Kong/kong/pull/5766)
- Fix some balancer and cluster_events issues
[#5804](https://github.com/Kong/kong/pull/5804)

##### Configuration

- Send declarative config updates to stream subsystem via Unix domain
[#5797](https://github.com/Kong/kong/pull/5797)
- Now when using declarative configurations the cache is purged on reload, cleaning any references to removed entries
[#5769](https://github.com/Kong/kong/pull/5769)


[Back to TOC](#table-of-contents)


## [2.0.3]

> Released 2020/04/06
Expand All @@ -54,40 +87,40 @@ breaking changes.

##### Core

- Setting the target weight to 0 does not automatically remove the upstream.
[#5710](https://github.com/Kong/kong/pull/5710).
- The plugins iterator is now always fully built, even if the initialization
of any of them fails.
[#5692](https://github.com/Kong/kong/pull/5692).
- Fixed the load of `dns_not_found_ttl` and `dns_error_ttl` configuration
options.
[#5684](https://github.com/Kong/kong/pull/5684).
- Consumers and tags are properly warmed-up from the plugins' perspective,
i.e. they are loaded to the cache space that plugins access.
[#5669](https://github.com/Kong/kong/pull/5669).
- Customized error messages don't affect subsequent default error responses
now.
[#5673](https://github.com/Kong/kong/pull/5673).
- Setting the target weight to 0 does not automatically remove the upstream.
[#5710](https://github.com/Kong/kong/pull/5710).
- The plugins iterator is now always fully built, even if the initialization
of any of them fails.
[#5692](https://github.com/Kong/kong/pull/5692).
- Fixed the load of `dns_not_found_ttl` and `dns_error_ttl` configuration
options.
[#5684](https://github.com/Kong/kong/pull/5684).
- Consumers and tags are properly warmed-up from the plugins' perspective,
i.e. they are loaded to the cache space that plugins access.
[#5669](https://github.com/Kong/kong/pull/5669).
- Customized error messages don't affect subsequent default error responses
now.
[#5673](https://github.com/Kong/kong/pull/5673).

##### CLI

- Fixed the `lua_package_path` option precedence over `LUA_PATH` environment
variable.
[#5729](https://github.com/Kong/kong/pull/5729).
- Support to Nginx binary upgrade by correctly handling the `USR2` signal.
[#5657](https://github.com/Kong/kong/pull/5657).
- Fixed the `lua_package_path` option precedence over `LUA_PATH` environment
variable.
[#5729](https://github.com/Kong/kong/pull/5729).
- Support to Nginx binary upgrade by correctly handling the `USR2` signal.
[#5657](https://github.com/Kong/kong/pull/5657).

##### Configuration

- Fixed the logrotate configuration file with the right line terminators.
[#243](https://github.com/Kong/kong-build-tools/pull/243).
Thanks, [WALL-E](https://github.com/WALL-E)
- Fixed the logrotate configuration file with the right line terminators.
[#243](https://github.com/Kong/kong-build-tools/pull/243).
Thanks, [WALL-E](https://github.com/WALL-E)

##### Admin API

- Fixed the `sni is duplicated` error when sending multiple `SNIs` as body
arguments and an `SNI` on URL that matched one from the body.
[#5660](https://github.com/Kong/kong/pull/5660).
- Fixed the `sni is duplicated` error when sending multiple `SNIs` as body
arguments and an `SNI` on URL that matched one from the body.
[#5660](https://github.com/Kong/kong/pull/5660).

[Back to TOC](#table-of-contents)

Expand Down Expand Up @@ -4747,6 +4780,7 @@ First version running with Cassandra.

[Back to TOC](#table-of-contents)

[2.0.4]: https://github.com/Kong/kong/compare/2.0.3...2.0.4
[2.0.3]: https://github.com/Kong/kong/compare/2.0.2...2.0.3
[2.0.2]: https://github.com/Kong/kong/compare/2.0.1...2.0.2
[2.0.1]: https://github.com/Kong/kong/compare/2.0.0...2.0.1
Expand Down
1 change: 0 additions & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ pipeline {
}
options {
retry(1)
parallelsAlwaysFailFast()
timeout(time: 2, unit: 'HOURS')
}
environment {
Expand Down
76 changes: 65 additions & 11 deletions autodoc/data/admin-api.lua
Original file line number Diff line number Diff line change
Expand Up @@ -66,17 +66,7 @@ return {
}, {
title = [[Supported Content Types]],
text = [[
The Admin API accepts 2 content types on every endpoint:
- **application/x-www-form-urlencoded**
Simple enough for basic request bodies, you will probably use it most of the time.
Note that when sending nested values, Kong expects nested objects to be referenced
with dotted keys. Example:
```
config.limit=10&config.period=seconds
```
The Admin API accepts 3 content types on every endpoint:
- **application/json**
Expand All @@ -91,6 +81,70 @@ return {
}
}
```
An example adding a route to a service named `test-service`:
```
curl -i -X POST http://localhost:8001/services/test-service/routes \
-H "Content-Type: application/json" \
-d '{"name": "test-route", "paths": [ "/path/one", "/path/two" ]}'
```
- **application/x-www-form-urlencoded**
Simple enough for basic request bodies, you will probably use it most of the time.
Note that when sending nested values, Kong expects nested objects to be referenced
with dotted keys. Example:
```
config.limit=10&config.period=seconds
```
When specifying arrays send the values in order, or use square brackets (numbering
inside the brackets is optional but if provided it must be 1-indexed, and
consecutive). An example route added to a service named `test-service`:
```
curl -i -X POST http://localhost:8001/services/test-service/routes \
-d "name=test-route" \
-d "paths[1]=/path/one" \
-d "paths[2]=/path/two"
```
The following two are identical to the one above, but less explicit:
```
curl -i -X POST http://localhost:8001/services/test-service/routes \
-d "name=test-route" \
-d "paths[]=/path/one" \
-d "paths[]=/path/two"
curl -i -X POST http://localhost:8001/services/test-service/routes \
-d "name=test-route" \
-d "paths=/path/one" \
-d "paths=/path/two"
```
- **multipart/form-data**
Similar to url-encoded, this content type uses dotted keys to reference nested
objects. Here is an example of sending a Lua file to the pre-function Kong plugin:
```
curl -i -X POST http://localhost:8001/services/plugin-testing/plugins \
-F "name=pre-function" \
-F "config.access=@custom-auth.lua"
```
When specifying arrays for this content-type the array indices must be specified.
An example route added to a service named `test-service`:
```
curl -i -X POST http://localhost:8001/services/test-service/routes \
-F "name=test-route" \
-F "paths[1]=/path/one" \
-F "paths[2]=/path/two"
```
]]
},
},
Expand Down
4 changes: 2 additions & 2 deletions kong-2.0.3-0.rockspec → kong-2.0.4-0.rockspec
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package = "kong"
version = "2.0.3-0"
version = "2.0.4-0"
supported_platforms = {"linux", "macosx"}
source = {
url = "git://github.com/Kong/kong",
tag = "2.0.3"
tag = "2.0.4"
}
description = {
summary = "Kong is a scalable and customizable API Management Layer built on top of Nginx.",
Expand Down
31 changes: 16 additions & 15 deletions kong/cache.lua
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,6 @@ function _M.new(opts)
error("opts.worker_events is required", 2)
end

if opts.propagation_delay and type(opts.propagation_delay) ~= "number" then
error("opts.propagation_delay must be a number", 2)
end

if opts.ttl and type(opts.ttl) ~= "number" then
error("opts.ttl must be a number", 2)
end
Expand Down Expand Up @@ -202,13 +198,18 @@ function _M.new(opts)
end
end

local curr_mlcache = 1

if opts.cache_pages == 2 then
curr_mlcache = ngx.shared.kong:get("kong:cache:" .. opts.shm_name .. ":curr_mlcache") or 1
end

local self = {
propagation_delay = max(opts.propagation_delay or 0, 0),
cluster_events = opts.cluster_events,
mlcache = mlcaches[1],
mlcache = mlcaches[curr_mlcache],
mlcaches = mlcaches,
shm_names = shm_names,
curr_mlcache = 1,
curr_mlcache = curr_mlcache,
}

local ok, err = self.cluster_events:subscribe("invalidations", function(key)
Expand All @@ -226,6 +227,12 @@ function _M.new(opts)
end


function _M:save_curr_page()
return ngx.shared.kong:set(
"kong:cache:" .. self.shm_names[1] .. ":curr_mlcache", self.curr_mlcache)
end


function _M:get(key, opts, cb, ...)
if type(key) ~= "string" then
error("key must be a string", 2)
Expand Down Expand Up @@ -313,15 +320,9 @@ function _M:invalidate(key)

self:invalidate_local(key)

local delay
if self.propagation_delay > 0 then
delay = self.propagation_delay
end

log(DEBUG, "broadcasting (cluster) invalidation for key: '", key, "' ",
"with delay: '", delay or "none", "'")
log(DEBUG, "broadcasting (cluster) invalidation for key: '", key, "'")

local ok, err = self.cluster_events:broadcast("invalidations", key, delay)
local ok, err = self.cluster_events:broadcast("invalidations", key)
if not ok then
log(ERR, "failed to broadcast cached entity invalidation: ", err)
end
Expand Down
Loading

0 comments on commit 679e323

Please sign in to comment.