Skip to content

Commit 9180318

Browse files
authored
backport: part 3 (#243)
1 parent 1d99fad commit 9180318

38 files changed

+1194
-1155
lines changed

.github/workflows/apisix-conformance-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ jobs:
5656
go install sigs.k8s.io/[email protected]
5757
5858
- name: Login to Registry
59-
uses: docker/login-action@v1
59+
uses: docker/login-action@v3
6060
with:
6161
registry: ${{ secrets.DOCKER_REGISTRY }}
6262
username: ${{ secrets.DOCKER_USERNAME }}

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,16 @@ jobs:
5757
go install sigs.k8s.io/[email protected]
5858
5959
- name: Login to Registry
60-
uses: docker/login-action@v1
60+
uses: docker/login-action@v3
6161
with:
6262
registry: ${{ secrets.DOCKER_REGISTRY }}
6363
username: ${{ secrets.DOCKER_USERNAME }}
6464
password: ${{ secrets.DOCKER_PASSWORD }}
6565

66+
- name: Install ginkgo
67+
run: |
68+
make install-ginkgo
69+
6670
- name: Build images
6771
env:
6872
TAG: dev
@@ -103,4 +107,4 @@ jobs:
103107
TEST_LABEL: ${{ matrix.cases_subset }}
104108
TEST_ENV: CI
105109
run: |
106-
make e2e-test
110+
make ginkgo-e2e-test

.github/workflows/conformance-test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,14 +69,14 @@ jobs:
6969
with:
7070
go-version: "1.23"
7171
- name: Login to Registry
72-
uses: docker/login-action@v1
72+
uses: docker/login-action@v3
7373
with:
7474
registry: ${{ secrets.DOCKER_REGISTRY }}
7575
username: ${{ secrets.DOCKER_USERNAME }}
7676
password: ${{ secrets.DOCKER_PASSWORD }}
7777

7878
- name: Login to Private Registry
79-
uses: docker/login-action@v1
79+
uses: docker/login-action@v3
8080
with:
8181
registry: hkccr.ccs.tencentyun.com
8282
username: ${{ secrets.PRIVATE_DOCKER_USERNAME }}

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# specific language governing permissions and limitations
1616
# under the License.
1717

18-
name: E2E Test For Kubernetes
18+
name: API7EE E2E Test For Kubernetes 1.18
1919

2020
on:
2121
push:
@@ -57,14 +57,14 @@ jobs:
5757
./get_helm.sh
5858
5959
- name: Login to Registry
60-
uses: docker/login-action@v1
60+
uses: docker/login-action@v3
6161
with:
6262
registry: ${{ secrets.DOCKER_REGISTRY }}
6363
username: ${{ secrets.DOCKER_USERNAME }}
6464
password: ${{ secrets.DOCKER_PASSWORD }}
6565

6666
- name: Login to Private Registry
67-
uses: docker/login-action@v1
67+
uses: docker/login-action@v3
6868
with:
6969
registry: hkccr.ccs.tencentyun.com
7070
username: ${{ secrets.PRIVATE_DOCKER_USERNAME }}

.github/workflows/e2e-test.yml

Lines changed: 13 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# specific language governing permissions and limitations
1616
# under the License.
1717

18-
name: E2E Test
18+
name: API7EE E2E Test
1919

2020
on:
2121
push:
@@ -29,15 +29,21 @@ concurrency:
2929
cancel-in-progress: true
3030

3131
jobs:
32-
prepare:
33-
name: Prepare
32+
e2e-test:
33+
strategy:
34+
matrix:
35+
cases_subset:
36+
- apisix.apache.org
37+
- networking.k8s.io
38+
fail-fast: false
3439
runs-on: ubuntu-latest
3540
steps:
3641
- name: Checkout
3742
uses: actions/checkout@v4
43+
with:
44+
submodules: recursive
3845

3946
- name: Setup Go Env
40-
id: go
4147
uses: actions/setup-go@v4
4248
with:
4349
go-version: "1.23"
@@ -51,31 +57,15 @@ jobs:
5157
curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3
5258
chmod 700 get_helm.sh
5359
./get_helm.sh
54-
55-
e2e-test:
56-
needs:
57-
- prepare
58-
runs-on: ubuntu-latest
59-
steps:
60-
- name: Checkout
61-
uses: actions/checkout@v4
62-
with:
63-
submodules: recursive
64-
65-
- name: Setup Go Env
66-
uses: actions/setup-go@v4
67-
with:
68-
go-version: "1.23"
69-
7060
- name: Login to Registry
71-
uses: docker/login-action@v1
61+
uses: docker/login-action@v3
7262
with:
7363
registry: ${{ secrets.DOCKER_REGISTRY }}
7464
username: ${{ secrets.DOCKER_USERNAME }}
7565
password: ${{ secrets.DOCKER_PASSWORD }}
7666

7767
- name: Login to Private Registry
78-
uses: docker/login-action@v1
68+
uses: docker/login-action@v3
7969
with:
8070
registry: hkccr.ccs.tencentyun.com
8171
username: ${{ secrets.PRIVATE_DOCKER_USERNAME }}
@@ -121,6 +111,7 @@ jobs:
121111
env:
122112
API7_EE_LICENSE: ${{ secrets.API7_EE_LICENSE }}
123113
PROVIDER_TYPE: api7ee
114+
TEST_LABEL: ${{ matrix.cases_subset }}
124115
TEST_ENV: CI
125116
run: |
126117
make e2e-test

.github/workflows/push-docker-v2-dev.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ jobs:
4444
# uses: docker/setup-buildx-action@v3
4545

4646
- name: Login to Registry
47-
uses: docker/login-action@v1
47+
uses: docker/login-action@v3
4848
with:
4949
registry: ${{ secrets.DOCKER_REGISTRY }}
5050
username: ${{ secrets.DOCKER_USERNAME }}

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ ADC_VERSION ?= 0.20.0
3636
GINKGO_VERSION ?= 2.20.0
3737
TEST_TIMEOUT ?= 80m
3838
TEST_DIR ?= ./test/e2e/
39-
E2E_NODES ?= 2
39+
E2E_NODES ?= 4
4040

4141
# CRD Reference Documentation
4242
CRD_REF_DOCS_VERSION ?= v0.1.0
@@ -49,7 +49,7 @@ INGRESS_VERSION ?= v1
4949

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

52-
# go
52+
# go
5353
VERSYM="github.com/apache/apisix-ingress-controller/internal/version._buildVersion"
5454
GITSHASYM="github.com/apache/apisix-ingress-controller/internal/version._buildGitRevision"
5555
BUILDOSSYM="github.com/apache/apisix-ingress-controller/internal/version._buildOS"
@@ -146,7 +146,7 @@ download-api7ee3-chart:
146146

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

151151
.PHONY: install-ginkgo
152152
install-ginkgo:

internal/controller/apisixglobalrule_controller.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ func (r *ApisixGlobalRuleReconciler) Reconcile(ctx context.Context, req ctrl.Req
9898
// process IngressClass parameters if they reference GatewayProxy
9999
if err := ProcessIngressClassParameters(tctx, r.Client, r.Log, &globalRule, ingressClass); err != nil {
100100
r.Log.Error(err, "failed to process IngressClass parameters", "ingressClass", ingressClass.Name)
101-
return ctrl.Result{}, err
101+
return ctrl.Result{}, client.IgnoreNotFound(err)
102102
}
103103

104104
// Sync the global rule to APISIX

internal/controller/apisixtls_controller.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ func (r *ApisixTlsReconciler) Reconcile(ctx context.Context, req ctrl.Request) (
145145
Reason: string(apiv2.ConditionReasonInvalidSpec),
146146
Message: err.Error(),
147147
})
148-
return ctrl.Result{}, err
148+
return ctrl.Result{}, client.IgnoreNotFound(err)
149149
}
150150

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

