-
Notifications
You must be signed in to change notification settings - Fork 776
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
Validation/Mutating webhook for Fission resources #2577
Conversation
d070530
to
b930564
Compare
wLogger := logger.Named("webhook") | ||
|
||
// Setup a Manager | ||
mgr, err := manager.New(config.GetConfigOrDie(), manager.Options{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please enable metrics port here. I think we have 8080 across all components.
@@ -17,30 +17,12 @@ package signals | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should remove this package entirely.
322d6b5
to
9028ea0
Compare
// ValidateCreate implements webhook.Validator so a webhook will be registered for the type | ||
func (r *Environment) ValidateCreate() error { | ||
environmentlog.Info("validate create", "name", r.Name) | ||
err := r.Validate() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can directly return error from Validate call. Rest of code is unnecessary. Please do same changes at rest of places.
return r.Validate()
) | ||
|
||
// log is for logging in this package. | ||
var httptriggerlog = logf.Log.WithName("httptrigger-resource") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use GetLogger from "utils/loggerfactory" for consistency across Fission source code.
|
||
// ValidateCreate implements webhook.Validator so a webhook will be registered for the type | ||
func (r *HTTPTrigger) ValidateCreate() error { | ||
httptriggerlog.Info("validate create", "name", r.Name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please change all info statements from debug.
@@ -0,0 +1,84 @@ | |||
/* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please rename file to webhook.go
call k8s API from CLI for all resources
Description
Added Validation/Mutating Webhooks for Fission resources. It will test all API request before CRUD on resources.
Which issue(s) this PR fixes:
Fixes #
Testing
Checklist: