cilium-cli icon indicating copy to clipboard operation
cilium-cli copied to clipboard

Replace busy wait loops with kubectl `wait`

Open aditighag opened this issue 3 years ago • 2 comments

Replace busy wait loops with the wait functionality exposed by kubectl - https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#wait. It supports waiting for deleted resources too.

Alternatively, the command can wait for the given set of resources to be deleted by providing the "delete" keyword as the value to the --for flag.

aditighag avatar Jun 25 '21 23:06 aditighag

So, kubectl wait, under the hood, is setting up an informer and watching the resource in question -- it doesn't do anything too magical. Anyplace we're busy-looping, we could theoretically replace that with a watch off the shared informer factory.

I'll take a look.

squeed avatar Sep 13 '22 11:09 squeed

Hi @aditighag @squeed, is anyone working on this right now? We had a look with @ioandr and we would like to work on a fix for this issue.

We are up for providing an initial PR to replace the busy-wait loops with informers in https://github.com/cilium/cilium-cli/blob/master/install/uninstall.go. Then, if we are satisfied with the solution, we can further apply it to the rest of the codebase.

ChrsMark avatar Nov 22 '22 16:11 ChrsMark