Skip to content
Merged
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
2 changes: 1 addition & 1 deletion .github/workflows/apisix-conformance-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ jobs:
go install sigs.k8s.io/[email protected]

- name: Login to Registry
uses: docker/login-action@v1
uses: docker/login-action@v3
with:
registry: ${{ secrets.DOCKER_REGISTRY }}
username: ${{ secrets.DOCKER_USERNAME }}
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/apisix-e2e-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,16 @@ jobs:
go install sigs.k8s.io/[email protected]
- name: Login to Registry
uses: docker/login-action@v1
uses: docker/login-action@v3
with:
registry: ${{ secrets.DOCKER_REGISTRY }}
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Install ginkgo
run: |
make install-ginkgo
- name: Build images
env:
TAG: dev
Expand Down Expand Up @@ -103,4 +107,4 @@ jobs:
TEST_LABEL: ${{ matrix.cases_subset }}
TEST_ENV: CI
run: |
make e2e-test
make ginkgo-e2e-test
4 changes: 2 additions & 2 deletions .github/workflows/conformance-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,14 @@ jobs:
with:
go-version: "1.23"
- name: Login to Registry
uses: docker/login-action@v1
uses: docker/login-action@v3
with:
registry: ${{ secrets.DOCKER_REGISTRY }}
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Login to Private Registry
uses: docker/login-action@v1
uses: docker/login-action@v3
with:
registry: hkccr.ccs.tencentyun.com
username: ${{ secrets.PRIVATE_DOCKER_USERNAME }}
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/e2e-test-k8s.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# specific language governing permissions and limitations
# under the License.

name: E2E Test For Kubernetes
name: API7EE E2E Test For Kubernetes 1.18

on:
push:
Expand Down Expand Up @@ -57,14 +57,14 @@ jobs:
./get_helm.sh

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

- name: Login to Private Registry
uses: docker/login-action@v1
uses: docker/login-action@v3
with:
registry: hkccr.ccs.tencentyun.com
username: ${{ secrets.PRIVATE_DOCKER_USERNAME }}
Expand Down
35 changes: 13 additions & 22 deletions .github/workflows/e2e-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# specific language governing permissions and limitations
# under the License.

name: E2E Test
name: API7EE E2E Test

on:
push:
Expand All @@ -29,15 +29,21 @@ concurrency:
cancel-in-progress: true

jobs:
prepare:
name: Prepare
e2e-test:
strategy:
matrix:
cases_subset:
- apisix.apache.org
- networking.k8s.io
fail-fast: false
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive

- name: Setup Go Env
id: go
uses: actions/setup-go@v4
with:
go-version: "1.23"
Expand All @@ -51,31 +57,15 @@ jobs:
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: ubuntu-latest
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
uses: docker/login-action@v3
with:
registry: ${{ secrets.DOCKER_REGISTRY }}
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Login to Private Registry
uses: docker/login-action@v1
uses: docker/login-action@v3
with:
registry: hkccr.ccs.tencentyun.com
username: ${{ secrets.PRIVATE_DOCKER_USERNAME }}
Expand Down Expand Up @@ -121,6 +111,7 @@ jobs:
env:
API7_EE_LICENSE: ${{ secrets.API7_EE_LICENSE }}
PROVIDER_TYPE: api7ee
TEST_LABEL: ${{ matrix.cases_subset }}
TEST_ENV: CI
run: |
make e2e-test
2 changes: 1 addition & 1 deletion .github/workflows/push-docker-v2-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
# uses: docker/setup-buildx-action@v3

- name: Login to Registry
uses: docker/login-action@v1
uses: docker/login-action@v3
with:
registry: ${{ secrets.DOCKER_REGISTRY }}
username: ${{ secrets.DOCKER_USERNAME }}
Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ ADC_VERSION ?= 0.20.0
GINKGO_VERSION ?= 2.20.0
TEST_TIMEOUT ?= 80m
TEST_DIR ?= ./test/e2e/
E2E_NODES ?= 2
E2E_NODES ?= 4

