File tree Expand file tree Collapse file tree 2 files changed +38
-15
lines changed
test/e2e/framework/manifests Expand file tree Collapse file tree 2 files changed +38
-15
lines changed Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ import (
2424 "errors"
2525 "fmt"
2626 "io"
27+ "net"
2728 "net/http"
2829 "os"
2930 "os/exec"
@@ -227,13 +228,32 @@ type HTTPADCExecutor struct {
227228 serverURL string
228229}
229230
230- // NewHTTPADCExecutor creates a new HTTPADCExecutor with the specified ADC Server URL
231+ // NewHTTPADCExecutor creates a new HTTPADCExecutor with the specified ADC Server URL.
232+ // serverURL can be "http(s)://host:port" or "unix:///path/to/socket" or "unix:/path/to/socket".
231233func NewHTTPADCExecutor (serverURL string , timeout time.Duration ) * HTTPADCExecutor {
234+ httpClient := & http.Client {
235+ Timeout : timeout ,
236+ }
237+
238+ if strings .HasPrefix (serverURL , "unix:" ) {
239+ var socketPath string
240+ if strings .HasPrefix (serverURL , "unix:///" ) {
241+ socketPath = strings .TrimPrefix (serverURL , "unix://" )
242+ } else {
243+ socketPath = strings .TrimPrefix (serverURL , "unix:" )
244+ }
245+ transport := & http.Transport {
246+ DialContext : func (ctx context.Context , _ , _ string ) (net.Conn , error ) {
247+ return (& net.Dialer {}).DialContext (ctx , "unix" , socketPath )
248+ },
249+ }
250+ httpClient .Transport = transport
251+ serverURL = "http://unix"
252+ }
253+
232254 return & HTTPADCExecutor {
233- httpClient : & http.Client {
234- Timeout : timeout ,
235- },
236- serverURL : serverURL ,
255+ httpClient : httpClient ,
256+ serverURL : serverURL ,
237257 }
238258}
239259
Original file line number Diff line number Diff line change @@ -356,6 +356,8 @@ spec:
356356 app : apisix-ingress-controller
357357 control-plane : controller-manager
358358 spec :
359+ securityContext :
360+ fsGroup : 2000
359361 containers :
360362 - image : apache/apisix-ingress-controller:dev
361363 env :
@@ -367,10 +369,14 @@ spec:
367369 valueFrom :
368370 fieldRef :
369371 fieldPath : metadata.name
372+ - name : ADC_SERVER_URL
373+ value : " unix:/sockets/adc.sock"
370374 volumeMounts :
371375 - name : ingress-config
372376 mountPath : /app/conf/config.yaml
373377 subPath : config.yaml
378+ - name : socket-volume
379+ mountPath : /sockets
374380 {{ if .WebhookEnable -}}
375381 - name : webhook-certs
376382 mountPath : /tmp/certs
@@ -395,12 +401,7 @@ spec:
395401 path : /readyz
396402 port : 8081
397403 initialDelaySeconds : 5
398- periodSeconds : 10
399- securityContext :
400- allowPrivilegeEscalation : false
401- capabilities :
402- drop :
403- - ALL
404+ periodSeconds : 10
404405 - image : ghcr.io/api7/adc:dev
405406 env :
406407 - name : ADC_RUNNING_MODE
@@ -413,13 +414,10 @@ spec:
413414 args :
414415 - " server"
415416 - " --listen"
416- - " http://127.0.0.1:3000 "
417+ - " unix:/sockets/adc.sock "
417418 - " --listen-status"
418419 - " 3001"
419420 ports :
420- - name : http
421- containerPort : 3000
422- protocol : TCP
423421 - name : http-status
424422 containerPort : 3001
425423 protocol : TCP
@@ -436,10 +434,15 @@ spec:
436434 port : 3001
437435 initialDelaySeconds : 5
438436 periodSeconds : 5
437+ volumeMounts :
438+ - name : socket-volume
439+ mountPath : /sockets
439440 volumes :
440441 - name : ingress-config
441442 configMap :
442443 name : ingress-config
444+ - name : socket-volume
445+ emptyDir : {}
443446 {{ if .WebhookEnable -}}
444447 - name : webhook-certs
445448 secret :
You can’t perform that action at this time.
0 commit comments