Skip to content

Commit bbc1d8a

Browse files
committed
add example
1 parent 734d791 commit bbc1d8a

File tree

6 files changed

+85
-66
lines changed

6 files changed

+85
-66
lines changed

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

Lines changed: 78 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -32,79 +32,73 @@ concurrency:
3232
env:
3333
ADC_VERSION: dev
3434

35+
common_setup: &common_setup
36+
- name: Checkout
37+
uses: actions/checkout@v4
38+
with:
39+
submodules: recursive
40+
41+
- name: Setup Go Env
42+
uses: actions/setup-go@v4
43+
with:
44+
go-version: "1.24"
45+
46+
- name: Setup Node.js
47+
uses: actions/setup-node@v3
48+
with:
49+
node-version: "*"
50+
51+
- name: Install ginkgo
52+
run: make install-ginkgo
53+
54+
55+
common_build_and_kind: &common_build_and_kind
56+
- name: Install kind
57+
run: go install sigs.k8s.io/kind@v0.23.0
58+
59+
- name: Build images
60+
env:
61+
TAG: dev
62+
ARCH: amd64
63+
ENABLE_PROXY: "false"
64+
BASE_IMAGE_TAG: "debug"
65+
run: |
66+
echo "building images..."
67+
make build-image
68+
69+
- name: Launch Kind Cluster
70+
run: make kind-up
71+
72+
- name: Loading Docker Image to Kind Cluster
73+
run: make kind-load-images
74+
75+
common_extract_adc: &common_extract_adc
76+
- name: Extract adc binary
77+
if: ${{ env.ADC_VERSION == 'dev' }}
78+
run: |
79+
docker create --name adc-temp ghcr.io/api7/adc:dev
80+
docker cp adc-temp:main.js adc.js
81+
docker rm adc-temp
82+
node $(pwd)/adc.js -v
83+
echo "ADC_BIN=node $(pwd)/adc.js" >> $GITHUB_ENV
84+
3585
jobs:
3686
e2e-test:
3787
strategy:
3888
matrix:
39-
provider_type:
40-
- apisix-standalone
41-
- apisix
42-
cases_subset:
43-
- apisix.apache.org
44-
- networking.k8s.io
45-
- webhook
89+
provider_type: [ apisix-standalone, apisix ]
90+
cases_subset: [ apisix.apache.org, networking.k8s.io, webhook ]
4691
fail-fast: false
47-
runs-on: ubuntu-latest
48-
steps:
49-
- name: Checkout
50-
uses: actions/checkout@v4
51-
with:
52-
submodules: recursive
53-
54-
- name: Setup Go Env
55-
uses: actions/setup-go@v4
56-
with:
57-
go-version: "1.24"
58-
59-
- name: Setup Node.js
60-
uses: actions/setup-node@v3
61-
with:
62-
node-version: "*"
63-
64-
- name: Install kind
65-
run: |
66-
go install sigs.k8s.io/kind@v0.23.0
67-
68-
- name: Install ginkgo
69-
run: |
70-
make install-ginkgo
71-
72-
- name: Build images
73-
env:
74-
TAG: dev
75-
ARCH: amd64
76-
ENABLE_PROXY: "false"
77-
BASE_IMAGE_TAG: "debug"
78-
run: |
79-
echo "building images..."
80-
make build-image
81-
82-
- name: Launch Kind Cluster
83-
run: |
84-
make kind-up
85-
86-
- name: Loading Docker Image to Kind Cluster
87-
run: |
88-
make kind-load-images
8992

90-
- name: Install Gateway API
91-
if: ${{ matrix.cases_subset == 'webhook' || matrix.cases_subset == 'networking.k8s.io' }}
92-
run: |
93-
make install-gateway-api
93+
runs-on: ubuntu-latest
9494

95-
- name: Install CRDs
96-
if: ${{ matrix.cases_subset == 'webhook' || matrix.cases_subset == 'apisix.apache.org' }}
97-
run: |
98-
make install-crds
95+
steps:
96+
*common_setup
97+
*common_build_and_kind
98+
*common_extract_adc
9999

100-
- name: Extract adc binary
101-
if: ${{ env.ADC_VERSION == 'dev' }}
102-
run: |
103-
docker create --name adc-temp ghcr.io/api7/adc:dev
104-
docker cp adc-temp:main.js adc.js
105-
docker rm adc-temp
106-
node $(pwd)/adc.js -v
107-
echo "ADC_BIN=node $(pwd)/adc.js" >> $GITHUB_ENV
100+
- name: Install Gateway API and CRDs
101+
run: make install
108102

109103
- name: Start OpenLDAP server
110104
run: make e2e-ldap
@@ -122,3 +116,22 @@ jobs:
122116
else
123117
make ginkgo-e2e-test
124118
fi
119+
120+
disable-gateway-api:
121+
runs-on: ubuntu-latest
122+
123+
steps:
124+
*common_setup
125+
*common_build_and_kind
126+
*common_extract_adc
127+
128+
- name: Install CRDs
129+
run: make install-crds
130+
131+
- name: Run E2E test suite
132+
shell: bash
133+
env:
134+
TEST_DIR: "./test/e2e/apisix/"
135+
TEST_ENV: CI
136+
TEST_FOCUS: "Test ApisixRoute"
137+
run: make ginkgo-e2e-test

test/conformance/suite_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ func TestMain(m *testing.M) {
170170
InitSyncDelay: 20 * time.Minute,
171171
ProviderType: framework.ProviderType,
172172
ProviderSyncPeriod: 1 * time.Hour,
173+
DisableGatewayAPI: framework.DisableGatewayAPI,
173174
})
174175

175176
adminEndpoint := fmt.Sprintf("http://%s.%s:9180", svc.Name, namespace)

test/e2e/framework/apisix_consts.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ import (
2727
)
2828

2929
var (
30-
ProviderType = cmp.Or(os.Getenv("PROVIDER_TYPE"), "apisix")
30+
ProviderType = cmp.Or(os.Getenv("PROVIDER_TYPE"), "apisix")
31+
DisableGatewayAPI = os.Getenv("DISABLE_GATEWAY_API") == "true"
3132
)
3233

3334
const (

test/e2e/framework/ingress.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ type IngressDeployOpts struct {
5353
InitSyncDelay time.Duration
5454
WebhookEnable bool
5555
WebhookPort int
56+
DisableGatewayAPI bool
5657
}
5758

5859
func (f *Framework) DeployIngress(opts IngressDeployOpts) {

test/e2e/framework/manifests/ingress.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,7 @@ data:
281281
log_level: "debug"
282282
controller_name: {{ .ControllerName | default "apisix.apache.org/apisix-ingress-controller" }}
283283
leader_election_id: "apisix-ingress-controller-leader"
284+
disable_gateway_api: {{ .DisableGatewayAPI | default false }}
284285
leader_election:
285286
lease_duration: 10s # lease_duration is the duration that non-leader candidates will wait
286287
# after observing a leadership renewal until attempting to acquire leadership of a

test/e2e/scaffold/apisix_deployer.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,7 @@ func (s *APISIXDeployer) DeployIngress() {
270270
Namespace: s.namespace,
271271
Replicas: ptr.To(1),
272272
WebhookEnable: s.runtimeOpts.EnableWebhook,
273+
DisableGatewayAPI: framework.DisableGatewayAPI,
273274
})
274275
}
275276

@@ -280,6 +281,7 @@ func (s *APISIXDeployer) ScaleIngress(replicas int) {
280281
ProviderSyncPeriod: 1 * time.Hour,
281282
Namespace: s.namespace,
282283
Replicas: ptr.To(replicas),
284+
DisableGatewayAPI: framework.DisableGatewayAPI,
283285
})
284286
}
285287

0 commit comments

Comments
 (0)