Skip to content

Commit

Permalink
Merge branch 'upstream' into origin
Browse files Browse the repository at this point in the history
* upstream: (52 commits)
  feat: add kubernetes discovery module (apache#4880)
  docs: fix For L7 proxy -> For L4 proxy (apache#6423)
  fix(deps): upgrade jsonschema to 0.9.8 (apache#6407)
  docs: translate Chinese to English in en clickhouse-logger (apache#6416)
  docs: add zh proxy-control.md&modify other doc error (apache#6346)
  docs: update public API relative usage (apache#6318)
  docs(cn): remove datadog from sidebar & fix doc lint conf (apache#6411)
  fix(request-validation): should not limit the urlencoded post args number (apache#6396)
  docs: fix configuration file typo (apache#6395)
  docs(extern-plugin): the implementation of runner (apache#6336)
  docs: polishing skywalking-logger plugin's docs (apache#6377)
  doc: adjust the directory structure of observability's documents (apache#6391)
  change(admin): empty nodes should be encoded as array (apache#6384)
  fix: should not limit the header number (apache#6379)
  ci: remove unnecessary tmate action (apache#6367)
  fix(opentelemetry): batch_span_processor export zero length spans (apache#6349)
  feat(graphql): support http get and post json request (apache#6343)
  feat: support for configuring the number of etcd health check retries (apache#6322)
  feat(wasm): support getting request body (apache#6325)
  fix(hmac-auth): hmac-auth plugin sort array param (apache#6314)
  ...
  • Loading branch information
Boolean committed Feb 23, 2022
2 parents e908d0a + f7b50f2 commit c58d084
Show file tree
Hide file tree
Showing 140 changed files with 5,271 additions and 532 deletions.
1 change: 1 addition & 0 deletions .asf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ github:
protected_branches:
master:
required_pull_request_reviews:
dismiss_stale_reviews: true
require_code_owner_reviews: true
required_approving_review_count: 2
release/2.12:
Expand Down
19 changes: 19 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: "Feature request"
description: Ask for a new feature or an improvement of an existing one
title: "feat: As a User, I want to ... so that ..."
body:
- type: markdown
attributes:
value: |
The more information you fill in, the better we can help you.
- Please use English on public channel.
- Encourage using words rather than pictures to describe your demand.
- Encourage pre-searching with keywords in the issue.
- type: textarea
id: description
attributes:
label: Issue description
description: Provide a clear and concise description of what you want.
validations:
required: true
1 change: 0 additions & 1 deletion .github/actions/action-tmate
Submodule action-tmate deleted from 079a16
10 changes: 5 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ jobs:
submodules: recursive

- name: Setup Go
uses: actions/setup-go@v2.1.5
uses: actions/setup-go@v2.2.0
with:
go-version: "1.15"
go-version: "1.17"

- name: Cache deps
uses: actions/cache@v2.1.7
Expand Down Expand Up @@ -79,7 +79,7 @@ jobs:
run: sudo apt install -y cpanminus build-essential libncurses5-dev libreadline-dev libssl-dev perl libpcre3 libpcre3-dev libldap2-dev

- name: Build wasm code
if: startsWith(matrix.os_name, 'linux_openresty')
if: matrix.os_name == 'linux_openresty'
run: |
export TINYGO_VER=0.20.0
wget https://github.com/tinygo-org/tinygo/releases/download/v${TINYGO_VER}/tinygo_${TINYGO_VER}_amd64.deb 2>/dev/null
Expand All @@ -100,8 +100,8 @@ jobs:
- name: Linux Install
run: |
sudo --preserve-env=OPENRESTY_VERSION \
./ci/${{ matrix.os_name }}_runner.sh do_install
sudo --preserve-env=OPENRESTY_VERSION \
./ci/${{ matrix.os_name }}_runner.sh do_install
- name: Linux Script
run: sudo ./ci/${{ matrix.os_name }}_runner.sh script
8 changes: 1 addition & 7 deletions .github/workflows/chaos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
submodules: recursive

- name: Setup go
uses: actions/setup-go@v2.1.5
uses: actions/setup-go@v2.2.0
with:
go-version: "1.16"

Expand Down Expand Up @@ -84,9 +84,3 @@ jobs:
- name: Run test
working-directory: ./t/chaos
run: ginkgo -r --v --progress --trace

# Debug via SSH if previous steps failed
- name: Set up tmate session
if: ${{ failure() }}
uses: ./.github/actions/action-tmate
timeout-minutes: 15
1 change: 1 addition & 0 deletions .github/workflows/doc-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
pull_request:
branches: [master, 'release/**']
paths:
- 'docs/**'
- '**/*.md'

jobs:
Expand Down
90 changes: 90 additions & 0 deletions .github/workflows/kubernetes-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
name: CI Kubernetes

on:
push:
branches: [ master, 'release/**' ]
paths-ignore:
- 'docs/**'
- '**/*.md'
pull_request:
branches: [ master, 'release/**' ]
paths-ignore:
- 'docs/**'
- '**/*.md'

concurrency:
group: ${{ github.workflow }}-${{ github.ref == 'refs/heads/master' && github.run_number || github.ref }}
cancel-in-progress: true

jobs:
kubernetes-discovery:
strategy:
fail-fast: false
matrix:
platform:
- ubuntu-18.04
os_name:
- linux_openresty
- linux_openresty_1_17

runs-on: ${{ matrix.platform }}
timeout-minutes: 15
env:
SERVER_NAME: ${{ matrix.os_name }}
OPENRESTY_VERSION: default

steps:
- name: Check out code
uses: actions/checkout@v2.4.0
with:
submodules: recursive

- name: Extract branch name
if: ${{ startsWith(github.ref, 'refs/heads/release/') }}
id: branch_env
shell: bash
run: |
echo "##[set-output name=version;]$(echo ${GITHUB_REF##*/})"
- name: Setup kubernetes cluster
run: |
KIND_VERSION="v0.11.1"
KUBECTL_VERSION="v1.22.0"
curl -Lo ./kind "https://kind.sigs.k8s.io/dl/${KIND_VERSION}/kind-$(uname)-amd64"
curl -Lo ./kubectl "https://dl.k8s.io/release/${KUBECTL_VERSION}/bin/linux/amd64/kubectl"
chmod +x ./kind
chmod +x ./kubectl
./kind create cluster --name apisix-test --config ./t_kubernetes/configs/kind.yaml
./kubectl wait --for=condition=Ready nodes --all --timeout=180s
./kubectl apply -f ./t_kubernetes/configs/account.yaml
./kubectl apply -f ./t_kubernetes/configs/endpoint.yaml
KUBERNETES_CLIENT_TOKEN_CONTENT=$(./kubectl get secrets | grep apisix-test | awk '{system("./kubectl get secret -o jsonpath={.data.token} "$1" | base64 --decode")}')
KUBERNETES_CLIENT_TOKEN_DIR="/tmp/var/run/secrets/kubernetes.io/serviceaccount"
KUBERNETES_CLIENT_TOKEN_FILE=${KUBERNETES_CLIENT_TOKEN_DIR}/token
mkdir -p ${KUBERNETES_CLIENT_TOKEN_DIR}
echo -n "$KUBERNETES_CLIENT_TOKEN_CONTENT" > ${KUBERNETES_CLIENT_TOKEN_FILE}
echo 'KUBERNETES_SERVICE_HOST=127.0.0.1'
echo 'KUBERNETES_SERVICE_PORT=6443'
echo 'KUBERNETES_CLIENT_TOKEN='"${KUBERNETES_CLIENT_TOKEN_CONTENT}"
echo 'KUBERNETES_CLIENT_TOKEN_FILE='${KUBERNETES_CLIENT_TOKEN_FILE}
./kubectl proxy -p 6445 &
- name: Linux Install
run: |
sudo apt install -y cpanminus build-essential libncurses5-dev libreadline-dev libssl-dev perl libpcre3 libpcre3-dev libldap2-dev
sudo cpanm --notest Test::Nginx >build.log 2>&1 || (cat build.log && exit 1)
sudo --preserve-env=OPENRESTY_VERSION ./ci/${{ matrix.os_name }}_runner.sh do_install
- name: Run test cases
run: |
./ci/kubernetes-ci.sh run_case
62 changes: 62 additions & 0 deletions .github/workflows/performance.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Performance Test

on:
pull_request:
branches: [master, 'release/**']
paths-ignore:
- 'docs/**'
- '**/*.md'

jobs:
performance:
if: github.event_name == 'pull_request' && github.event.label.name == 'performance'
runs-on: ubuntu-18.04
timeout-minutes: 45

steps:
- name: Check out code
uses: actions/checkout@v2.4.0
with:
submodules: recursive

- name: Cache deps
uses: actions/cache@v2.1.7
env:
cache-name: cache-deps
with:
path: deps
key: ${{ runner.os }}-${{ env.cache-name }}-${{ matrix.os_name }}-${{ hashFiles('rockspec/apisix-master-0.rockspec') }}

- name: Install Dependencies
run: sudo ./ci/performance_test.sh install_dependencies

- name: Install wrk2
run: sudo ./ci/performance_test.sh install_wrk2

- name: Install SystemTap Tools
run: sudo ./ci/performance_test.sh install_stap_tools

- name: Perf Test
run: ./ci/performance_test.sh run_performance_test

- name: Upload Performance Test Result
uses: actions/upload-artifact@v2
with:
name: perf.txt
path: |
output/performance.txt
retention-days: 3

- name: Upload flamegrpah
uses: actions/upload-artifact@v2
with:
name: flamegraph.svg
path: |
output/flamegraph.svg
retention-days: 3

# you can view the generated flamegraph by
# 1. open https://github.com/apache/apisix/actions
# 2. click the "Performance Test" button
# 3. choose the workflows that belong to your commits
# we need a way to have this address automatically appear in the comments of the PR running this workflow.
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
[submodule "t/toolkit"]
path = t/toolkit
url = https://github.com/api7/test-toolkit.git
[submodule ".github/actions/action-tmate"]
path = .github/actions/action-tmate
url = https://github.com/mxschmitt/action-tmate
[submodule "t/grpc_server_example"]
path = t/grpc_server_example
url = https://github.com/api7/grpc_server_example
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,5 +137,5 @@ If you have contributed to Apache APISIX, no matter it is a code contribution to

## Do you have questions about the source code?

- **QQ Group**: 578997126(recommended), 552030619
- **QQ Group**: 781365357(recommended), 578997126, 552030619
- Join in `apisix` channel at [Apache Slack](http://s.apache.org/slack-invite). If the link is not working, find the latest one at [Apache INFRA WIKI](https://cwiki.apache.org/confluence/display/INFRA/Slack+Guest+Invites).
8 changes: 5 additions & 3 deletions MAINTAIN.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,13 @@ via `VERSION=x.y.z make release-src`
7. Move the vote artifact to Apache's apisix repo
8. Register the release info in https://reporter.apache.org/addrelease.html?apisix
9. Create a [GitHub release](https://github.com/apache/apisix/releases/tag/2.10.2) from the minor branch
10. Update [APISIX's website](https://github.com/apache/apisix-website/commit/f9104bdca50015722ab6e3714bbcd2d17e5c5bb3)
10. Update [APISIX's website](https://github.com/apache/apisix-website/commit/f9104bdca50015722ab6e3714bbcd2d17e5c5bb3) if the version number is the largest
11. Update APISIX rpm package
> Go to [apisix-build-tools](https://github.com/api7/apisix-build-tools) repository and create a new tag named `apisix-${x.y.z}` to automatically submit the
package to yum repo
12. Update [APISIX docker](https://github.com/apache/apisix-docker/commit/829d45559c303bea7edde5bebe9fcf4938071601) in [APISIX docker repository](https://github.com/apache/apisix-docker), and create new branch from master, named as `release/apisix-${version}`, e.g. `release/apisix-2.10.2`
13. Send the [ANNOUNCE email](https://lists.apache.org/thread.html/ree7b06e6eac854fd42ba4f302079661a172f514a92aca2ef2f1aa7bb%40%3Cdev.apisix.apache.org%3E) to dev@apisix.apache.org & announce@apache.org
13. Update [APISIX helm chart](https://github.com/apache/apisix-helm-chart/pull/234) if the version number is the largest
14. Send the [ANNOUNCE email](https://lists.apache.org/thread.html/ree7b06e6eac854fd42ba4f302079661a172f514a92aca2ef2f1aa7bb%40%3Cdev.apisix.apache.org%3E) to dev@apisix.apache.org & announce@apache.org

### Release minor version

Expand All @@ -57,4 +58,5 @@ via `VERSION=x.y.z make release-src`
10. Update APISIX rpm package.
> Go to [apisix-build-tools](https://github.com/api7/apisix-build-tools) repository and create a new tag named `apisix-${x.y.z}` to automatically submit the rpm package to yum repo
11. Update [APISIX docker](https://github.com/apache/apisix-docker/commit/829d45559c303bea7edde5bebe9fcf4938071601) in [APISIX docker repository](https://github.com/apache/apisix-docker), and create new branch from master, named as `release/apisix-${version}`, e.g. `release/apisix-2.10.2`
12. Send the [ANNOUNCE email](https://lists.apache.org/thread/4s4msqwl1tq13p9dnv3hx7skbgpkozw1) to dev@apisix.apache.org & announce@apache.org
12. Update [APISIX helm chart](https://github.com/apache/apisix-helm-chart/pull/234)
13. Send the [ANNOUNCE email](https://lists.apache.org/thread/4s4msqwl1tq13p9dnv3hx7skbgpkozw1) to dev@apisix.apache.org & announce@apache.org
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -284,11 +284,12 @@ install: runtime

$(ENV_INSTALL) -d $(ENV_INST_LUADIR)/apisix/discovery
$(ENV_INSTALL) apisix/discovery/*.lua $(ENV_INST_LUADIR)/apisix/discovery/
$(ENV_INSTALL) -d $(ENV_INST_LUADIR)/apisix/discovery/{consul_kv,dns,eureka,nacos}
$(ENV_INSTALL) -d $(ENV_INST_LUADIR)/apisix/discovery/{consul_kv,dns,eureka,nacos,kubernetes}
$(ENV_INSTALL) apisix/discovery/consul_kv/*.lua $(ENV_INST_LUADIR)/apisix/discovery/consul_kv
$(ENV_INSTALL) apisix/discovery/dns/*.lua $(ENV_INST_LUADIR)/apisix/discovery/dns
$(ENV_INSTALL) apisix/discovery/eureka/*.lua $(ENV_INST_LUADIR)/apisix/discovery/eureka
$(ENV_INSTALL) apisix/discovery/nacos/*.lua $(ENV_INST_LUADIR)/apisix/discovery/nacos
$(ENV_INSTALL) apisix/discovery/kubernetes/*.lua $(ENV_INST_LUADIR)/apisix/discovery/kubernetes

$(ENV_INSTALL) -d $(ENV_INST_LUADIR)/apisix/http
$(ENV_INSTALL) apisix/http/*.lua $(ENV_INST_LUADIR)/apisix/http/
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ The technical architecture of Apache APISIX:
## Community

- Mailing List: Mail to dev-subscribe@apisix.apache.org, follow the reply to subscribe to the mailing list.
- QQ Group - 578997126
- QQ Group - 781365357
- Slack Workspace - Please [subscribe the mailing list](https://apisix.apache.org/docs/general/subscribe-guide) then ask for invitation link
- ![Twitter Follow](https://img.shields.io/twitter/follow/ApacheAPISIX?style=social) - follow and interact with us using hashtag `#ApacheAPISIX`
- [bilibili video](https://space.bilibili.com/551921247)
Expand Down
4 changes: 3 additions & 1 deletion apisix/cli/etcd.lua
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,9 @@ function _M.init(env, args)

local res, err
local retry_time = 0
while retry_time < 2 do

local health_check_retry = tonumber(yaml_conf.etcd.health_check_retry) or 2
while retry_time < health_check_retry do
res, err = request(version_url, yaml_conf)
-- In case of failure, request returns nil followed by an error message.
-- Else the first return value is the response body
Expand Down
4 changes: 4 additions & 0 deletions apisix/cli/ngx_tpl.lua
Original file line number Diff line number Diff line change
Expand Up @@ -587,6 +587,10 @@ http {
set $ctx_ref '';
set $from_error_page '';
{% if wasm then %}
set $wasm_process_req_body '';
{% end %}
# http server location configuration snippet starts
{% if http_server_location_configuration_snippet then %}
{* http_server_location_configuration_snippet *}
Expand Down
5 changes: 4 additions & 1 deletion apisix/core/config_etcd.lua
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,10 @@ local function _automatic_fetch(premature, self)
end
end

ngx_sleep(self.resync_delay + rand() * 0.5 * self.resync_delay)
-- etcd watch timeout is an expected error, so there is no need for resync_delay
if err ~= "timeout" then
ngx_sleep(self.resync_delay + rand() * 0.5 * self.resync_delay)
end
elseif not ok then
-- no error. reentry the sync with different state
ngx_sleep(0.05)
Expand Down

0 comments on commit c58d084

Please sign in to comment.