-
Notifications
You must be signed in to change notification settings - Fork 883
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
Enable Dynamic Admission Control for Application #1619
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1619 +/- ##
==========================================
+ Coverage 62.00% 62.26% +0.25%
==========================================
Files 120 120
Lines 11899 11900 +1
==========================================
+ Hits 7378 7409 +31
+ Misses 3761 3725 -36
- Partials 760 766 +6
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
if allErrs := h.ValidateUpdate(ctx, app, oldApp); len(allErrs) > 0 { | ||
return admission.Errored(http.StatusUnprocessableEntity, allErrs.ToAggregate()) | ||
if app.ObjectMeta.DeletionTimestamp.IsZero() { | ||
if allErrs := h.ValidateUpdate(ctx, app, oldApp); len(allErrs) > 0 { |
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.
if allErrs := h.ValidateUpdate(ctx, app, oldApp); len(allErrs) > 0 { | |
if len(h.ValidateUpdate(ctx, app, oldApp)) > 0 { |
Better? :)
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.
This cannot be modified here, because the following logic needs to return the error in allErrs
@@ -98,5 +99,5 @@ func (h *ValidatingHandler) Handle(ctx context.Context, req admission.Request) a | |||
// RegisterValidatingHandler will register application validate handler to the webhook | |||
func RegisterValidatingHandler(mgr manager.Manager, args controller.Args) { | |||
server := mgr.GetWebhookServer() | |||
server.Register("/validating-core-oam-dev-v1alpha2-applications", &webhook.Admission{Handler: &ValidatingHandler{dm: args.DiscoveryMapper, pd: args.PackageDiscover}}) | |||
server.Register("/validating-core-oam-dev-v1beta1-applications", &webhook.Admission{Handler: &ValidatingHandler{dm: args.DiscoveryMapper, pd: args.PackageDiscover}}) |
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.
What will happed if there the old webhook is already registered and running in a cluster?
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.
In fact, vela has never enable the Admission Control for Application
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.
good job
* add webhook * fix test * fix validating_handler
* add webhook * fix test * fix validating_handler
enable dynamic admission control for Application, the admissionWebhooks will check the correctness of the fields in Application.