Skip to content

Commit

Permalink
Merge branch 'master' into FTI-5329
Browse files Browse the repository at this point in the history
  • Loading branch information
sabertobihwy authored Oct 20, 2023
2 parents 5d01ff8 + 74bd113 commit 6ecbad0
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 23 deletions.
33 changes: 24 additions & 9 deletions .github/workflows/upgrade-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,32 +23,47 @@ on:
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
env:
GH_TOKEN: ${{ github.token }}

jobs:
upgrade-test:
name: Run migration tests
runs-on: ubuntu-22.04

steps:
- name: Install Docker
- name: Install Prerequisites
run: |
sudo apt-get -y update
sudo apt-get -y install ca-certificates curl gnupg lsb-release
sudo apt-get -y install ca-certificates curl gnupg lsb-release jq libyaml-dev net-tools
sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin
- name: Install prerequisites
run: |
sudo apt-get -y install jq
- name: Clone Kong source code
- name: Clone Source Code
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: recursive

- name: Build Debian Package
run: |
make package/deb
mv bazel-bin/pkg/kong.amd64.deb .
- name: Build Docker Image
uses: docker/build-push-action@v3
with:
file: build/dockerfiles/deb.Dockerfile
context: .
push: false
tags: "kong-local/kong:latest"
build-args: |
KONG_BASE_IMAGE=ubuntu:22.04
KONG_ARTIFACT_PATH=./
- name: Run upgrade tests
- name: Run Upgrade Tests
run: |
bash ./scripts/upgrade-tests/test-upgrade-path.sh
bash ./scripts/upgrade-tests/test-upgrade-path.sh -i kong-local/kong:latest
14 changes: 0 additions & 14 deletions kong/runloop/handler.lua
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ local log = ngx.log
local exit = ngx.exit
local exec = ngx.exec
local header = ngx.header
local set_header = ngx.req.set_header
local timer_at = ngx.timer.at
local get_phase = ngx.get_phase
local subsystem = ngx.config.subsystem
Expand Down Expand Up @@ -1355,9 +1354,6 @@ return {
end,
-- Only executed if the `router` module found a route and allows nginx to proxy it.
after = function(ctx)
local enabled_headers_upstream = kong.configuration.enabled_headers_upstream
local headers = constants.HEADERS

-- Nginx's behavior when proxying a request with an empty querystring
-- `/foo?` is to keep `$is_args` an empty string, hence effectively
-- stripping the empty querystring.
Expand Down Expand Up @@ -1450,16 +1446,6 @@ return {
if var.http_proxy_connection then
clear_header("Proxy-Connection")
end

-- X-Kong-Request-Id upstream header
local rid, rid_get_err = request_id_get()
if not rid then
log(WARN, "failed to get Request ID: ", rid_get_err)
end

if enabled_headers_upstream[headers.REQUEST_ID] and rid then
set_header(headers.REQUEST_ID, rid)
end
end
},
header_filter = {
Expand Down
18 changes: 18 additions & 0 deletions kong/templates/nginx_kong.lua
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,9 @@ server {
proxy_set_header X-Forwarded-Path $upstream_x_forwarded_path;
proxy_set_header X-Forwarded-Prefix $upstream_x_forwarded_prefix;
proxy_set_header X-Real-IP $remote_addr;
> if enabled_headers_upstream["X-Kong-Request-Id"] then
proxy_set_header X-Kong-Request-Id $kong_request_id;
> end
proxy_pass_header Server;
proxy_pass_header Date;
proxy_ssl_name $upstream_host;
Expand Down Expand Up @@ -199,6 +202,9 @@ server {
proxy_set_header X-Forwarded-Path $upstream_x_forwarded_path;
proxy_set_header X-Forwarded-Prefix $upstream_x_forwarded_prefix;
proxy_set_header X-Real-IP $remote_addr;
> if enabled_headers_upstream["X-Kong-Request-Id"] then
proxy_set_header X-Kong-Request-Id $kong_request_id;
> end
proxy_pass_header Server;
proxy_pass_header Date;
proxy_ssl_name $upstream_host;
Expand Down Expand Up @@ -230,6 +236,9 @@ server {
proxy_set_header X-Forwarded-Path $upstream_x_forwarded_path;
proxy_set_header X-Forwarded-Prefix $upstream_x_forwarded_prefix;
proxy_set_header X-Real-IP $remote_addr;
> if enabled_headers_upstream["X-Kong-Request-Id"] then
proxy_set_header X-Kong-Request-Id $kong_request_id;
> end
proxy_pass_header Server;
proxy_pass_header Date;
proxy_ssl_name $upstream_host;
Expand Down Expand Up @@ -261,6 +270,9 @@ server {
proxy_set_header X-Forwarded-Path $upstream_x_forwarded_path;
proxy_set_header X-Forwarded-Prefix $upstream_x_forwarded_prefix;
proxy_set_header X-Real-IP $remote_addr;
> if enabled_headers_upstream["X-Kong-Request-Id"] then
proxy_set_header X-Kong-Request-Id $kong_request_id;
> end
proxy_pass_header Server;
proxy_pass_header Date;
proxy_ssl_name $upstream_host;
Expand All @@ -285,6 +297,9 @@ server {
grpc_set_header X-Forwarded-Path $upstream_x_forwarded_path;
grpc_set_header X-Forwarded-Prefix $upstream_x_forwarded_prefix;
grpc_set_header X-Real-IP $remote_addr;
> if enabled_headers_upstream["X-Kong-Request-Id"] then
grpc_set_header X-Kong-Request-Id $kong_request_id;
> end
grpc_pass_header Server;
grpc_pass_header Date;
grpc_ssl_name $upstream_host;
Expand Down Expand Up @@ -328,6 +343,9 @@ server {
proxy_set_header X-Forwarded-Path $upstream_x_forwarded_path;
proxy_set_header X-Forwarded-Prefix $upstream_x_forwarded_prefix;
proxy_set_header X-Real-IP $remote_addr;
> if enabled_headers_upstream["X-Kong-Request-Id"] then
proxy_set_header X-Kong-Request-Id $kong_request_id;
> end
proxy_pass_header Server;
proxy_pass_header Date;
proxy_ssl_name $upstream_host;
Expand Down

0 comments on commit 6ecbad0

Please sign in to comment.