Commit Graph

13 Commits

Author SHA1 Message Date
Dave Protasowski 8535fcc248
gofumpt the repo (#3067)
* gofumpt the repo

* don't prefix numbers with 0 - otherwise they're octal
2024-06-25 07:27:07 +00:00
Dave Protasowski 44d1d7d978
Go1.19 changes (#2631)
* run goimports

* ignore linter errors for now

* fix boilerplate
2022-11-03 22:34:05 +00:00
Matt Moore 3bed4dcf17
Make the configmap update logging Debugf (#2226) 2021-08-22 13:30:34 -07:00
Francesco Guardiani 9e655c6b02
Port tracing setup code to pkg (#1807)
* 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>
2020-10-14 11:45:31 -07:00
Markus Thömmes f45b641fc2
Check example-checksum label for consistency in ConfigMap webhook. (#1366)
* 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.
2020-06-02 10:48:17 -07:00
Markus Thömmes 4f178c83ca
Make onAfterStore synchronous to the update itself. (#1349)
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.
2020-05-25 10:35:48 -07:00
Nima Kaviani d90ec6a015 add config validation as admission controller (#636) 2019-09-22 07:23:10 -07:00
Matt Moore 6785699dc3 Revert "Remove reflection from generic store code. (#583)" (#585)
This reverts commit d6f38dd906.
2019-08-20 19:17:32 -07:00
Markus Thömmes d6f38dd906 Remove reflection from generic store code. (#583) 2019-08-20 10:38:31 -07:00
Victor Agababov 4f3cebba76 This prints better log when CM is loaded. (#548)
Now we just print a struct, which is unparseable.
With this change in hand each field will have a name.

/assign @mattmoor
2019-07-29 15:23:42 -07:00
Markus Thömmes b35531d473 Move ExampleKey constant to 'official' package. (#481) 2019-06-23 08:08:57 -07:00
Adam Harwayne 5548112eb7 Defaulting watcher (#415)
* 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.
2019-05-16 07:09:18 -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