Add "--labels" option to the "expose" kubectl command.
This commit is contained in:
@@ -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,
|
||||
|
Reference in New Issue
Block a user