You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to check if the other resources referenced by an object exist within a webhook. Could someone please help me complete the logic in the following code example? Thank you very much.
// SetupWebhookWithManager will setup the manager to manage the webhooksfunc (r*Pool) SetupWebhookWithManager(mgr ctrl.Manager) error {
returnctrl.NewWebhookManagedBy(mgr).
For(r).
Complete()
}
var_ webhook.Validator=&Pool{}
func (r*Pool) Validate() error {
varallErrs field.ErrorListmodel:=r.Spec.Model/* check model is exist here; */iflen(allErrs) ==0 {
returnnil
}
returnapierrors.NewInvalid(schema.GroupKind{Group: GroupVersion.Group, Kind: "Pool"}, r.Name, allErrs)
}
// ValidateCreate implements webhook.Validator so a webhook will be registered for the typefunc (r*Pool) ValidateCreate() (admission.Warnings, error) {
poollog.Info("validate create", "name", r.Name)
// TODO(user): fill in your validation logic upon object creation.returnnil, r.Validate()
}
The content you are editing has changed. Please copy your edits and refresh the page.
I want to check if the other resources referenced by an object exist within a webhook. Could someone please help me complete the logic in the following code example? Thank you very much.
Tasks
The text was updated successfully, but these errors were encountered: