8686          secretName: sleep-secret 
8787          optional: true 
8888` 
89+ var  echoYaml  =  ` 
90+ apiVersion: v1 
91+ kind: Service 
92+ metadata: 
93+   name: echo 
94+   namespace: default 
95+ spec: 
96+   ports: 
97+   - name: http 
98+     port: 80 
99+     targetPort: 8080 
100+   selector: 
101+     app: echo 
102+ --- 
103+ apiVersion: apps/v1 
104+ kind: Deployment 
105+ metadata: 
106+   name: echo 
107+   namespace: default 
108+ spec: 
109+   replicas: 1 
110+   selector: 
111+     matchLabels: 
112+       app: echo 
113+   template: 
114+     metadata: 
115+       labels: 
116+         app: echo 
117+     spec: 
118+       containers: 
119+       - name: echo 
120+         image: gcr.io/istio-testing/app:latest 
121+         imagePullPolicy: IfNotPresent 
122+         args: 
123+         - --port=8080 
124+         ports: 
125+         - containerPort: 8080 
126+ ` 
89127
90128func  deployServices (t  framework.TestContext ) error  {
91129	t .Logf ("Labeling namespace..." )
@@ -105,6 +143,15 @@ func deployServices(t framework.TestContext) error {
105143		return  err 
106144	}
107145
146+ 	t .Logf ("Applying echo resources..." )
147+ 	cmd  =  exec .Command ("kubectl" , "apply" , "-f" , "-" )
148+ 	cmd .Stdin  =  bytes .NewBufferString (echoYaml )
149+ 	out , err  =  cmd .CombinedOutput ()
150+ 	if  err  !=  nil  {
151+ 		t .Fatalf ("Failed to apply echo resources: %s\n %s" , err , string (out ))
152+ 		return  err 
153+ 	}
154+ 
108155	return  nil 
109156}
110157
@@ -118,6 +165,15 @@ func deleteServices(t framework.TestContext) error {
118165		return  err 
119166	}
120167
168+ 	t .Logf ("Deleting echo resources..." )
169+ 	cmd  =  exec .Command ("kubectl" , "delete" , "-f" , "-" )
170+ 	cmd .Stdin  =  bytes .NewBufferString (echoYaml )
171+ 	out , err  =  cmd .CombinedOutput ()
172+ 	if  err  !=  nil  {
173+ 		t .Fatalf ("Failed to delete echo resources: %s\n %s" , err , string (out ))
174+ 		return  err 
175+ 	}
176+ 
121177	t .Logf ("Removing label from namespace default..." )
122178	cmd  =  exec .Command ("kubectl" , "label" , "namespace" , "default" , "istio.io/dataplane-mode-" )
123179	out , err  =  cmd .CombinedOutput ()
@@ -254,10 +310,10 @@ func curlFromSleepToEcho(t framework.TestContext, sleepPod, echoIP string) (stri
254310	var  url  string 
255311	if  strings .Contains (echoIP , ":" ) {
256312		// IPv6 address 
257- 		url  =  fmt .Sprintf ("http://[%s]:18080 " , echoIP )
313+ 		url  =  fmt .Sprintf ("http://[%s]:8080 " , echoIP )
258314	} else  {
259315		// IPv4 address 
260- 		url  =  fmt .Sprintf ("http://%s:18080 " , echoIP )
316+ 		url  =  fmt .Sprintf ("http://%s:8080 " , echoIP )
261317	}
262318	cmd  :=  exec .Command ("kubectl" , "exec" , sleepPod , "--" , "curl" , url )
263319	out , err  :=  cmd .CombinedOutput ()
@@ -330,7 +386,7 @@ func TestIPsecAuthorization(t *testing.T) {
330386				t .Logf ("sleep pod name: %s, ip: %s" , sleepPodName , sleepPodIP )
331387			}
332388
333- 			echoPodName , echoPodIP , err  :=  getPodNameAndIP (t , apps . Namespace . Name () , "enrolled-to-kmesh " )
389+ 			echoPodName , echoPodIP , err  :=  getPodNameAndIP (t , "default" , "echo " )
334390			if  err  !=  nil  {
335391				return 
336392			} else  {
0 commit comments