Commit Graph

9 Commits

Author SHA1 Message Date
Matt Moore 102237ce9b Simplify the core controller logic. (#184)
I was hoping to switch from a simple string key to a struct to include additional metadata into our workqueue item (in particular the time at which it was queued), but the great unit tests here reminded me that this would not properly deduplicate keys (they would have different queue times!), so I'm settling for simplifying the loop in a few ways:
1. Keys can only be strings, so remove some error checking and a test.
1. We were wrapping a block in a `func` because it contained `defer`, but the outer function had nothing in it.

I'd still like to try and find a way to track queue times for keys, so that we can surface two interesting metrics:
1. How long are things spending queued?
1. How long between events being observed and us responding? (above + reconcile latency)
2018-12-03 17:02:25 -08:00
mattmoor-sockpuppet d99eb0732f Run gofmt (#171)
Produced via: `gofmt -s -w $(find -name '*.go' | grep -v vendor)`
2018-11-26 07:18:22 -08:00
lichuqiang a5c260df2a Update EnqueueLabelOf to handle resources in same namespace (#166)
* update EnqueueLabelOf to handle resources in same namespace

* spit the EnqueueLabelOf func for namespaced/cluster-scoped resources
2018-11-19 19:04:20 -08:00
lichuqiang fcb0656514 requeue keys on error in controller (#149)
* requeue keys on error in controller

* remove maxRetries limit
2018-10-31 09:59:34 -07:00
lichuqiang d247efe41d update EnqueueControllerOf to properly handle Delete (#146)
* update EnqueueControllerOf to properly handle Delete

* update existing test

* add enqueue label tests

* address comments
2018-10-30 07:13:34 -07:00
Mustafa Demirhan 6c3ae54dda Add reconciler metrics (#127)
* Add reconciler metrics for queue depth, reconcile count & reconcile latency.

* Update deps.

* Change queue depth measurement type to int64 from float64

* Address PR comments

* Add extra unit tests.

* Minor fixes.

* Address PR comments by adding extra documentation

* Add tests for testing/fake_stats_reporter

* Addressed PR comments.

* Address PR comments.
2018-10-22 14:34:30 -07:00
Ivan Mikushin 62bcfe912f Prepare for global resync on ConfigMap changes (#132)
* Prepare for global resync on ConfigMap changes

- Add GlobalResync(cache.SharedInformer) method to *controller.Impl
- Move UntypedStore from serving/pkg/config to pkg/configmap
- Add onAfterStore callbacks to UntypedStore
- Add TypeFilter to enable composable construction of such callbacks

* Address review

- Unit test GlobalResync()
- Reimpl GlobalResync() using ListKeys()

* Update comments

* Add test for onAfterStore

* Update godoc comment for Logger
2018-10-18 09:47:28 -07:00
Matt Moore 4da41e302a Bump the sleep in the controller testing. (#88)
The rate limiting queue makes the sleep necessary.  Locally I see 0-2 failures when this is run with -count=10000.  This bumps the sleep slightly to reduce this further.

Fixes: https://github.com/knative/pkg/issues/56
2018-09-24 07:49:20 -07:00
Matt Moore bf6f9e373f Move our base controller infrastructure into knative/pkg. (#33)
The `controller.go` is from: https://github.com/knative/serving/pull/1770, however, this adds 100% coverage of `controller.go`, which we have been missing in `knative/serving`.

This also adds a `context.Context` to the `Reconcile` signature, to enable better sharing of logger setup across controllers.

Fixes: https://github.com/knative/pkg/issues/8
2018-08-01 14:32:37 -07:00