Commit Graph

40 Commits

Author SHA1 Message Date
Guilherme Salazar
f88da7df62 refactor(pluginservers): code refactor & testing (#12858)
Context
-------

The overall goal of this commit is to refactor the external plugins
implementation, with the following goals in mind:
- Make plugin server code more approachable to unfamiliar engineers and
easier to evolve with confidence
- Harden configuration; ensure configuration defects are caught before
Kong is started
- Extend testing coverage

This is related to ongoing work on the Go PDK, with similar goals in
mind.

Summary
-------

This commit implements the following overall changes to plugin server
code:

- Move configuration related code into conf loader, so that configuration
loading and validation happens at startup time, rather than lazily, when
plugin data is loaded or pluginservers are started. Add tests for
current behavior.

- Move process-management code - for starting up plugin servers as well
as querying external plugins info - into the `process.lua` module.

- Introduce a `kong.runloop.plugin_servers.rpc` module that encapsulates
RPC initialization and protocol-specific implementations. This further
simplifies the main plugin server main module.

- Factor exposed API and phase handlers bridging code into a new `plugin`
module, which encapsulates an external plugin representation, including
the expected fields for any Kong plugin, plus external plugin-specific
bits, such as the RPC instance. Part of this external plugin-specific part
is the instance life cycle management. With this structure, the `kong.runloop.plugin_servers`
main module contains only general external plugin code, including a list
of loaded external plugins, and associated start/stop functions for
plugin servers.

Testing
-------

This commit also implements the following improvements to tests:
- Restructure fixtures to accommodate new external plugin servers --
namely, targeting for now in the existing Python and Javascript
- Add new test cases for external plugins:
  * External plugin configuration: add test cases for current behavior;
    in particular:
    - Fail if no `query_cmd` is provided;
    - Warn if no `start_cmd` is provided - this is by design, as
      external plugins servers can be managed outside of Kong
  * Plugin server start / stop - for both Go and Python plugins
  * External plugin info querying for both Go and Python plugins
  * External plugin execution - for both Go and Python plugins

Internal flow
-------------

`.plugin_servers.init:` loads all external plugins, by calling .plugin_servers.process and `.plugin_servers.plugin`
  `.plugin_servers.process`: queries external plugins info with the command specified in `_query_cmd` proeprties
  `.plugin_servers.plugin`: with info obtained as described above, `.plugin:new` returns a kong-compatible representation
                          of an external plugin, with phase handlers, PRIORITY, and wrappers to the PDK. Calls
                          `.plugin_servers.rpc` to create an RPC through which Kong communicates with the plugin process
    `.plugin_servers.rpc`: based on info contained in the plugin (protocol field), creates the correct RPC for the
                          given external plugin
      `.plugin_servers.rpc.pb_rpc`: protobuf rpc implementation - used by Golang
      `.plugin_servers.rpc.mp.rpc`: messagepack rpc implementation - used by JS and Python
`.plugin_servers.init`: calls `.plugin_servers.process` to start external plugin servers
  `.plugin_servers.process`: optionally starts all external plugin servers (if a `_start_cmd` is found)
     uses the resty pipe API to manage the external plugin process
2024-11-13 17:58:24 -03:00
Qi
cf403a7313 fix(rate-limiting): do not set response headers if conf.hide_client_headers is true (#13722)
Fix https://github.com/Kong/kong/issues/13715; we should not set the response header if `conf.hide_client_headers` is `true`.
2024-10-08 10:11:10 +08:00
Michael Martin
544db51691 tests(wasm): add test filters/fixtures 2023-07-18 13:16:43 -07:00
Michael Martin
1945abb1ab feat(build): add ngx_wasm_module 2023-07-18 13:16:43 -07:00
Hans Hübner
e96ab9f31e fix(tests): revive HTTP/2.0 tests (#11170) 2023-07-05 13:48:03 -03:00
Xumin
068b318256 test(*): implement new HTTP mocking (#10885)
* test(*): implement new HTTP mocking

Fix KAG-1148

apply suggestions

Co-authored-by: Chrono <chrono_cpp@me.com>
Co-authored-by: Hans Hübner <hans.huebner@gmail.com>

* chore(test): use new http_mock for 05-proxy

---------

Co-authored-by: Chrono <chrono_cpp@me.com>
Co-authored-by: Hans Hübner <hans.huebner@gmail.com>
2023-05-23 12:09:19 +02:00
Hans Hübner
33cbec403e chore: rewrite database upgrade tests without gojira (#10567)
* Begin removing gojira from upgrade tests

* Can compare two numbered versions

* Rework upgrade tests without gojira

* trigger test

* remove testing branch spec

* Address review comments

* Remove symbolic link that is not needed after all

* remove test trigger
2023-03-28 08:56:31 +02:00
Douglas Lee
a8e0a8b391 chore(git): add vscode related ignored folders 2023-01-16 16:57:08 +01:00
Mayo
52de9e734b feat(build): add bazel support 2022-12-06 16:10:17 +08:00
Hans Hübner
3763f6bdc4 chore(upgrade-tests) log to stdout instead of files to benefit CI (#9277) 2022-08-23 10:53:02 +02:00
Hans Hübner
b79a36179e Database update testing script and tests (#9064) 2022-07-28 19:42:42 +02:00
Guilherme Salazar
74510d5e9a chore(scripts) update prerelease script 2020-12-22 15:48:21 -03:00
Colin Hutchinson
375f6fe2c6 chore(prerelease) ability for us to release prerelease builds of Kong (#5846)
* chore(prerelease) ability for us to release prerelease builds of Kong

* chore(release) merge the jenkins daily release with release stages

* chore(prerelease) commit the prerelease script [WIP]

* chore(automation) remove uneeded steps for prerelease

* chore(release) adjust alpha release script per team feedback

* chore(ci) adjustments so the Makeifle logic is more approachable
2020-05-19 11:14:01 -04:00
Thijs Schreijer
71e9e000cc chore(docs) add setup for development doc generation 2020-03-17 13:29:23 +01:00
Raj Chowdhury
f8270d2dd4 chore(git) add .env to .gitignore (#5596) 2020-02-24 14:11:22 +02:00
Guilherme Salazar
22d4346974 tests(fixtures) add fixture go plugin 2020-01-10 15:10:40 -03:00
Hisham Muhammad
0c557636a0 chore(ci) run autodoc-admin-api on CI 2019-08-09 11:52:51 -03:00
Guilherme Salazar
9810dbfbd6 chore(make) add grpcurl dependency
`grpcurl` is a gRPC CLI client, which will be used in our gRPC tests.
2019-07-23 13:59:31 -07:00
Colin Hutchinson
a091fdc6c1 chore(ci) daily builds using kong-build-tools (#4035)
* chore(ci) use kong-build-tools to build, package and release Kong

* misc(travis) testing -- setting up travis-ci to build daily images using kong-build-tools

* misc(travis) testing -- setting up travis-ci to build daily images using kong-build-tools

* misc(travis) testing -- setting up travis-ci to build daily images using kong-build-tools

* misc(travis) testing -- setting up travis-ci to build daily images using kong-build-tools

* misc(travis) testing -- setting up travis-ci to build daily images using kong-build-tools

* misc(travis) testing -- setting up travis-ci to build daily images using kong-build-tools

* misc(travis) testing -- setting up travis-ci to build daily images using kong-build-tools

* misc(travis) testing -- setting up travis-ci to build daily images using kong-build-tools

* misc(travis) testing -- setting up travis-ci to build daily images using kong-build-tools

* misc(travis) testing -- setting up travis-ci to build daily images using kong-build-tools

* fix(release) let .travis.yml set the kong version

* fix(ci) adjust how default vs ENV overrides works in the Makefile

* feat(travis) have travis build additional package types

* feat(travis) have travis build additional package types

* feat(travis) have travis build additional package types

* feat(travis) have travis build additional package types

* feat(travis) have travis-ci build the alpine apk package

* fix(travis) need the if statement on every deploy task

* fix(travis) need the if statement on every deploy task

* fix(release) use current working directory name to determine package name

* misc(ci) make the daily build only run on cron tasks

* misc(openssl) bump openssl to 1.1.1a

* fix(ci) override bintray naming convention on daily releases

* chore(ci) pin the kong-build-tools version

* feat(ci) remove previous daily build process

* feat(ci) adjust daily build process

* chore(ci) bump the kong-build-tools version

* fix(build) we dont need java in our CI anymore
2019-01-31 10:43:09 -05:00
Thibault Charbonnier
2500c8eb9c refactor(cli) start/stop with Serf service refactor 2016-05-27 13:49:01 -07:00
Thijs Schreijer
ee7a116605 added ldoc config file, excluded generated docs from git. 2015-08-26 11:55:09 +02:00
thefosk
e80357ffd7 Refactoring package creation script for different OS distributions 2015-05-11 19:24:16 -07:00
thefosk
bd7b89d7e6 build 2015-04-15 02:54:41 -07:00
Nijiko Yonskai
742752c7fe chore(gitignore): Remove site related structures 2015-03-24 15:50:26 -07:00
thibaultCha
3f6822c92a Rename out/ to nginx_tmp/ 2015-03-04 11:17:28 -08:00
thibaultCha
292b5b7cc0 Scripts and Makefile simplifications 2015-03-03 18:56:29 -08:00
thibaultCha
218dad12f1 Linting, coverage, coveralls and dev rocks 2015-02-26 18:37:53 -08:00
thibaultCha
8044bfd2ca Unmarshall returned entity on :insert() 2015-02-24 15:16:22 -08:00
thibaultCha
67e22594b0 Merge branch 'feature/refactor' 2015-02-18 19:06:00 -08:00
thibaultCha
a71529e699 Isolate environment configurations (#12) 2015-02-18 18:35:35 -08:00
thibaultCha
f644f06c2f Add test/ to .gitignore 2015-02-17 22:39:35 -08:00
thefosk
5646148f60 Finishing CLI script; improving Makefile 2015-02-17 19:09:50 -08:00
thefosk
89a7281229 Kong init 2015-02-16 18:15:17 -08:00
Vazha
4ad2f2a493 add Jekyll to Kong and put it in master branch #KONG-29 2015-02-16 14:05:02 +02:00
thefosk
2f1dbdf668 gitignore 2015-01-20 17:08:15 -08:00
thibaultCha
2f42cf7e45 Ignore gh-pages branch's dependencies folders 2015-01-16 22:58:58 -08:00
thefosk
a2b1265467 tracis; 2015-01-07 16:50:31 -08:00
thefosk
10dab46412 log 2014-12-04 20:25:55 -08:00
thibaultCha
284ae92b86 Structure refactor.
- Made it a luarocks
- Builtin make luarocks
- Better project structure
2014-12-03 15:59:58 -08:00
thefosk
149cc6859b env setup 2014-11-26 19:24:41 -08:00