# CRD Reference Documentation
CRD_REF_DOCS_VERSION ?= v0.1.0
Expand All @@ -49,7 +49,7 @@ INGRESS_VERSION ?= v1

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

# go
# go
VERSYM="github.com/apache/apisix-ingress-controller/internal/version._buildVersion"
GITSHASYM="github.com/apache/apisix-ingress-controller/internal/version._buildGitRevision"
BUILDOSSYM="github.com/apache/apisix-ingress-controller/internal/version._buildOS"
Expand Down Expand Up @@ -146,7 +146,7 @@ download-api7ee3-chart:

.PHONY: ginkgo-e2e-test
ginkgo-e2e-test:
@ginkgo -cover -coverprofile=coverage.txt -r --randomize-all --randomize-suites --trace --focus=$(E2E_FOCUS) --nodes=$(E2E_NODES) $(TEST_DIR)
@ginkgo -cover -coverprofile=coverage.txt -r --randomize-all --randomize-suites --trace --focus=$(E2E_FOCUS) --nodes=$(E2E_NODES) --label-filter="$(TEST_LABEL)" $(TEST_DIR)

.PHONY: install-ginkgo
install-ginkgo:
Expand Down
2 changes: 1 addition & 1 deletion internal/controller/apisixglobalrule_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ func (r *ApisixGlobalRuleReconciler) Reconcile(ctx context.Context, req ctrl.Req
// process IngressClass parameters if they reference GatewayProxy
if err := ProcessIngressClassParameters(tctx, r.Client, r.Log, &globalRule, ingressClass); err != nil {
r.Log.Error(err, "failed to process IngressClass parameters", "ingressClass", ingressClass.Name)
return ctrl.Result{}, err
return ctrl.Result{}, client.IgnoreNotFound(err)
}

// Sync the global rule to APISIX
Expand Down
4 changes: 2 additions & 2 deletions internal/controller/apisixtls_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ func (r *ApisixTlsReconciler) Reconcile(ctx context.Context, req ctrl.Request) (
Reason: string(apiv2.ConditionReasonInvalidSpec),
Message: err.Error(),
})
return ctrl.Result{}, err
return ctrl.Result{}, client.IgnoreNotFound(err)
}

// process ApisixTls validation
Expand All @@ -159,7 +159,7 @@ func (r *ApisixTlsReconciler) Reconcile(ctx context.Context, req ctrl.Request) (
Reason: string(apiv2.ConditionReasonInvalidSpec),
Message: err.Error(),
})
return ctrl.Result{}, err
return ctrl.Result{}, client.IgnoreNotFound(err)
}

