-
Notifications
You must be signed in to change notification settings - Fork 867
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -85,9 +85,10 @@ func (h *ValidatingHandler) Handle(ctx context.Context, req admission.Request) a | |
if err := h.Decoder.DecodeRaw(req.AdmissionRequest.OldObject, oldApp); err != nil { | ||
return admission.Errored(http.StatusBadRequest, err) | ||
} | ||
|
||
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 { | ||
return admission.Errored(http.StatusUnprocessableEntity, allErrs.ToAggregate()) | ||
} | ||
} | ||
default: | ||
// Do nothing for DELETE and CONNECT | ||
|
@@ -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 commentThe 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 commentThe 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.
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