forked from apache/apisix
-
Notifications
You must be signed in to change notification settings - Fork 0
85 lines (66 loc) · 2.56 KB
/
kubernetes-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
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
permissions:
contents: read
jobs:
kubernetes-discovery:
strategy:
fail-fast: false
matrix:
platform:
- ubuntu-20.04
os_name:
- linux_openresty
- linux_openresty_1_19
runs-on: ${{ matrix.platform }}
timeout-minutes: 15
env:
SERVER_NAME: ${{ matrix.os_name }}
OPENRESTY_VERSION: default
steps:
- name: Check out code
uses: actions/checkout@v3
with:
submodules: recursive
- 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 ./ci/${{ matrix.os_name }}_runner.sh before_install
sudo --preserve-env=OPENRESTY_VERSION ./ci/${{ matrix.os_name }}_runner.sh do_install
- name: Run test cases
run: |
./ci/kubernetes-ci.sh run_case