Add "--labels" option to the "expose" kubectl command.

This commit is contained in:
fabioy
2015-03-16 14:18:17 -07:00
parent 1291401c2e
commit 401451c510
5 changed files with 43 additions and 1 deletions

View File

@@ -45,6 +45,13 @@ func (ServiceGenerator) Generate(params map[string]string) (runtime.Object, erro
return nil, fmt.Errorf("'selector' is a required parameter.")
}
selector := ParseLabels(selectorString)
labelsString, found := params["labels"]
var labels map[string]string
if found && len(labelsString) > 0 {
labels = ParseLabels(labelsString)
}
name, found := params["name"]
if !found {
return nil, fmt.Errorf("'name' is a required parameter.")
@@ -59,7 +66,8 @@ func (ServiceGenerator) Generate(params map[string]string) (runtime.Object, erro
}
service := api.Service{
ObjectMeta: api.ObjectMeta{
Name: name,
Name: name,
Labels: labels,
},
Spec: api.ServiceSpec{
Port: port,