Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

check whether yurt manager's container is ready in e2e #1631

Merged
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions test/e2e/cmd/init/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import (
"github.com/spf13/pflag"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/sets"
"k8s.io/apimachinery/pkg/util/wait"
kubeclientset "k8s.io/client-go/kubernetes"
"k8s.io/client-go/tools/clientcmd"
"k8s.io/klog/v2"
Expand Down Expand Up @@ -374,6 +375,26 @@ func (ki *Initializer) prepareKindConfigFile(kindConfigPath string) error {
}

func (ki *Initializer) configureAddons() error {
err := wait.PollImmediate(10*time.Second, 4*time.Minute, func() (bool, error) {
rambohe-ch marked this conversation as resolved.
Show resolved Hide resolved
labelSelector := metav1.LabelSelector{MatchLabels: map[string]string{"app.kubernetes.io/name": "yurt-manager"}}
yurtManagerPods, err := ki.kubeClient.CoreV1().Pods("kube-system").List(context.TODO(), metav1.ListOptions{
LabelSelector: metav1.FormatLabelSelector(&labelSelector),
})
if err != nil {
klog.Errorf("failed to list yurt-manager pod, %v", err)
return false, err
}
for _, pod := range yurtManagerPods.Items {
if !pod.Status.ContainerStatuses[0].Ready {
klog.Info("container is not ready in yurtmanager pod")
return false, nil
}
}
return true, nil
})
if err != nil {
return err
}
if err := ki.configureCoreDnsAddon(); err != nil {
return err
}
Expand Down