Skip to content

Instantly share code, notes, and snippets.

@evankanderson
Last active March 31, 2020 22:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save evankanderson/15c6cd0f5ac91e504877ca6ce70e6278 to your computer and use it in GitHub Desktop.
Save evankanderson/15c6cd0f5ac91e504877ca6ce70e6278 to your computer and use it in GitHub Desktop.
What I want with callbacks.
// Callback is a generic function to be called by a consumer of validation
type Callback struct {
callback func(ctx context.Context, unstructured *unstructured.Unstructured) error
supportedVerbs map[admissionv1beta1.Operation]bool
}
func (c Callback) Process(....) {
// Do some stuff
}
cb := GetCallbackFromContext(ctx)
cb.Process(...)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment