Skip to content

Commit 7aaf989

Browse files
committed
Merge branch 'release-v2-dev' into refactor/provider3
2 parents af264e6 + 70d37e3 commit 7aaf989

File tree

13 files changed

+76
-84
lines changed

13 files changed

+76
-84
lines changed

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

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -35,27 +35,8 @@ permissions:
3535
pull-requests: write
3636

3737
jobs:
38-
prepare:
39-
name: Prepare
40-
runs-on: buildjet-2vcpu-ubuntu-2204
41-
steps:
42-
- name: Checkout
43-
uses: actions/checkout@v4
44-
45-
- name: Setup Go Env
46-
id: go
47-
uses: actions/setup-go@v4
48-
with:
49-
go-version: "1.23"
50-
51-
- name: Install kind
52-
run: |
53-
go install sigs.k8s.io/[email protected]
54-
5538
conformance-test:
5639
timeout-minutes: 60
57-
needs:
58-
- prepare
5940
strategy:
6041
matrix:
6142
provider_type:
@@ -72,6 +53,9 @@ jobs:
7253
uses: actions/setup-go@v4
7354
with:
7455
go-version: "1.23"
56+
- name: Install kind
57+
run: |
58+
go install sigs.k8s.io/[email protected]
7559
7660
- name: Login to Registry
7761
uses: docker/login-action@v1

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

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -32,26 +32,7 @@ concurrency:
3232
cancel-in-progress: true
3333

3434
jobs:
35-
prepare:
36-
name: Prepare
37-
runs-on: buildjet-2vcpu-ubuntu-2204
38-
steps:
39-
- name: Checkout
40-
uses: actions/checkout@v4
41-
42-
- name: Setup Go Env
43-
id: go
44-
uses: actions/setup-go@v4
45-
with:
46-
go-version: "1.23"
47-
48-
- name: Install kind
49-
run: |
50-
go install sigs.k8s.io/[email protected]
51-
5235
e2e-test:
53-
needs:
54-
- prepare
5536
strategy:
5637
matrix:
5738
provider_type:
@@ -73,6 +54,10 @@ jobs:
7354
with:
7455
go-version: "1.23"
7556

57+
- name: Install kind
58+
run: |
59+
go install sigs.k8s.io/[email protected]
60+
7661
- name: Login to Registry
7762
uses: docker/login-action@v1
7863
with:
@@ -118,5 +103,6 @@ jobs:
118103
TEST_DIR: "./test/e2e/apisix/"
119104
PROVIDER_TYPE: ${{ matrix.provider_type }}
120105
TEST_LABEL: ${{ matrix.cases_subset }}
106+
TEST_ENV: CI
121107
run: |
122108
make e2e-test

.github/workflows/e2e-test.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,5 +124,6 @@ jobs:
124124
env:
125125
API7_EE_LICENSE: ${{ secrets.API7_EE_LICENSE }}
126126
PROVIDER_TYPE: api7ee
127+
TEST_ENV: CI
127128
run: |
128129
make e2e-test

internal/adc/client/client.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,16 @@ type Client struct {
4848
ConfigManager *common.ConfigManager[types.NamespacedNameKind, adctypes.Config]
4949
}
5050

51-
func New(mode string) (*Client, error) {
52-
log.Infow("using HTTP ADC Executor", zap.String("server_url", defaultHTTPADCExecutorAddr))
51+
func New(mode string, timeout time.Duration) (*Client, error) {
52+
serverURL := os.Getenv("ADC_SERVER_URL")
53+
if serverURL == "" {
54+
serverURL = defaultHTTPADCExecutorAddr
55+
}
5356

57+
log.Infow("using HTTP ADC Executor", zap.String("server_url", serverURL))
5458
return &Client{
5559
Store: cache.NewStore(),
56-
executor: NewHTTPADCExecutor(defaultHTTPADCExecutorAddr),
60+
executor: NewHTTPADCExecutor(serverURL, timeout),
5761
BackendMode: mode,
5862
ConfigManager: common.NewConfigManager[types.NamespacedNameKind, adctypes.Config](),
5963
}, nil

internal/adc/client/executor.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -231,10 +231,10 @@ type HTTPADCExecutor struct {
231231
}
232232

233233
// NewHTTPADCExecutor creates a new HTTPADCExecutor with the specified ADC Server URL
234-
func NewHTTPADCExecutor(serverURL string) *HTTPADCExecutor {
234+
func NewHTTPADCExecutor(serverURL string, timeout time.Duration) *HTTPADCExecutor {
235235
return &HTTPADCExecutor{
236236
httpClient: &http.Client{
237-
Timeout: 30 * time.Second,
237+
Timeout: timeout,
238238
},
239239
serverURL: serverURL,
240240
}
@@ -276,7 +276,7 @@ func (e *HTTPADCExecutor) runHTTPSync(ctx context.Context, mode string, config a
276276

277277
// runHTTPSyncForSingleServer performs HTTP sync to a single ADC Server
278278
func (e *HTTPADCExecutor) runHTTPSyncForSingleServer(ctx context.Context, serverAddr, mode string, config adctypes.Config, args []string) error {
279-
ctx, cancel := context.WithTimeout(ctx, 15*time.Second)
279+
ctx, cancel := context.WithTimeout(ctx, e.httpClient.Timeout)
280280
defer cancel()
281281

282282
// Parse args to extract labels, types, and file path
@@ -387,6 +387,8 @@ func (e *HTTPADCExecutor) buildHTTPRequest(ctx context.Context, serverAddr, mode
387387
return nil, fmt.Errorf("failed to marshal request body: %w", err)
388388
}
389389

390+
log.Debugw("request body", zap.String("body", string(jsonData)))
391+
390392
log.Debugw("sending HTTP request to ADC Server",
391393
zap.String("url", e.serverURL+"/sync"),
392394
zap.String("server", serverAddr),

internal/adc/translator/gatewayproxy.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,11 +120,12 @@ func (t *Translator) TranslateGatewayProxyToConfig(tctx *provider.TranslateConte
120120
config.ServerAddrs = append(config.ServerAddrs, "http://"+net.JoinHostPort(node.Host, strconv.Itoa(node.Port)))
121121
}
122122
} else {
123+
refPort := provider.ControlPlane.Service.Port
123124
var serverAddr string
124125
if svc.Spec.Type == corev1.ServiceTypeExternalName {
125-
serverAddr = fmt.Sprintf("http://%s:%d", svc.Spec.ExternalName, provider.ControlPlane.Service.Port)
126+
serverAddr = fmt.Sprintf("http://%s:%d", svc.Spec.ExternalName, refPort)
126127
} else {
127-
serverAddr = fmt.Sprintf("http://%s.%s.svc:%d", provider.ControlPlane.Service.Name, gatewayProxy.Namespace, provider.ControlPlane.Service.Port)
128+
serverAddr = fmt.Sprintf("http://%s.%s.svc:%d", provider.ControlPlane.Service.Name, gatewayProxy.Namespace, refPort)
128129
}
129130
config.ServerAddrs = []string{serverAddr}
130131
}

test/e2e/crds/v2/basic.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ spec:
137137

138138
By("create IngressClass")
139139
ingressClass := fmt.Sprintf(ingressClassYaml, framework.IngressVersion, s.Namespace())
140-
err = s.CreateResourceFromString(ingressClass)
140+
err = s.CreateResourceFromStringWithNamespace(ingressClass, "")
141141
Expect(err).NotTo(HaveOccurred(), "creating IngressClass")
142142
time.Sleep(5 * time.Second)
143143

test/e2e/crds/v2/route.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ spec:
6565

6666
By("create IngressClass")
6767
ingressClass := fmt.Sprintf(ingressClassYaml, framework.IngressVersion, s.Namespace())
68-
err = s.CreateResourceFromString(ingressClass)
68+
err = s.CreateResourceFromStringWithNamespace(ingressClass, "")
6969
Expect(err).NotTo(HaveOccurred(), "creating IngressClass")
7070
time.Sleep(5 * time.Second)
7171
})

test/e2e/crds/v2/status.go

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ var _ = Describe("Test apisix.apache.org/v2 Status", Label("apisix.apache.org",
3838
var (
3939
s = scaffold.NewScaffold(&scaffold.Options{
4040
ControllerName: "apisix.apache.org/apisix-ingress-controller",
41+
// for triggering the sync
42+
SyncPeriod: 3 * time.Second,
4143
})
4244
applier = framework.NewApplier(s.GinkgoT, s.K8sClient, s.CreateResourceFromString)
4345
)
@@ -65,7 +67,7 @@ spec:
6567
name: "apisix-proxy-config"
6668
`
6769
ingressClass := fmt.Sprintf(ingressClassYaml, framework.IngressVersion, s.Namespace())
68-
err = s.CreateResourceFromString(ingressClass)
70+
err = s.CreateResourceFromStringWithNamespace(ingressClass, "")
6971
Expect(err).NotTo(HaveOccurred(), "creating IngressClass")
7072
time.Sleep(5 * time.Second)
7173
})
@@ -156,8 +158,8 @@ spec:
156158
})
157159

158160
It("dataplane unavailable", func() {
159-
if os.Getenv("PROVIDER_TYPE") != framework.ProviderTypeAPISIXStandalone {
160-
Skip("only for apisix standalone mode")
161+
if os.Getenv("PROVIDER_TYPE") != framework.ProviderTypeAPI7EE {
162+
Skip("skip for api7ee mode because it use dashboard admin api")
161163
}
162164
By("apply ApisixRoute")
163165
applier.MustApplyAPIv2(types.NamespacedName{Namespace: s.Namespace(), Name: "default"}, &apiv2.ApisixRoute{}, ar)
@@ -191,12 +193,13 @@ spec:
191193
s.RetryAssertion(func() string {
192194
output, _ := s.GetOutputFromString("ar", "default", "-o", "yaml")
193195
return output
194-
}).Should(
195-
And(
196-
ContainSubstring(`status: "False"`),
197-
ContainSubstring(`reason: SyncFailed`),
198-
),
199-
)
196+
}).WithTimeout(60 * time.Second).
197+
Should(
198+
And(
199+
ContainSubstring(`status: "False"`),
200+
ContainSubstring(`reason: SyncFailed`),
201+
),
202+
)
200203

201204
By("update service to original spec")
202205
serviceYaml, err = s.GetOutputFromString("svc", framework.ProviderType, "-o", "yaml")
@@ -213,12 +216,13 @@ spec:
213216
s.RetryAssertion(func() string {
214217
output, _ := s.GetOutputFromString("ar", "default", "-o", "yaml")
215218
return output
216-
}).Should(
217-
And(
218-
ContainSubstring(`status: "True"`),
219-
ContainSubstring(`reason: Accepted`),
220-
),
221-
)
219+
}).WithTimeout(60 * time.Second).
220+
Should(
221+
And(
222+
ContainSubstring(`status: "True"`),
223+
ContainSubstring(`reason: Accepted`),
224+
),
225+
)
222226

223227
By("check route in APISIX")
224228
s.RequestAssert(&scaffold.RequestAssert{

test/e2e/framework/manifests/ingress.yaml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -455,11 +455,7 @@ spec:
455455
port: 3001
456456
initialDelaySeconds: 5
457457
periodSeconds: 5
458-
securityContext:
459-
allowPrivilegeEscalation: false
460-
capabilities:
461-
drop:
462-
- ALL
458+
securityContext: {}
463459
volumes:
464460
- name: ingress-config
465461
configMap:

0 commit comments

Comments
 (0)