mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-01 07:47:56 +00:00
Simplify the check of presence of labels in createPods
This commit is contained in:
parent
6a2d0f67d1
commit
69aeabc397
@ -573,7 +573,7 @@ func (r RealPodControl) createPods(nodeName, namespace string, template *v1.PodT
|
|||||||
if len(nodeName) != 0 {
|
if len(nodeName) != 0 {
|
||||||
pod.Spec.NodeName = nodeName
|
pod.Spec.NodeName = nodeName
|
||||||
}
|
}
|
||||||
if labels.Set(pod.Labels).AsSelectorPreValidated().Empty() {
|
if len(labels.Set(pod.Labels)) == 0 {
|
||||||
return fmt.Errorf("unable to create pods, no labels")
|
return fmt.Errorf("unable to create pods, no labels")
|
||||||
}
|
}
|
||||||
newPod, err := r.KubeClient.CoreV1().Pods(namespace).Create(pod)
|
newPod, err := r.KubeClient.CoreV1().Pods(namespace).Create(pod)
|
||||||
|
Loading…
Reference in New Issue
Block a user