File tree Expand file tree Collapse file tree 2 files changed +41
-15
lines changed
test/e2e/framework/manifests Expand file tree Collapse file tree 2 files changed +41
-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 @@ -346,6 +346,8 @@ spec:
346346 app : apisix-ingress-controller
347347 control-plane : controller-manager
348348 spec :
349+ securityContext :
350+ fsGroup : 2000
349351 containers :
350352 - image : api7/api7-ingress-controller:dev
351353 env :
@@ -357,10 +359,14 @@ spec:
357359 valueFrom :
358360 fieldRef :
359361 fieldPath : metadata.name
362+ - name : ADC_SERVER_URL
363+ value : " unix:/sockets/adc.sock"
360364 volumeMounts :
361365 - name : ingress-config
362366 mountPath : /app/conf/config.yaml
363367 subPath : config.yaml
368+ - name : socket-volume
369+ mountPath : /sockets
364370 {{ if .WebhookEnable -}}
365371 - name : webhook-certs
366372 mountPath : /tmp/certs
@@ -385,12 +391,7 @@ spec:
385391 path : /readyz
386392 port : 8081
387393 initialDelaySeconds : 5
388- periodSeconds : 10
389- securityContext :
390- allowPrivilegeEscalation : false
391- capabilities :
392- drop :
393- - ALL
394+ periodSeconds : 10
394395 - image : ghcr.io/api7/adc:dev
395396 env :
396397 - name : ADC_RUNNING_MODE
@@ -403,13 +404,10 @@ spec:
403404 args :
404405 - " server"
405406 - " --listen"
406- - " http://127.0.0.1:3000 "
407+ - " unix:/sockets/adc.sock "
407408 - " --listen-status"
408409 - " 3001"
409410 ports :
410- - name : http
411- containerPort : 3000
412- protocol : TCP
413411 - name : http-status
414412 containerPort : 3001
415413 protocol : TCP
@@ -426,11 +424,19 @@ spec:
426424 port : 3001
427425 initialDelaySeconds : 5
428426 periodSeconds : 5
427+ <<<<<<< HEAD
429428 securityContext : {}
429+ =======
430+ volumeMounts :
431+ - name : socket-volume
432+ mountPath : /sockets
433+ >>>>>>> dc8b6621 (feat: add Unix socket support for inter-container communication (#2587))
430434 volumes :
431435 - name : ingress-config
432436 configMap :
433437 name : ingress-config
438+ - name : socket-volume
439+ emptyDir : {}
434440 {{ if .WebhookEnable -}}
435441 - name : webhook-certs
436442 secret :
You can’t perform that action at this time.
0 commit comments