mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-03 17:30:00 +00:00
Improve ScaleRC function to be more generic
This commit is contained in:
parent
b8990593f2
commit
e8135c30d5
@ -2974,11 +2974,14 @@ func ScaleRC(c *client.Client, ns, name string, size uint, wait bool) error {
|
|||||||
return WaitForRCPodsRunning(c, ns, name)
|
return WaitForRCPodsRunning(c, ns, name)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Wait up to 10 minutes for pods to become Running. Assume that the pods of the
|
// Wait up to 10 minutes for pods to become Running.
|
||||||
// rc are labels with {"name":rcName}.
|
|
||||||
func WaitForRCPodsRunning(c *client.Client, ns, rcName string) error {
|
func WaitForRCPodsRunning(c *client.Client, ns, rcName string) error {
|
||||||
selector := labels.SelectorFromSet(labels.Set(map[string]string{"name": rcName}))
|
rc, err := c.ReplicationControllers(ns).Get(rcName)
|
||||||
err := WaitForPodsWithLabelRunning(c, ns, selector)
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
selector := labels.SelectorFromSet(labels.Set(rc.Spec.Selector))
|
||||||
|
err = WaitForPodsWithLabelRunning(c, ns, selector)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("Error while waiting for replication controller %s pods to be running: %v", rcName, err)
|
return fmt.Errorf("Error while waiting for replication controller %s pods to be running: %v", rcName, err)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user