e2e: framework should wait etcd controller pod
This commit is contained in:
Родитель
efefd60021
Коммит
32523336e0
|
@ -241,7 +241,7 @@ func (c *Cluster) migrateSeedMember() error {
|
|||
pod := k8sutil.MakeEtcdPod(m, initialCluster, c.name, "existing", "", c.spec)
|
||||
pod = k8sutil.PodWithAddMemberInitContainer(pod, m.Name, mpurls, c.spec)
|
||||
|
||||
if err := k8sutil.CreateAndWaitPod(c.kclient, pod, m, c.namespace); err != nil {
|
||||
if err := k8sutil.CreateAndWaitPod(c.kclient, c.namespace, pod); err != nil {
|
||||
return err
|
||||
}
|
||||
c.idCounter++
|
||||
|
@ -404,7 +404,7 @@ func (c *Cluster) createPodAndService(members etcdutil.MemberSet, m *etcdutil.Me
|
|||
if needRecovery {
|
||||
k8sutil.AddRecoveryToPod(pod, c.name, m.Name, token, c.spec)
|
||||
}
|
||||
return k8sutil.CreateAndWaitPod(c.kclient, pod, m, c.namespace)
|
||||
return k8sutil.CreateAndWaitPod(c.kclient, c.namespace, pod)
|
||||
}
|
||||
|
||||
func (c *Cluster) removePodAndService(name string) error {
|
||||
|
|
|
@ -152,12 +152,11 @@ func CreateEtcdNodePortService(kclient *unversioned.Client, etcdName, clusterNam
|
|||
return kclient.Services(ns).Create(svc)
|
||||
}
|
||||
|
||||
// TODO: use a struct to replace the huge arg list.
|
||||
func CreateAndWaitPod(kclient *unversioned.Client, pod *api.Pod, m *etcdutil.Member, ns string) error {
|
||||
func CreateAndWaitPod(kclient *unversioned.Client, ns string, pod *api.Pod) error {
|
||||
if _, err := kclient.Pods(ns).Create(pod); err != nil {
|
||||
return err
|
||||
}
|
||||
w, err := kclient.Pods(ns).Watch(api.SingleObject(api.ObjectMeta{Name: m.Name}))
|
||||
w, err := kclient.Pods(ns).Watch(api.SingleObject(api.ObjectMeta{Name: pod.Name}))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -116,14 +116,15 @@ func (f *Framework) setupEtcdController(ctrlImage string) error {
|
|||
},
|
||||
}
|
||||
|
||||
_, err := f.KubeClient.Pods(f.Namespace.Name).Create(pod)
|
||||
err := k8sutil.CreateAndWaitPod(f.KubeClient, f.Namespace.Name, pod)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = k8sutil.WaitEtcdTPRReady(f.KubeClient.Client, 5*time.Second, 90*time.Second, f.MasterHost, f.Namespace.Name)
|
||||
err = k8sutil.WaitEtcdTPRReady(f.KubeClient.Client, 5*time.Second, 60*time.Second, f.MasterHost, f.Namespace.Name)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
logrus.Info("etcd controller created successfully")
|
||||
return nil
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче