-
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.
fix(conf) ngx.socket.tcp not available on init
### Summary Kong's initialization parses Kong configuration twice: 1. first the config is parsed in timer context by kong start (cli) 2. then the config is parsed again in init context when kong server is started Many Vault implementations will require the availability of `ngx.socket.tcp` to be able to fetch secrets. Unfortunately the `ngx.socket.tcp` is not available on init or init worker phases, but it works on timer context. Alternative approach would be to fetch secrets using `LuaSocket` on init phase, but that would mean that each secret is fetched twice (added latency + possible costs of accessing Vaults). Also, it is impossible to make `LuaSocket` and `ngx.socket.tcp` fully compatible, but there is one project that at least tried it: https://github.com/thibaultcha/lua-resty-socket This commit takes yet another approach: 1. it fetches secret on CLI 2. it passes secrets to server via environment variable 3. except on `kong reload` it passes it to server via file `.kong_process_secrets` The error on current master branch looks like this: ``` Error: ./kong/cmd/start.lua:64: nginx: [error] init_by_lua error: ./kong/globalpatches.lua:396: no request found ``` This commit fixes it.
- Loading branch information
Showing
12 changed files
with
681 additions
and
38 deletions.
There are no files selected for viewing
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
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
Oops, something went wrong.