Fix missing default nodeSelector.

reviewable/pr2557/r6
Justin Scott 8 years ago
parent 86028454af
commit 2cb6af64e4

@ -129,24 +129,23 @@ func generateLabels(labels map[string]string) map[string]string {
} }
// parseNodeSelectors takes a comma delimited list of key=values pairs and returns a map // parseNodeSelectors takes a comma delimited list of key=values pairs and returns a map
func parseNodeSelectors(labels string) map[string]string { func parseNodeSelectors(labels string, m map[string]string) map[string]string {
kv := strings.Split(labels, ",") kv := strings.Split(labels, ",")
nodeSelectors := map[string]string{}
nodeSelectors["beta.kubernetes.io/os"] = "linux"
for _, v := range kv { for _, v := range kv {
el := strings.Split(v, "=") el := strings.Split(v, "=")
if len(el) == 2 { if len(el) == 2 {
nodeSelectors[el[0]] = el[1] m[el[0]] = el[1]
} }
} }
return nodeSelectors return m
} }
func generateDeployment(opts *Options) (*v1beta1.Deployment, error) { func generateDeployment(opts *Options) (*v1beta1.Deployment, error) {
labels := generateLabels(map[string]string{"name": "tiller"}) labels := generateLabels(map[string]string{"name": "tiller"})
nodeSelectors := map[string]string{} nodeSelectors := map[string]string{}
nodeSelectors["beta.kubernetes.io/os"] = "linux"
if len(opts.NodeSelectors) > 0 { if len(opts.NodeSelectors) > 0 {
nodeSelectors = parseNodeSelectors(opts.NodeSelectors) nodeSelectors = parseNodeSelectors(opts.NodeSelectors, nodeSelectors)
} }
d := &v1beta1.Deployment{ d := &v1beta1.Deployment{
ObjectMeta: metav1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{

Loading…
Cancel
Save