Last active
March 31, 2020 22:50
-
-
Save evankanderson/15c6cd0f5ac91e504877ca6ce70e6278 to your computer and use it in GitHub Desktop.
What I want with callbacks.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cb := GetCallbackFromContext(ctx) | |
cb.Process(...) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment