-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
⚠️ webhook redesign for generic case #323
⚠️ webhook redesign for generic case #323
Commits on Feb 21, 2019
-
Go vet entire pkg, turn goimports back on
This makes sure to run go vet on the examples and the alias file, and turns goimports back on.
Configuration menu - View commit details
-
Copy full SHA for ab62d27 - Browse repository at this point
Copy the full SHA ab62d27View commit details -
Make everything pass goimports
We had goimports turned off. When turned back on, it complained about a bunch of stuff. This fixes that.
Configuration menu - View commit details
-
Copy full SHA for f0ec881 - Browse repository at this point
Copy the full SHA f0ec881View commit details -
Fix example_test.go to use new list options
The example was still using the old list options arguments style (second argument instead of last argument), which made it fail to compile. This also makes sure we run go test on the whole project, instead of just pkg/...
Configuration menu - View commit details
-
Copy full SHA for eee0406 - Browse repository at this point
Copy the full SHA eee0406View commit details -
Fix admission webhook injection, no mgr, no client
The webhook server logic was not handling injection correctly -- it implemented injection for a couple of specific fields, rather than receiving and dealing with an injectfunc. This fixes that. As a side effect, it also removes the handle to manager and client from the webhook server, since those aren't used by the server, and should thus be injected from the manager.
Configuration menu - View commit details
-
Copy full SHA for 5963ad2 - Browse repository at this point
Copy the full SHA 5963ad2View commit details -
This flattens down the webhook package structure, removing dedicated `types` packages in favor of having things in the relevant places. To do this, the inject interface definitions for admission were also moved to the admission controller location, but they actually make some amount of sense living there. It also renames and restructures a couple of the types for code clarity (e.g. WebhookTypeMutating to MutatingWebhook) or to follow the convention of other types in CR (e.g. Making wrapped types from core Kubernetes nested fields).
Configuration menu - View commit details
-
Copy full SHA for 14f4abf - Browse repository at this point
Copy the full SHA 14f4abfView commit details -
Remove extraneous decoder interface
We don't have anywhere that we actually make use of decoder as an interface, so switch to just have a concrete implementation.
Configuration menu - View commit details
-
Copy full SHA for 6dbde68 - Browse repository at this point
Copy the full SHA 6dbde68View commit details -
Extract out multi-handler support, remove builder
This extracts out the multi-handler support into separate interfaces. That simplifies the code, makes it easier to test directly, and allows us to drop the now-extraneous Type field. This simultaneously removes the builder (for now) since it doesn't actually make anything simpler. Along the way, we also refactor some common functionality out into a helper on reponse itself as opposed to being run by different bits of the webhook.
Configuration menu - View commit details
-
Copy full SHA for c7969dc - Browse repository at this point
Copy the full SHA c7969dcView commit details -
Clean up tests to follow standards
This cleans up tests to more closely follow CR style, favoring behavior-style tests as opposed to pure unit tests.
Configuration menu - View commit details
-
Copy full SHA for 66be336 - Browse repository at this point
Copy the full SHA 66be336View commit details -
This renames a few ambigously named fields in the webhook server, removes some extraneous fields and methods, and removes the unnecessary constructor for Server.
Configuration menu - View commit details
-
Copy full SHA for 9a7de90 - Browse repository at this point
Copy the full SHA 9a7de90View commit details -
Remove the extraneous name field from webhooks
It was only being used for registering metrics, and that can be done with the path instead.
Configuration menu - View commit details
-
Copy full SHA for f46c199 - Browse repository at this point
Copy the full SHA f46c199View commit details -
Remove path from admission, more response helpers
This removes the path functionality from admission webhooks, since it's not strictly needed. Relevant metrics are moved up to the webhook server, and path is added to register. This also introduces a couple of helpers that should make code a bit clearer when writing admission webhooks (Allowed, Denied, Patched), and an alias file to avoid importing both webhook and webhook/admission.
Configuration menu - View commit details
-
Copy full SHA for 027ce71 - Browse repository at this point
Copy the full SHA 027ce71View commit details -
Construct and inject decoder into webhook handlers
This ensures that decoders (which are no longer constructed in the manager) are properly injected into webhook handlers. The webhook itself receives a scheme, which it uses to construct a decoder.
Configuration menu - View commit details
-
Copy full SHA for 1859301 - Browse repository at this point
Copy the full SHA 1859301View commit details -
Fix admission for decoding for unstructured
Due to a weird interaction between the unstructured decoder (which demands APIVersion and Kind fields) and the API server (which fails to set those fields on the embedded object in admission requests), we can't use the normal decoders, nor can we call json.Unmarshal directly on the unstructured (since it implements an unmarshaller that calls back into the decoder). This detects unstructured objects, and does the right thing for them.
Configuration menu - View commit details
-
Copy full SHA for 107c8e9 - Browse repository at this point
Copy the full SHA 107c8e9View commit details -
Move webhook examples to an actual Go example file
This moves the examples to an actual Go example file, so that we can be sure that they actually compile.
Configuration menu - View commit details
-
Copy full SHA for e08eee7 - Browse repository at this point
Copy the full SHA e08eee7View commit details -
Configuration menu - View commit details
-
Copy full SHA for 65a93df - Browse repository at this point
Copy the full SHA 65a93dfView commit details -
Rename ErrorResponse to Errored
It's the same name used in alias.go, and it produces less-verbose code without loss of readability.
Configuration menu - View commit details
-
Copy full SHA for 1a4bbe1 - Browse repository at this point
Copy the full SHA 1a4bbe1View commit details -
Remove inline admission examples
The were incorrect (would not have compiled), are mostly duplicates of examples/*webhook.go, and can't be easily checked for being up-to-date.
Configuration menu - View commit details
-
Copy full SHA for a866ee9 - Browse repository at this point
Copy the full SHA a866ee9View commit details -
This gives each webhook a log, so that serving errors can be tied to a particuluar webhook.
Configuration menu - View commit details
-
Copy full SHA for 34a4153 - Browse repository at this point
Copy the full SHA 34a4153View commit details -
Ensure the right deps are in Gopkg.log
Nothing was missing from the tree (due to transitive deps), just missing from being required by Gopkg.lock.
Configuration menu - View commit details
-
Copy full SHA for 286b0b4 - Browse repository at this point
Copy the full SHA 286b0b4View commit details