I would guess that you can do it in for
loop and inside the loop it will wait
in the workqueue.Get()
until an item added you break when shutdown check this implimentation : https://github.com/kubernetes/sample-controller/blob/e3aa2202834f61b1c8415b33dd801d4417957010/controller.go#L193
Here is some simple try I was also playing with workqueue but it depends on your implimentation here I am not running process in go routine but you can figure out how to do best reference would be sample-controller code
* you can also post code to help understand your implimentation
1 package main
1
2 import (
3 "fmt"
4 "time"
5
6 "k8s.io/client-go/util/workqueue"
7 )
8
9 func FillQueue(q workqueue.Interface) {
10 time.Sleep(1 * time.Second)
11 q.Add("A")
12 q.Add("B")
13 q.Add("C")
14
15 }
16
17 func processingQueue(q workqueue.Interface) bool {
18 item, _ := q.Get()
19 fmt.Printf("Processing %s .. \n", item)
20 q.Done(item)
21 return true
22 }
23
24 func main() {
25 q := workqueue.New()
26 go FillQueue(q)
27 for processingQueue(q) {
28 }
29 }
~