Kong-To- Migration Tool

admin 2 2025-01-10 编辑

Kong-To- Migration Tool

Apache is a production-ready open source seven-layer full traffic processing platform that serves as an API gateway for business entry traffic with high performance, low latency, official dashboard support, and over fifty plugins. If you are using Kong and are interested in but struggle to get started, try our just open source migration tool Kong-To- to help you migrate smoothly with one click.

Apache is a production-ready open source seven-layer full traffic processing platform that serves as an API gateway for business entry traffic with high performance, low latency, official dashboard support, and over fifty plugins. If you are using Kong and are interested in but struggle to get started, try our just open source migration tool Kong-To- to help you migrate smoothly with one click.

What is Kong-To-​

Kong-To- leverages the declarative configuration files of Kong and to migrate configuration data, and adapts to the architecture and functionality of both sides. Currently, we support the migration of configuration data for Route, Service, Upstream, Target, Consumer and three plugins Rate Limiting, Proxy Caching and Key Authentication on one side of Kong, and we have completed a minimal demo using Kong’s Getting Started Guide as an example . We have completed a minimal demo.

How to migrate configuration​

  1. To export a Kong declarative configuration file using Deck, refer to the following steps: Kong Official Document: Backup and Restore of Kong’s Configuration

  2. Download the repository and run the migration tool, which will generate the declarative configuration file .yaml to be used.

    git clone https://github.com/api7/kong-to-cd kong-to-make build./bin/kong-to- migrate --input kong.yaml --output .yaml# migrate succeed
  3. Use .yaml to configure , refer to Apache Official Document: Stand-alone mode.

Demo Test​

  1. Make sure docker is up and running, deploy the test environment, and use docker-compose to run and Kong.

    git clone https://github.com/apache/-dockercd kong-to-./tools/setup.sh
  2. Add configuration to Kong and test it according to Kong's Getting Started Guide.

    1. Expose services via Service and Route for routing and forwarding
    2. Set up Rate Limiting and Proxy Caching plugins for flow limiting caching
    3. Set up Key Authentication plugin for authentication
    4. Set up load balancing via Upstream and Target
  3. Export Kong's declarative configuration file to kong.yaml.

    go run ./cmd/dumpkong/main.go
  4. Run the migration tool, import kong.yaml and generate the configuration file .yaml to docker volumes.

    export EXPORT_PATH=./repos/-docker/example/_confgo run ./cmd/kong-to-/main.go
  5. Test whether the migrated routes, load balancing, plugins, etc. are working properly on Apache side.

    1. Test key auth plugin.

      curl -k -i -m 20 -o /dev/null -s -w %{http_code} http://127.0.0.1:9080/mock# output: 401
    2. Test proxy cache plugin.

      # access for the first timecurl -k -I -s  -o /dev/null http://127.0.0.1:9080/mock -H "apikey: apikey" -H "Host: mockbin.org"# see if got cachedcurl -I -s -X GET http://127.0.0.1:9080/mock -H "apikey: apikey" -H "Host: mockbin.org"# output:#   HTTP/1.1 200 OK#   ...#   -Cache-Status: HIT
    3. Test limit count plugin.

      for i in {1..5}; do   curl -s -o /dev/null -X GET http://127.0.0.1:9080/mock -H "apikey: apikey" -H "Host: mockbin.org"donecurl -k -i -m 20 -o /dev/null -s -w %{http_code} http://127.0.0.1:9080/mock -H "apikey: apikey" -H "Host: mockbin.org"# output: 429
    4. Test load balance.

      httpbin_num=0mockbin_num=0for i in {1..8}; do   body=$(curl -k -i -s http://127.0.0.1:9080/mock -H "apikey: apikey" -H "Host: mockbin.org")   if [[ $body == *"httpbin"* ]]; thenhttpbin_num=$((httpbin_num+1))   elif [[ $body == *"mockbin"* ]]; then      mockbin_num=$((mockbin_num+1))   fi   sleep 1.5doneecho "httpbin number: "${httpbin_num}", mockbin number: "${mockbin_num}# output:#   httpbin number: 6, mockbin number: 2

Conclusion​

Subsequent development plans for the migration tool are presented in the Roadmap on Kong-To-'s GitHub repository. Feel free to test and use Kong-To-, and discuss any questions you may have in the Issues section of the repository. Anyone who is interested in this project is welcome to contribute to it!

Kong-To- Migration Tool

上一篇: Understanding the Significance of 3.4 as a Root in Mathematics
下一篇: Authenticate with OpenID Connect and Apache
相关文章