-
Notifications
You must be signed in to change notification settings - Fork 250
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
Add defaulting webhook for Workload
resource
#220
Conversation
Run the command ``` kubebuilder create webhook --group kueue --version v1alpha1 --kind Workload --defaulting --programmatic-validation ``` And follow the instructions described in https://book.kubebuilder.io/cronjob-tutorial/running-webhook.html.
var _ webhook.Validator = &Workload{} | ||
|
||
// ValidateCreate implements webhook.Validator so a webhook will be registered for the type | ||
func (r *Workload) ValidateCreate() error { |
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.
Let's add some simple validation here like PodSet.Count
should be positive.
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.
Could we resolve this in a follow-up PR?
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.
I think this type of validation can be done using kubebuilder markers on the field;
// +kubebuilder:validation:Minimum=0
but I am not sure if it has the same limitations as // +kubebuilder:default=main
;
@ahg-g Hi! Thanks for your detailed review, I think your comments have been addressed, would you please take another look? |
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.
Thanks, this looks nice!
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.
Thanks, this looks nice!
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.
thanks, you can squash.
var _ webhook.Validator = &Workload{} | ||
|
||
// ValidateCreate implements webhook.Validator so a webhook will be registered for the type | ||
func (r *Workload) ValidateCreate() error { |
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.
I think this type of validation can be done using kubebuilder markers on the field;
// +kubebuilder:validation:Minimum=0
but I am not sure if it has the same limitations as // +kubebuilder:default=main
;
last question, did you try to deploy this on a real cluster? /lgtm feel free to cancel the hold |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: ahg-g, knight42 The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
@ahg-g Yes, and it works well.
|
/hold cancel |
This now requires installing cert-manager. Could you add it to the documentation? Are there alternatives? |
What type of PR is this?
/kind feature
What this PR does / why we need it:
Add basic defaulting webhook for
Workload
resource.Which issue(s) this PR fixes:
Part of #171
Special notes for your reviewer: