mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-31 15:25:57 +00:00
Set NodeName on daemonset pods correctly
The pod template was overriding the NodeName.
This commit is contained in:
parent
5994e1d425
commit
a9582dfcbe
@ -291,12 +291,12 @@ func (r RealPodControl) createPods(nodeName, namespace string, template *api.Pod
|
|||||||
GenerateName: prefix,
|
GenerateName: prefix,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
if len(nodeName) != 0 {
|
|
||||||
pod.Spec.NodeName = nodeName
|
|
||||||
}
|
|
||||||
if err := api.Scheme.Convert(&template.Spec, &pod.Spec); err != nil {
|
if err := api.Scheme.Convert(&template.Spec, &pod.Spec); err != nil {
|
||||||
return fmt.Errorf("unable to convert pod template: %v", err)
|
return fmt.Errorf("unable to convert pod template: %v", err)
|
||||||
}
|
}
|
||||||
|
if len(nodeName) != 0 {
|
||||||
|
pod.Spec.NodeName = nodeName
|
||||||
|
}
|
||||||
if labels.Set(pod.Labels).AsSelector().Empty() {
|
if labels.Set(pod.Labels).AsSelector().Empty() {
|
||||||
return fmt.Errorf("unable to create pods, no labels")
|
return fmt.Errorf("unable to create pods, no labels")
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user