Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
130 changes: 130 additions & 0 deletions .github/workflows/e2e-test-k8s.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

name: E2E Test For Kubernetes

on:
push:
branches:
- master
- release-v2-dev
pull_request:
branches:
- master
- release-v2-dev

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
prepare:
name: Prepare
runs-on: buildjet-2vcpu-ubuntu-1804
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup Go Env
id: go
uses: actions/setup-go@v4
with:
go-version: "1.23"

- name: Install kind
run: |
go install sigs.k8s.io/[email protected]

- name: Install Helm
run: |
curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3
chmod 700 get_helm.sh
./get_helm.sh

e2e-test:
needs:
- prepare
runs-on: buildjet-2vcpu-ubuntu-1804
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive

- name: Setup Go Env
uses: actions/setup-go@v4
with:
go-version: "1.23"

- name: Login to Registry
uses: docker/login-action@v1
with:
registry: ${{ secrets.DOCKER_REGISTRY }}
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Login to Private Registry
uses: docker/login-action@v1
with:
registry: hkccr.ccs.tencentyun.com
username: ${{ secrets.PRIVATE_DOCKER_USERNAME }}
password: ${{ secrets.PRIVATE_DOCKER_PASSWORD }}

- name: Build images
env:
TAG: dev
ARCH: amd64
ENABLE_PROXY: "false"
BASE_IMAGE_TAG: "debug"
run: |
echo "building images..."
make build-image

- name: Extract adc binary
run: |
echo "Extracting adc binary..."
docker create --name adc-temp api7/api7-ingress-controller:dev
docker cp adc-temp:/bin/adc /usr/local/bin/adc
docker rm adc-temp
chmod +x /usr/local/bin/adc
echo "ADC binary extracted to /usr/local/bin/adc"

- name: Launch Kind Cluster
env:
KIND_NODE_IMAGE: kindest/node:v1.18.20@sha256:38a8726ece5d7867fb0ede63d718d27ce2d41af519ce68be5ae7fcca563537ed
run: |
make kind-up

- name: Install Gateway API And CRDs
run: |
make install

- name: Download API7EE3 Chart
run: |
make download-api7ee3-chart

- name: Loading Docker Image to Kind Cluster
run: |
make kind-load-images

- name: Run E2E test suite
shell: bash
env:
API7_EE_LICENSE: ${{ secrets.API7_EE_LICENSE }}
PROVIDER_TYPE: api7ee
run: |
make e2e-test
2 changes: 1 addition & 1 deletion .github/workflows/e2e-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ jobs:
e2e-test:
needs:
- prepare
runs-on: buildjet-4vcpu-ubuntu-2204
runs-on: buildjet-2vcpu-ubuntu-1804
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ IMG ?= api7/api7-ingress-controller:$(IMAGE_TAG)
# ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary.
ENVTEST_K8S_VERSION = 1.30.0
KIND_NAME ?= apisix-ingress-cluster
KIND_NODE_IMAGE ?= kindest/node:v1.30.0@sha256:047357ac0cfea04663786a612ba1eaba9702bef25227a794b52890dd8bcd692e

GATEAY_API_VERSION ?= v1.2.0
DASHBOARD_VERSION ?= dev
Expand Down Expand Up @@ -169,7 +170,7 @@ lint-fix: golangci-lint ## Run golangci-lint linter and perform fixes
.PHONY: kind-up
kind-up:
@kind get clusters 2>&1 | grep -v $(KIND_NAME) \
&& kind create cluster --name $(KIND_NAME) \
&& kind create cluster --name $(KIND_NAME) --image $(KIND_NODE_IMAGE) \
|| echo "kind cluster already exists"
@kind get kubeconfig --name $(KIND_NAME) > $$KUBECONFIG
kubectl wait --for=condition=Ready nodes --all
Expand Down
Loading