Skip to content
Merged
Show file tree
Hide file tree
Changes from 12 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
122 changes: 122 additions & 0 deletions .github/workflows/e2e-test-k8s.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
# 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:
e2e-test:
strategy:
matrix:
cases_subset:
- v2
runs-on: buildjet-2vcpu-ubuntu-2004
steps:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: recursive

- name: Setup Go Env
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

- 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: Launch Kind Cluster
env:
KIND_NODE_IMAGE: kindest/node:v1.18.20@sha256:38a8726ece5d7867fb0ede63d718d27ce2d41af519ce68be5ae7fcca563537ed
run: |
make kind-up

- 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: Install v2 CRDs
run: |
make install-crds-nocel

- 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
TEST_LABEL: ${{ matrix.cases_subset }}
INGRESS_VERSION: v1beta1
TEST_ENV: CI
run: |
make e2e-test
9 changes: 8 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 All @@ -44,6 +45,8 @@ CRD_DOCS_CONFIG ?= docs/assets/crd/config.yaml
CRD_DOCS_OUTPUT ?= docs/en/latest/reference/api-reference.md
CRD_DOCS_TEMPLATE ?= docs/assets/template

INGRESS_VERSION ?= v1

export KUBECONFIG = /tmp/$(KIND_NAME).kubeconfig

# go
Expand Down Expand Up @@ -169,7 +172,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 Expand Up @@ -300,6 +303,10 @@ uninstall-gateway-api: ## Uninstall Gateway API CRDs from the K8s cluster specif
install: manifests kustomize install-gateway-api ## Install CRDs into the K8s cluster specified in ~/.kube/config.
$(KUSTOMIZE) build config/crd | $(KUBECTL) apply -f -

.PHONY: install-crds-nocel
install-crds-nocel:
kubectl apply -f config/crd-nocel

.PHONY: uninstall
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.
$(KUSTOMIZE) build config/crd | $(KUBECTL) delete --ignore-not-found=$(ignore-not-found) -f -
Expand Down
Loading
Loading