Skip to content

Commit 8ae1f23

Browse files
authored
feat: support kubernetes 1.18 (#220)
1 parent 33d3cac commit 8ae1f23

31 files changed

+3437
-448
lines changed

.github/workflows/e2e-test-k8s.yml

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
name: E2E Test For Kubernetes
19+
20+
on:
21+
push:
22+
branches:
23+
- master
24+
- release-v2-dev
25+
pull_request:
26+
branches:
27+
- master
28+
- release-v2-dev
29+
30+
concurrency:
31+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
32+
cancel-in-progress: true
33+
34+
jobs:
35+
e2e-test:
36+
strategy:
37+
matrix:
38+
cases_subset:
39+
- v2
40+
runs-on: buildjet-2vcpu-ubuntu-2004
41+
steps:
42+
- name: Checkout
43+
uses: actions/checkout@v2
44+
with:
45+
submodules: recursive
46+
47+
- name: Setup Go Env
48+
uses: actions/setup-go@v4
49+
with:
50+
go-version: "1.23"
51+
52+
- name: Install kind
53+
run: |
54+
go install sigs.k8s.io/[email protected]
55+
56+
- name: Install Helm
57+
run: |
58+
curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3
59+
chmod 700 get_helm.sh
60+
./get_helm.sh
61+
62+
- name: Login to Registry
63+
uses: docker/login-action@v1
64+
with:
65+
registry: ${{ secrets.DOCKER_REGISTRY }}
66+
username: ${{ secrets.DOCKER_USERNAME }}
67+
password: ${{ secrets.DOCKER_PASSWORD }}
68+
69+
- name: Login to Private Registry
70+
uses: docker/login-action@v1
71+
with:
72+
registry: hkccr.ccs.tencentyun.com
73+
username: ${{ secrets.PRIVATE_DOCKER_USERNAME }}
74+
password: ${{ secrets.PRIVATE_DOCKER_PASSWORD }}
75+
76+
- name: Launch Kind Cluster
77+
env:
78+
KIND_NODE_IMAGE: kindest/node:v1.18.20@sha256:38a8726ece5d7867fb0ede63d718d27ce2d41af519ce68be5ae7fcca563537ed
79+
run: |
80+
make kind-up
81+
82+
- name: Build images
83+
env:
84+
TAG: dev
85+
ARCH: amd64
86+
ENABLE_PROXY: "false"
87+
BASE_IMAGE_TAG: "debug"
88+
run: |
89+
echo "building images..."
90+
make build-image
91+
92+
- name: Extract adc binary
93+
run: |
94+
echo "Extracting adc binary..."
95+
docker create --name adc-temp api7/api7-ingress-controller:dev
96+
docker cp adc-temp:/bin/adc /usr/local/bin/adc
97+
docker rm adc-temp
98+
chmod +x /usr/local/bin/adc
99+
echo "ADC binary extracted to /usr/local/bin/adc"
100+
101+
- name: Install v2 CRDs
102+
run: |
103+
make install-crds-nocel
104+
105+
- name: Download API7EE3 Chart
106+
run: |
107+
make download-api7ee3-chart
108+
109+
- name: Loading Docker Image to Kind Cluster
110+
run: |
111+
make kind-load-images
112+
113+
- name: Run E2E test suite
114+
shell: bash
115+
env:
116+
API7_EE_LICENSE: ${{ secrets.API7_EE_LICENSE }}
117+
PROVIDER_TYPE: api7ee
118+
TEST_LABEL: ${{ matrix.cases_subset }}
119+
INGRESS_VERSION: v1beta1
120+
TEST_ENV: CI
121+
run: |
122+
make e2e-test

Makefile

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ IMG ?= api7/api7-ingress-controller:$(IMAGE_TAG)
2727
# ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary.
2828
ENVTEST_K8S_VERSION = 1.30.0
2929
KIND_NAME ?= apisix-ingress-cluster
30+
KIND_NODE_IMAGE ?= kindest/node:v1.30.0@sha256:047357ac0cfea04663786a612ba1eaba9702bef25227a794b52890dd8bcd692e
3031

3132
GATEAY_API_VERSION ?= v1.2.0
3233
DASHBOARD_VERSION ?= dev
@@ -44,6 +45,8 @@ CRD_DOCS_CONFIG ?= docs/assets/crd/config.yaml
4445
CRD_DOCS_OUTPUT ?= docs/en/latest/reference/api-reference.md
4546
CRD_DOCS_TEMPLATE ?= docs/assets/template
4647

48+
INGRESS_VERSION ?= v1
49+
4750
export KUBECONFIG = /tmp/$(KIND_NAME).kubeconfig
4851

4952
# go
@@ -169,7 +172,7 @@ lint-fix: golangci-lint ## Run golangci-lint linter and perform fixes
169172
.PHONY: kind-up
170173
kind-up:
171174
@kind get clusters 2>&1 | grep -v $(KIND_NAME) \
172-
&& kind create cluster --name $(KIND_NAME) \
175+
&& kind create cluster --name $(KIND_NAME) --image $(KIND_NODE_IMAGE) \
173176
|| echo "kind cluster already exists"
174177
@kind get kubeconfig --name $(KIND_NAME) > $$KUBECONFIG
175178
kubectl wait --for=condition=Ready nodes --all
@@ -300,6 +303,10 @@ uninstall-gateway-api: ## Uninstall Gateway API CRDs from the K8s cluster specif
300303
install: manifests kustomize install-gateway-api ## Install CRDs into the K8s cluster specified in ~/.kube/config.
301304
$(KUSTOMIZE) build config/crd | $(KUBECTL) apply -f -
302305

306+
.PHONY: install-crds-nocel
307+
install-crds-nocel:
308+
kubectl apply -f config/crd-nocel
309+
303310
.PHONY: uninstall
304311
uninstall: manifests kustomize ## Uninstall CRDs from the K8s cluster specified in ~/.kube/config. Call with ignore-not-found=true to ignore resource not found errors during deletion.
305312
$(KUSTOMIZE) build config/crd | $(KUBECTL) delete --ignore-not-found=$(ignore-not-found) -f -

0 commit comments

Comments
 (0)