165165
if err := r.Provider.Update(ctx, tctx, &tls); err != nil {

internal/controller/consumer_controller.go

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ package controller
1919

2020
import (
2121
"context"
22+
"fmt"
2223

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

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

209211
gateway, err := r.getGateway(ctx, consumer)
210212
if err != nil {
211-
r.Log.Error(err, "failed to get gateway", "consumer", consumer)
212-
statusErr = err
213+
r.Log.V(1).Info("no matching Gateway available",
214+
"gatewayRef", consumer.Spec.GatewayRef,
215+
"error", err.Error())
216+
return ctrl.Result{}, nil
213217
}
214218

215219
rk := utils.NamespacedNameKind(consumer)
@@ -295,8 +299,17 @@ func (r *ConsumerReconciler) getGateway(ctx context.Context, consumer *v1alpha1.
295299
Name: consumer.Spec.GatewayRef.Name,
296300
Namespace: ns,
297301
}, gateway); err != nil {
298-
r.Log.Error(err, "failed to get gateway", "gateway", consumer.Spec.GatewayRef.Name)
299-
return nil, err
302+
return nil, fmt.Errorf("failed to get gateway %s/%s: %w", ns, consumer.Spec.GatewayRef.Name, err)
303+
}
304+
gatewayClass := gatewayv1.GatewayClass{}
305+
if err := r.Get(ctx, client.ObjectKey{
306+
Name: string(gateway.Spec.GatewayClassName),
307+
}, &gatewayClass); err != nil {
308+
return nil, fmt.Errorf("failed to retrieve gatewayclass for gateway: %w", err)
309+
}
310+
311+
if string(gatewayClass.Spec.ControllerName) != config.ControllerConfig.ControllerName {
312+
return nil, fmt.Errorf("gateway %s/%s is not managed by this controller", gateway.Namespace, gateway.Name)
300313
}
301314
return gateway, nil
302315
}

0 commit comments

Comments
 (0)