@@ -12,6 +12,7 @@ import (
12
12
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
13
13
14
14
"github.com/openservicemesh/osm/pkg/apis/config/v1alpha2"
15
+ "github.com/openservicemesh/osm/pkg/tests"
15
16
16
17
"github.com/openservicemesh/osm/pkg/constants"
17
18
. "github.com/openservicemesh/osm/tests/framework"
@@ -26,26 +27,34 @@ var _ = OSMDescribe("Test HTTP traffic from 1 pod client -> 1 pod server",
26
27
func () {
27
28
Context ("Test traffic flowing from client to server with a Kubernetes Service for the Source: HTTP" , func () {
28
29
withSourceKubernetesService := true
29
- testTraffic (withSourceKubernetesService , PodCommandDefault )
30
+ testTraffic (withSourceKubernetesService , PodCommandDefault , false )
30
31
})
31
32
32
33
Context ("Test traffic flowing from client to server without a Kubernetes Service for the Source: HTTP" , func () {
33
34
// Prior iterations of OSM required that a source pod belong to a Kubernetes service
34
35
// for the Envoy proxy to be configured for outbound traffic to some remote server.
35
36
// This test ensures we test this scenario: client Pod is not associated w/ a service.
36
37
withSourceKubernetesService := false
37
- testTraffic (withSourceKubernetesService , PodCommandDefault )
38
+ testTraffic (withSourceKubernetesService , PodCommandDefault , false )
38
39
})
39
40
40
41
Context ("Test traffic flowing from client to a server with a podIP bind" , func () {
41
42
// Prior iterations of OSM didn't allow mesh services to bind to the podIP
42
43
// This test ensures that that behavior is configurable via MeshConfig
43
44
withSourceKubernetesService := true
44
- testTraffic (withSourceKubernetesService , []string {"gunicorn" , "-b" , "$(POD_IP):80" , "httpbin:app" , "-k" , "gevent" }, WithLocalProxyMode (v1alpha2 .LocalProxyModePodIP ))
45
+ testTraffic (withSourceKubernetesService , []string {"gunicorn" , "-b" , "$(POD_IP):80" , "httpbin:app" , "-k" , "gevent" }, false , WithLocalProxyMode (v1alpha2 .LocalProxyModePodIP ))
46
+ })
47
+
48
+ Context ("Test traffic flowing from client to a headless service without a Kubernetes Service for the Source: HTTP" , func () {
49
+ // Prior iterations of OSM required that a source pod belong to a Kubernetes service
50
+ // for the Envoy proxy to be configured for outbound traffic to some remote server.
51
+ // This test ensures we test this scenario: client Pod is not associated w/ a service.
52
+ withSourceKubernetesService := true
53
+ testTraffic (withSourceKubernetesService , PodCommandDefault , true )
45
54
})
46
55
})
47
56
48
- func testTraffic (withSourceKubernetesService bool , destPodCommand []string , installOpts ... InstallOsmOpt ) {
57
+ func testTraffic (withSourceKubernetesService bool , destPodCommand []string , destServiceHeadless bool , installOpts ... InstallOsmOpt ) {
49
58
const sourceName = "client"
50
59
const destName = "server"
51
60
var ns = []string {sourceName , destName }
@@ -68,7 +77,7 @@ func testTraffic(withSourceKubernetesService bool, destPodCommand []string, inst
68
77
Expect (err ).NotTo (HaveOccurred ())
69
78
_ , err = Td .CreatePod (destName , podDef )
70
79
Expect (err ).NotTo (HaveOccurred ())
71
- dstSvc , err := Td .CreateService (destName , svcDef )
80
+ dstSvc , err := Td .CreateService (destName , * tests . HeadlessSvc ( & svcDef ) )
72
81
Expect (err ).NotTo (HaveOccurred ())
73
82
74
83
// Expect it to be up and running in it's receiver namespace
0 commit comments