Merge pull request #32811 from fraenkel/headless_service

Automatic merge from submit-queue (batch tested with PRs 38260, 32811, 28458, 33570, 37096)

Allow no ports when exposing headless service

fixes #32795
This commit is contained in:
Kubernetes Submit Queue
2016-12-08 02:11:20 -08:00
committed by GitHub
4 changed files with 91 additions and 33 deletions

View File

@@ -264,6 +264,32 @@ func TestRunExposeService(t *testing.T) {
expected: "service \"foo\" exposed",
status: 200,
},
{
name: "expose-headless-service-no-port",
args: []string{"service", "baz"},
ns: "test",
calls: map[string]string{
"GET": "/namespaces/test/services/baz",
"POST": "/namespaces/test/services",
},
input: &api.Service{
ObjectMeta: api.ObjectMeta{Name: "baz", Namespace: "test", ResourceVersion: "12"},
Spec: api.ServiceSpec{
Selector: map[string]string{"app": "go"},
},
},
flags: map[string]string{"selector": "func=stream", "name": "foo", "labels": "svc=test", "cluster-ip": "None", "dry-run": "true"},
output: &api.Service{
ObjectMeta: api.ObjectMeta{Name: "foo", Namespace: "", Labels: map[string]string{"svc": "test"}},
Spec: api.ServiceSpec{
Ports: []api.ServicePort{},
Selector: map[string]string{"func": "stream"},
ClusterIP: api.ClusterIPNone,
},
},
expected: "service \"foo\" exposed",
status: 200,
},
{
name: "expose-from-file",
args: []string{},