File tree Expand file tree Collapse file tree 2 files changed +48
-1
lines changed Expand file tree Collapse file tree 2 files changed +48
-1
lines changed Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ import (
2121 "context"
2222 "fmt"
2323 "net/http"
24+ "strings"
2425 "time"
2526
2627 "github.com/gruntwork-io/terratest/modules/k8s"
6465 headers:
6566 "X-Pod-Hostname": "$hostname"
6667`
68+ const gatewayProxySpecAPI7 = `
69+ apiVersion: apisix.apache.org/v1alpha1
70+ kind: GatewayProxy
71+ metadata:
72+ name: apisix-proxy-config
73+ spec:
74+ provider:
75+ type: ControlPlane
76+ controlPlane:
77+ endpoints:
78+ - %s
79+ auth:
80+ type: AdminKey
81+ adminKey:
82+ value: "%s"
83+ plugins:
84+ - name: response-rewrite
85+ enabled: true
86+ config:
87+ headers:
88+ "X-Pod-Hostname": "$hostname"
89+ `
90+
6791 const gatewayClassSpec = `
6892apiVersion: gateway.networking.k8s.io/v1
6993kind: GatewayClass
@@ -110,7 +134,11 @@ spec:
110134`
111135 BeforeEach (func () {
112136 By ("create GatewayProxy" )
113- err = s .CreateResourceFromString (fmt .Sprintf (gatewayProxySpec , framework .ProviderType , s .AdminKey ()))
137+ if strings .Contains (s .Deployer .GetAdminEndpoint (), "api7ee3-dashboard" ) {
138+ err = s .CreateResourceFromString (fmt .Sprintf (gatewayProxySpecAPI7 , s .Deployer .GetAdminEndpoint (), s .AdminKey ()))
139+ } else {
140+ err = s .CreateResourceFromString (fmt .Sprintf (gatewayProxySpec , framework .ProviderType , s .AdminKey ()))
141+ }
114142 Expect (err ).NotTo (HaveOccurred (), "creating GatewayProxy" )
115143 time .Sleep (time .Second )
116144
Original file line number Diff line number Diff line change 5757 type: AdminKey
5858 adminKey:
5959 value: "%s"
60+ `
61+ var gatewayProxyYamlAPI7 = `
62+ apiVersion: apisix.apache.org/v1alpha1
63+ kind: GatewayProxy
64+ metadata:
65+ name: apisix-proxy-config
66+ spec:
67+ provider:
68+ type: ControlPlane
69+ controlPlane:
70+ endpoints:
71+ - %s
72+ auth:
73+ type: AdminKey
74+ adminKey:
75+ value: "%s"
6076`
6177 getGatewayProxySpec := func () string {
78+ if adminEndpoint := s .Deployer .GetAdminEndpoint (); strings .Contains (adminEndpoint , "api7ee3-dashboard" ) {
79+ return fmt .Sprintf (gatewayProxyYamlAPI7 , adminEndpoint , s .AdminKey ())
80+ }
6281 return fmt .Sprintf (gatewayProxyYaml , framework .ProviderType , s .AdminKey ())
6382 }
6483
You can’t perform that action at this time.
0 commit comments