* Port setup code to pkg
Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
* Moved prebuilt setups in config
Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
* Removed maybe useless code
Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
* Removed hardcoded configs and renamed defaultConfig() to NoopConfig()
Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
* Applied suggestions
Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
* Applied suggestions
Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
* Check example-hash label for consistency in ConfigMap webhook.
We've seen users try to edit our configuration and falling into the trap of editing the '_example' block a lot. This attempts at guiding the users to do "the right thing" by checking the ConfigMap's '_example' value (if present) against a precomputed hash of the same value (if present). The idea is that we precompute this has using the tool herein in code generation and thus allow us to easily change the example block automatically while making it hard to change it on ppurpose. If the hashes don't match on an upgrade, the webhook will return an error synchronously, guiding the user to the correct behavior.
* Add tests.
* Add hash check to test utilities.
* Add a bit of coverage.
* Rewrite into a table test.
* Rename.
* Reduce test surface.
* Godoc.
* Code nits.
* Docs.
* Use CRC32.
* Nits.
Generally, the `onAfterStore` function is used to kick off a global resync, which should be a very quick operation. Having `onAfterStore` being called asynchronously on a goroutine makes it very hard or straight out impossible to control it, especially in tests.
If there's a costly operation being done `onAfterStore`, it should be up to the caller to decide to make that asynchronous and thus put it into a goroutine.
* Add configmap.DefaultingWatcher that allows watched ConfigMaps to be defaulted in code.
* Add a test where the real K8s CM is deleted.
* Remove unused cmName.
* WatchWithDefault after start panics.
* cfgs -> defaults
* Initialize defaults in NewInformedWatcherFromFactory.
* Remove unneeded error in panic.
* 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