kubernetes / minikube

Run Kubernetes locally
https://minikube.sigs.k8s.io/
Apache License 2.0
29.18k stars 4.87k forks source link

UI progress bars stepping on each other #11069

Open aidagha opened 3 years ago

aidagha commented 3 years ago

I noticed that preloaded-images-k8s and index.docker.io/kicbase progress bars step on each other when download is in progress and it is confusing for the user and might be interpreted as a glitch. When the download is finished, they are displayed in separate lines:

minikube start --driver=docker
😄  minikube v1.19.0 on Darwin 10.15.7
✨  Using the docker driver based on user configuration
👍  Starting control plane node minikube in cluster minikube
🚜  Pulling base image ...
💾  Downloading Kubernetes v1.20.2 preload ...
    > gcr.io/k8s-minikube/kicbase...: 357.67 MiB / 357.67 MiB  100.00% 396.74 K
    > preloaded-images-k8s-v10-v1...: 491.71 MiB / 491.71 MiB  100.00% 411.47 K
    > index.docker.io/kicbase/sta...: 357.67 MiB / 357.67 MiB  100.00% 417.22 K
afbjorklund commented 3 years ago

The library itself handles this, so it must be something in how we use it.

https://github.com/cheggaaa/pb/blob/master/example_multiple_test.go

First  98 / 200 [=======================>-----------------------]  49.00% 00m04s
Second  94 / 200 [=====================>------------------------]  47.00% 00m05s
Third  89 / 200 [====================>--------------------------]  44.50% 00m05s
medyagh commented 3 years ago

I suspect if we turn on the setting that when the progress bar is 100% to hide itself it will fix this issue

ilya-zuyev commented 3 years ago
Screen Shot 2021-04-26 at 2 14 59 PM

another thing is that we continue to show progress bar even when progress is 100% already

medyagh commented 3 years ago

seems like we the source of the problem is we create two independent pb

https://github.com/medyagh/minikube/blob/b45c782df392d90613d6e8bcc94e029cd13128bb/pkg/minikube/image/image.go#L271

    p := pb.Full.Start64(0)

and the other one in

https://github.com/medyagh/minikube/blob/b45c782df392d90613d6e8bcc94e029cd13128bb/pkg/minikube/download/progressbar.go#L49

should be using a Pool like the example in this issue https://github.com/cheggaaa/pb/issues/31#issuecomment-615189101

  pool := &pb.Pool{}
    first := pb.New(1000).Prefix("First ")
    second := pb.New(1000).Prefix("Second ")
    third := pb.New(1000).Prefix("Third ")
    pool.Add(first, second, third)
    pool.Start()
    wg := new(sync.WaitGroup)
    for _, bar := range []*pb.ProgressBar{first, second, third} {
        wg.Add(1)
        go func(cb *pb.ProgressBar) {
            for n := 0; n < 1000; n++ {
                cb.Increment()
                time.Sleep(time.Millisecond * time.Duration(rand.Intn(100)))
            }
            cb.Finish()
            wg.Done()
        }(bar)
    }
    wg.Wait()

what we could do is adding a Global PB Pool in download package and any new PB be added to the pool

medyagh commented 3 years ago

CC @andriyDev

medyagh commented 3 years ago

Ah seems like V3 does NOT have pooling feature https://github.com/cheggaaa/pb/issues/166#issuecomment-682400009

sharifelgamal commented 3 years ago

We could look into downgrading to v1 to see what happens.

sharifelgamal commented 3 years ago

cc @alonyb

yayaha commented 3 years ago

/assign

k8s-triage-robot commented 2 years ago

The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

You can:

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

k8s-triage-robot commented 2 years ago

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

You can:

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle rotten

maxb commented 2 years ago

This also affects e.g. the kubelet/kubeadm/kubectl progress bars when using --driver=none, and is quite sad for users with lesser internet connections!