Commit Graph

4 Commits

Author SHA1 Message Date
Jon Donovan dbd32a77f4
Normalize newlines in webhook example checksum. (#1404)
* Normalize newlines in webhook example checksum.

* Support windows newlines.

* Remove unnecessary non-capturing group.
2020-06-15 15:45:24 -07:00
Victor Agababov b7125260dc
Remove the trailing \n (#1381)
* fix the space issue

* merge shenanigans

* nit and tests
2020-06-05 10:07:18 -07:00
Markus Thömmes b0dc3661a7
Use a hexadecimal representation for the example checksum. (#1374) 2020-06-03 08:33:18 -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