if err := r.Provider.Update(ctx, tctx, &tls); err != nil {
Expand Down
21 changes: 17 additions & 4 deletions internal/controller/consumer_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package controller

import (
"context"
"fmt"

"github.com/go-logr/logr"
corev1 "k8s.io/api/core/v1"
Expand All @@ -36,6 +37,7 @@ import (
gatewayv1 "sigs.k8s.io/gateway-api/apis/v1"

"github.com/apache/apisix-ingress-controller/api/v1alpha1"
"github.com/apache/apisix-ingress-controller/internal/controller/config"
"github.com/apache/apisix-ingress-controller/internal/controller/indexer"
"github.com/apache/apisix-ingress-controller/internal/controller/status"
"github.com/apache/apisix-ingress-controller/internal/manager/readiness"
Expand Down Expand Up @@ -208,8 +210,10 @@ func (r *ConsumerReconciler) Reconcile(ctx context.Context, req ctrl.Request) (c

gateway, err := r.getGateway(ctx, consumer)
if err != nil {
r.Log.Error(err, "failed to get gateway", "consumer", consumer)
statusErr = err
r.Log.V(1).Info("no matching Gateway available",
"gatewayRef", consumer.Spec.GatewayRef,
"error", err.Error())
return ctrl.Result{}, nil
}

rk := utils.NamespacedNameKind(consumer)
Expand Down Expand Up @@ -295,8 +299,17 @@ func (r *ConsumerReconciler) getGateway(ctx context.Context, consumer *v1alpha1.
Name: consumer.Spec.GatewayRef.Name,
Namespace: ns,
}, gateway); err != nil {
r.Log.Error(err, "failed to get gateway", "gateway", consumer.Spec.GatewayRef.Name)
return nil, err
return nil, fmt.Errorf("failed to get gateway %s/%s: %w", ns, consumer.Spec.GatewayRef.Name, err)
}
gatewayClass := gatewayv1.GatewayClass{}
if err := r.Get(ctx, client.ObjectKey{
Name: string(gateway.Spec.GatewayClassName),
}, &gatewayClass); err != nil {
return nil, fmt.Errorf("failed to retrieve gatewayclass for gateway: %w", err)
}

if string(gatewayClass.Spec.ControllerName) != config.ControllerConfig.ControllerName {
return nil, fmt.Errorf("gateway %s/%s is not managed by this controller", gateway.Namespace, gateway.Name)
}
return gateway, nil
}
Expand Down
2 changes: 1 addition & 1 deletion internal/controller/ingressclass_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ func (r *IngressClassReconciler) Reconcile(ctx context.Context, req ctrl.Request

if err := ProcessIngressClassParameters(tctx, r.Client, r.Log, ingressClass, ingressClass); err != nil {
r.Log.Error(err, "failed to process infrastructure for ingressclass", "ingressclass", ingressClass.GetName())
return ctrl.Result{}, err
return ctrl.Result{}, client.IgnoreNotFound(err)
}

if err := r.Provider.Update(ctx, tctx, ingressClass); err != nil {
Expand Down
17 changes: 9 additions & 8 deletions test/conformance/apisix/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,7 @@ func TestMain(m *testing.M) {
f := framework.NewFramework()

// init newDeployer function
scaffold.NewDeployer = func(s *scaffold.Scaffold) scaffold.Deployer {
return scaffold.NewAPISIXDeployer(s)
}
scaffold.NewDeployer = scaffold.NewAPISIXDeployer

// Check and delete specific namespaces if they exist
kubectl := k8s.NewKubectlOptions("", "", "default")
Expand All @@ -140,13 +138,16 @@ func TestMain(m *testing.M) {
k8s.CreateNamespace(GinkgoT(), kubectl, namespace)
defer k8s.DeleteNamespace(GinkgoT(), kubectl, namespace)

s := scaffold.NewScaffold(&scaffold.Options{
ControllerName: "apisix.apache.org/apisix-ingress-controller",
adminkey := getEnvOrDefault("APISIX_ADMIN_KEY", "edd1c9f034335f136f87ad84b625c8f1")
controllerName := "apisix.apache.org/apisix-ingress-controller"
s := scaffold.NewScaffold(scaffold.Options{
ControllerName: controllerName,
SkipHooks: true,
APISIXAdminAPIKey: getEnvOrDefault("APISIX_ADMIN_KEY", "edd1c9f034335f136f87ad84b625c8f1"),
APISIXAdminAPIKey: adminkey,
})

s.Deployer.DeployDataplane(scaffold.DeployDataplaneOptions{
AdminKey: adminkey,
Namespace: namespace,
SkipCreateTunnels: true,
ServiceType: "LoadBalancer",
Expand All @@ -162,7 +163,7 @@ func TestMain(m *testing.M) {
address := svc.Status.LoadBalancer.Ingress[0].IP

f.DeployIngress(framework.IngressDeployOpts{
ControllerName: s.GetControllerName(),
ControllerName: controllerName,
Namespace: namespace,
StatusAddress: address,
InitSyncDelay: 20 * time.Minute,
Expand All @@ -174,7 +175,7 @@ func TestMain(m *testing.M) {

defaultGatewayProxyOpts = GatewayProxyOpts{
StatusAddress: address,
AdminKey: s.AdminKey(),
AdminKey: adminkey,
AdminEndpoint: adminEndpoint,
}

Expand Down
Loading
Loading