Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add kubernetes discovery module #4880

Merged
merged 78 commits into from
Feb 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
78 commits
Select commit Hold shift + click to select a range
aaa2642
feat: add k8s discovery module
Aug 23, 2021
5a351d1
feat: add k8s discovery module
Sep 5, 2021
77dd742
feat: add k8s discovery module
Sep 6, 2021
45e1bcd
feat: add k8s discovery module
Sep 6, 2021
8042718
feat: add k8s discovery module
Sep 6, 2021
2694c7f
feat: add k8s discovery module
Sep 7, 2021
046b65c
feat: add k8s discovery module
Sep 8, 2021
99aef06
feat: add k8s discovery module
Sep 8, 2021
276705a
feat: add k8s discovery module
Sep 8, 2021
9cbe29a
feat: add k8s discovery module
Sep 19, 2021
3f5dbfd
Merge branch 'apache:master' into master
Sep 19, 2021
a1d9b8e
feat: add k8s discovery module
Sep 19, 2021
35ad639
feat: add k8s discovery module
Sep 19, 2021
f665734
feat: add k8s discovery module
Sep 20, 2021
1610ab4
Merge remote-tracking branch 'upstream/master'
Jan 10, 2022
76a9cf0
Merge branch 'apache:master' into master
zhixiongdu027 Jan 10, 2022
55ebf1c
Merge remote-tracking branch 'upstream/master'
Jan 10, 2022
3b6eac2
Merge remote-tracking branch 'upstream/master'
Jan 10, 2022
ef8306e
Merge remote-tracking branch 'upstream/master'
Jan 10, 2022
8b39f73
Merge remote-tracking branch 'upstream/master'
Jan 10, 2022
004d99d
Merge remote-tracking branch 'upstream/master'
Jan 10, 2022
3e8b434
Merge remote-tracking branch 'upstream/master'
Jan 10, 2022
786d53b
Merge remote-tracking branch 'upstream/master'
Jan 10, 2022
769ad8f
Merge remote-tracking branch 'upstream/master'
Jan 11, 2022
fdee535
feat: add kubernetes discovery module
Jan 12, 2022
8827eac
Merge branch 'apache:master' into master
zhixiongdu027 Jan 12, 2022
46c8180
feat: add kubernetes discovery module
Jan 12, 2022
3ab6747
feat: add kubernetes discovery module
Jan 12, 2022
6453889
feat: add kubernetes discovery module
Jan 12, 2022
d9ef136
feat: add kubernetes discovery module
Jan 12, 2022
5903685
feat: add kubernetes discovery module
Jan 12, 2022
4cf63f3
feat: add kubernetes discovery module
Jan 12, 2022
34e2ebb
feat: add kubernetes discovery module
Jan 12, 2022
b05f7eb
feat: add kubernetes discovery module
Jan 12, 2022
dbc5ca4
feat: add kubernetes discovery module
Jan 12, 2022
29daca1
feat: add kubernetes discovery module
Jan 12, 2022
5a45fdd
feat: add kubernetes discovery module
Jan 12, 2022
d0bccc8
Merge branch 'apache:master' into master
zhixiongdu027 Jan 30, 2022
e0f893f
feat: add kubernetes discovery module
zhixiongdu027 Feb 1, 2022
016a049
feat: add kubernetes discovery module
zhixiongdu027 Feb 1, 2022
4d69480
feat: add kubernetes discovery module
zhixiongdu027 Feb 1, 2022
2ff105d
feat: add kubernetes discovery module
zhixiongdu027 Feb 1, 2022
a8bf021
feat: add kubernetes discovery module
zhixiongdu027 Feb 1, 2022
58095a5
feat: add kubernetes discovery module
zhixiongdu027 Feb 1, 2022
3bfc395
feat: add kubernetes discovery module
zhixiongdu027 Feb 1, 2022
920e849
feat: add kubernetes discovery module
zhixiongdu027 Feb 1, 2022
f0b520f
feat: add kubernetes discovery module
zhixiongdu027 Feb 1, 2022
72a7c36
feat: add kubernetes discovery module
zhixiongdu027 Feb 1, 2022
7e4876b
feat: add kubernetes discovery module
zhixiongdu027 Feb 1, 2022
9d7055f
feat: add kubernetes discovery module
zhixiongdu027 Feb 1, 2022
647bcf1
feat: add kubernetes discovery module
zhixiongdu027 Feb 1, 2022
56e32d6
feat: add kubernetes discovery module
zhixiongdu027 Feb 1, 2022
51857a1
feat: add kubernetes discovery module
zhixiongdu027 Feb 1, 2022
0b9a708
feat: add kubernetes discovery module
zhixiongdu027 Feb 1, 2022
c4791a4
feat: add kubernetes discovery module
zhixiongdu027 Feb 2, 2022
3e3bb97
feat: add kubernetes discovery module
zhixiongdu027 Feb 2, 2022
d68ceb3
feat: add kubernetes discovery module
zhixiongdu027 Feb 2, 2022
5ba1f75
feat: add kubernetes discovery module
zhixiongdu027 Feb 2, 2022
eec2cfe
feat: add kubernetes discovery module
zhixiongdu027 Feb 2, 2022
f74a45a
feat: add kubernetes discovery module
zhixiongdu027 Feb 2, 2022
b3bed5f
feat: add kubernetes discovery module
zhixiongdu027 Feb 2, 2022
fe030ba
feat: add kubernetes discovery module
zhixiongdu027 Feb 2, 2022
6552848
feat: add kubernetes discovery module
zhixiongdu027 Feb 2, 2022
06442ac
feat: add kubernetes discovery module
zhixiongdu027 Feb 2, 2022
7b4523c
feat: add kubernetes discovery module
zhixiongdu027 Feb 2, 2022
329782a
feat: add kubernetes discovery module
zhixiongdu027 Feb 2, 2022
ab81437
feat: add kubernetes discovery module
zhixiongdu027 Feb 5, 2022
871e429
feat: add kubernetes discovery module
zhixiongdu027 Feb 5, 2022
8f3d9b2
feat: add kubernetes discovery module
zhixiongdu027 Feb 5, 2022
e4d9f05
feat: add kubernetes discovery module
Feb 6, 2022
1dd2c37
feat: add kubernetes discovery module
Feb 6, 2022
7849b8b
feat: add kubernetes discovery module
Feb 9, 2022
02ef870
feat: add kubernetes discovery module
Feb 9, 2022
fa017d2
feat: add kubernetes discovery module
Feb 14, 2022
57d7f91
feat: add kubernetes discovery module
Feb 14, 2022
5e85c1d
feat: add kubernetes discovery module
Feb 14, 2022
b2940ab
feat: add kubernetes discovery module
Feb 14, 2022
2276693
docs: improve kubernetes.md
zhixiongdu027 Feb 19, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -275,11 +275,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
Loading