mirror of https://github.com/k3s-io/k3s
TODOs around stopping informers
parent
453bb17c3c
commit
e0c6bf13b1
|
@ -29,7 +29,7 @@ import (
|
||||||
type Config struct {
|
type Config struct {
|
||||||
// The queue for your objects; either a FIFO or
|
// The queue for your objects; either a FIFO or
|
||||||
// a DeltaFIFO. Your Process() function should accept
|
// a DeltaFIFO. Your Process() function should accept
|
||||||
// the output of this Oueue's Pop() method.
|
// the output of this Queue's Pop() method.
|
||||||
Queue
|
Queue
|
||||||
|
|
||||||
// Something that can list and watch your objects.
|
// Something that can list and watch your objects.
|
||||||
|
@ -121,6 +121,11 @@ func (c *Controller) Requeue(obj interface{}) error {
|
||||||
// TODO: Consider doing the processing in parallel. This will require a little thought
|
// TODO: Consider doing the processing in parallel. This will require a little thought
|
||||||
// to make sure that we don't end up processing the same object multiple times
|
// to make sure that we don't end up processing the same object multiple times
|
||||||
// concurrently.
|
// concurrently.
|
||||||
|
//
|
||||||
|
// TODO: Plumb through the stopCh here (and down to the queue) so that this can
|
||||||
|
// actually exit when the controller is stopped. Or just give up on this stuff
|
||||||
|
// ever being stoppable. Converting this whole package to use Context would
|
||||||
|
// also be helpful.
|
||||||
func (c *Controller) processLoop() {
|
func (c *Controller) processLoop() {
|
||||||
for {
|
for {
|
||||||
obj, err := c.config.Queue.Pop(PopProcessFunc(c.config.Process))
|
obj, err := c.config.Queue.Pop(PopProcessFunc(c.config.Process))
|
||||||
|
@ -134,7 +139,7 @@ func (c *Controller) processLoop() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// ResourceEventHandler can handle notifications for events that happen to a
|
// ResourceEventHandler can handle notifications for events that happen to a
|
||||||
// resource. The events are informational only, so you can't return an
|
// resource. The events are informational only, so you can't return an
|
||||||
// error.
|
// error.
|
||||||
// * OnAdd is called when an object is added.
|
// * OnAdd is called when an object is added.
|
||||||
// * OnUpdate is called when an object is modified. Note that oldObj is the
|
// * OnUpdate is called when an object is modified. Note that oldObj is the
|
||||||
|
|
|
@ -283,6 +283,9 @@ func TestHammerController(t *testing.T) {
|
||||||
time.Sleep(100 * time.Millisecond)
|
time.Sleep(100 * time.Millisecond)
|
||||||
close(stop)
|
close(stop)
|
||||||
|
|
||||||
|
// TODO: Verify that no goroutines were leaked here and that everything shut
|
||||||
|
// down cleanly.
|
||||||
|
|
||||||
outputSetLock.Lock()
|
outputSetLock.Lock()
|
||||||
t.Logf("got: %#v", outputSet)
|
t.Logf("got: %#v", outputSet)
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,7 +45,7 @@ import (
|
||||||
|
|
||||||
// Reflector watches a specified resource and causes all changes to be reflected in the given store.
|
// Reflector watches a specified resource and causes all changes to be reflected in the given store.
|
||||||
type Reflector struct {
|
type Reflector struct {
|
||||||
// name identifies this reflector. By default it will be a file:line if possible.
|
// name identifies this reflector. By default it will be a file:line if possible.
|
||||||
name string
|
name string
|
||||||
|
|
||||||
// The type of object we expect to place in the store.
|
// The type of object we expect to place in the store.
|
||||||
|
@ -108,7 +108,7 @@ func NewNamedReflector(name string, lw ListerWatcher, expectedType interface{},
|
||||||
return r
|
return r
|
||||||
}
|
}
|
||||||
|
|
||||||
// internalPackages are packages that ignored when creating a default reflector name. These packages are in the common
|
// internalPackages are packages that ignored when creating a default reflector name. These packages are in the common
|
||||||
// call chains to NewReflector, so they'd be low entropy names for reflectors
|
// call chains to NewReflector, so they'd be low entropy names for reflectors
|
||||||
var internalPackages = []string{"kubernetes/pkg/client/cache/", "/runtime/asm_"}
|
var internalPackages = []string{"kubernetes/pkg/client/cache/", "/runtime/asm_"}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue