@@ -208,6 +208,9 @@ var (
208
208
// BusyBoxImage is the image URI of BusyBox.
209
209
BusyBoxImage = imageutils .GetE2EImage (imageutils .BusyBox )
210
210
211
+ // AgnHostImage is the image URI of AgnHost
212
+ AgnHostImage = imageutils .GetE2EImage (imageutils .Agnhost )
213
+
211
214
// For parsing Kubectl version for version-skewed testing.
212
215
gitVersionRegexp = regexp .MustCompile ("GitVersion:\" (v.+?)\" " )
213
216
@@ -474,8 +477,8 @@ func ProxyMode(f *Framework) (string, error) {
474
477
Containers : []v1.Container {
475
478
{
476
479
Name : "detector" ,
477
- Image : imageutils . GetE2EImage ( imageutils . Agnhost ) ,
478
- Command : []string {"/bin/sleep" , "3600 " },
480
+ Image : AgnHostImage ,
481
+ Command : []string {"pause " },
479
482
},
480
483
},
481
484
},
@@ -2876,29 +2879,19 @@ func UnblockNetwork(from string, to string) {
2876
2879
}
2877
2880
}
2878
2881
2879
- // PingCommand is the type to hold ping command.
2880
- type PingCommand string
2881
-
2882
- const (
2883
- // IPv4PingCommand is a ping command for IPv4.
2884
- IPv4PingCommand PingCommand = "ping"
2885
- // IPv6PingCommand is a ping command for IPv6.
2886
- IPv6PingCommand PingCommand = "ping6"
2887
- )
2888
-
2889
2882
// CheckConnectivityToHost launches a pod to test connectivity to the specified
2890
2883
// host. An error will be returned if the host is not reachable from the pod.
2891
2884
//
2892
2885
// An empty nodeName will use the schedule to choose where the pod is executed.
2893
- func CheckConnectivityToHost (f * Framework , nodeName , podName , host string , pingCmd PingCommand , timeout int ) error {
2886
+ func CheckConnectivityToHost (f * Framework , nodeName , podName , host string , port , timeout int ) error {
2894
2887
contName := fmt .Sprintf ("%s-container" , podName )
2895
2888
2896
2889
command := []string {
2897
- string (pingCmd ),
2898
- "-c" , "3" , // send 3 pings
2899
- "-W" , "2" , // wait at most 2 seconds for a reply
2890
+ "nc" ,
2891
+ "-vz" ,
2900
2892
"-w" , strconv .Itoa (timeout ),
2901
2893
host ,
2894
+ strconv .Itoa (port ),
2902
2895
}
2903
2896
2904
2897
pod := & v1.Pod {
@@ -2909,7 +2902,7 @@ func CheckConnectivityToHost(f *Framework, nodeName, podName, host string, pingC
2909
2902
Containers : []v1.Container {
2910
2903
{
2911
2904
Name : contName ,
2912
- Image : BusyBoxImage ,
2905
+ Image : AgnHostImage ,
2913
2906
Command : command ,
2914
2907
},
2915
2908
},
@@ -3257,7 +3250,7 @@ func (f *Framework) NewAgnhostPod(name string, args ...string) *v1.Pod {
3257
3250
Containers : []v1.Container {
3258
3251
{
3259
3252
Name : "agnhost" ,
3260
- Image : imageutils . GetE2EImage ( imageutils . Agnhost ) ,
3253
+ Image : AgnHostImage ,
3261
3254
Args : args ,
3262
3255
},
3263
3256
},
0 commit comments