mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-27 13:37:30 +00:00
Fix comments; switch to watching nodes
This commit is contained in:
parent
66d55e0959
commit
dd26cdf0f7
@ -115,7 +115,9 @@ func (c *Controller) processLoop() {
|
|||||||
// get called even if nothing changed. This is useful for periodically
|
// get called even if nothing changed. This is useful for periodically
|
||||||
// evaluating or syncing something.
|
// evaluating or syncing something.
|
||||||
// * OnDelete will get the final state of the item if it is known, otherwise
|
// * OnDelete will get the final state of the item if it is known, otherwise
|
||||||
// it will get an object of type cache.DeletedFinalStateUnknown.
|
// it will get an object of type cache.DeletedFinalStateUnknown. This can
|
||||||
|
// happen if the watch is closed and misses the delete event and we don't
|
||||||
|
// notice the deletion until the subsequent re-list.
|
||||||
type ResourceEventHandler interface {
|
type ResourceEventHandler interface {
|
||||||
OnAdd(obj interface{})
|
OnAdd(obj interface{})
|
||||||
OnUpdate(oldObj, newObj interface{})
|
OnUpdate(oldObj, newObj interface{})
|
||||||
|
@ -302,8 +302,9 @@ func TestUpdate(t *testing.T) {
|
|||||||
|
|
||||||
var testDoneWG sync.WaitGroup
|
var testDoneWG sync.WaitGroup
|
||||||
|
|
||||||
// Make a controller that immediately deletes anything added to it, and
|
// Make a controller that deletes things once it observes an update.
|
||||||
// logs anything deleted.
|
// It calls Done() on the wait group on deletions so we can tell when
|
||||||
|
// everything we've added has been deleted.
|
||||||
_, controller := framework.NewInformer(
|
_, controller := framework.NewInformer(
|
||||||
source,
|
source,
|
||||||
&api.Pod{},
|
&api.Pod{},
|
||||||
|
@ -168,13 +168,7 @@ func (f *ConfigFactory) CreateFromKeys(predicateKeys, priorityKeys util.StringSe
|
|||||||
|
|
||||||
// Watch minions.
|
// Watch minions.
|
||||||
// Minions may be listed frequently, so provide a local up-to-date cache.
|
// Minions may be listed frequently, so provide a local up-to-date cache.
|
||||||
if false {
|
cache.NewReflector(f.createMinionLW(), &api.Node{}, f.NodeLister.Store, 0).RunUntil(f.StopEverything)
|
||||||
// Disable this code until minions support watches. Note when this code is enabled,
|
|
||||||
// we need to make sure minion ListWatcher has proper FieldSelector.
|
|
||||||
cache.NewReflector(f.createMinionLW(), &api.Node{}, f.NodeLister.Store, 10*time.Second).RunUntil(f.StopEverything)
|
|
||||||
} else {
|
|
||||||
cache.NewPoller(f.pollMinions, 10*time.Second, f.NodeLister.Store).RunUntil(f.StopEverything)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Watch and cache all service objects. Scheduler needs to find all pods
|
// Watch and cache all service objects. Scheduler needs to find all pods
|
||||||
// created by the same service, so that it can spread them correctly.
|
// created by the same service, so that it can spread them correctly.
|
||||||
@ -232,7 +226,7 @@ func (factory *ConfigFactory) createAssignedPodLW() *cache.ListWatch {
|
|||||||
|
|
||||||
// createMinionLW returns a cache.ListWatch that gets all changes to minions.
|
// createMinionLW returns a cache.ListWatch that gets all changes to minions.
|
||||||
func (factory *ConfigFactory) createMinionLW() *cache.ListWatch {
|
func (factory *ConfigFactory) createMinionLW() *cache.ListWatch {
|
||||||
return cache.NewListWatchFromClient(factory.Client, "minions", api.NamespaceAll, parseSelectorOrDie(""))
|
return cache.NewListWatchFromClient(factory.Client, "nodes", api.NamespaceAll, parseSelectorOrDie(""))
|
||||||
}
|
}
|
||||||
|
|
||||||
// Lists all minions and filter out unhealthy ones, then returns
|
// Lists all minions and filter out unhealthy ones, then returns
|
||||||
|
Loading…
Reference in New Issue
Block a user