Skip to content

Commit

Permalink
fix --wait's failure to work on coredns pods
Browse files Browse the repository at this point in the history
  • Loading branch information
ComradeProgrammer committed Dec 11, 2024
1 parent 9d3094c commit 5ccd0c4
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions pkg/minikube/bootstrapper/bsutil/kverify/system_pods.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ func WaitForSystemPods(r cruntime.Manager, bs bootstrapper.Bootstrapper, cfg con

// ExpectAppsRunning returns whether or not all expected k8s-apps are running. (without waiting for them)
func ExpectAppsRunning(cs *kubernetes.Clientset, expected []string) error {

found := map[string]bool{}

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

for {
// core dns deployment has been scaled to 1 pods, wait until there is only 1 pod
corednsPods, err := cs.CoreV1().Pods("kube-system").List(context.Background(), meta.ListOptions{
LabelSelector: "k8s-app=kube-dns",
})
if err != nil {
return err
}
if len(corednsPods.Items) == 1 {
break
}
}

for _, pod := range pods.Items {
klog.Info(podStatusMsg(pod))

if pod.Status.Phase != core.PodRunning {
continue
}
for _, cs := range pod.Status.ContainerStatuses {
if !cs.Ready {
continue
}
}

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

0 comments on commit 5ccd0c4

Please sign in to comment.