Skip to content

Commit 5ccd0c4

Browse files
fix --wait's failure to work on coredns pods
1 parent 9d3094c commit 5ccd0c4

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

pkg/minikube/bootstrapper/bsutil/kverify/system_pods.go

+19
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ func WaitForSystemPods(r cruntime.Manager, bs bootstrapper.Bootstrapper, cfg con
7777

7878
// ExpectAppsRunning returns whether or not all expected k8s-apps are running. (without waiting for them)
7979
func ExpectAppsRunning(cs *kubernetes.Clientset, expected []string) error {
80+
8081
found := map[string]bool{}
8182

8283
pods, err := cs.CoreV1().Pods("kube-system").List(context.Background(), meta.ListOptions{})
@@ -85,12 +86,30 @@ func ExpectAppsRunning(cs *kubernetes.Clientset, expected []string) error {
8586
}
8687
klog.Infof("%d kube-system pods found", len(pods.Items))
8788

89+
for {
90+
// core dns deployment has been scaled to 1 pods, wait until there is only 1 pod
91+
corednsPods, err := cs.CoreV1().Pods("kube-system").List(context.Background(), meta.ListOptions{
92+
LabelSelector: "k8s-app=kube-dns",
93+
})
94+
if err != nil {
95+
return err
96+
}
97+
if len(corednsPods.Items) == 1 {
98+
break
99+
}
100+
}
101+
88102
for _, pod := range pods.Items {
89103
klog.Info(podStatusMsg(pod))
90104

91105
if pod.Status.Phase != core.PodRunning {
92106
continue
93107
}
108+
for _, cs := range pod.Status.ContainerStatuses {
109+
if !cs.Ready {
110+
continue
111+
}
112+
}
94113

95114
for k, v := range pod.ObjectMeta.Labels {
96115
if k == "component" || k == "k8s-app" {

0 commit comments

Comments
 (0)