-
Notifications
You must be signed in to change notification settings - Fork 276
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 webhook for APIs defaulting and validation #171
Comments
@ahg-g Hi! I would like to volunteer! Could you please tell me the defaulting rule and the validation rule, such as which values needs defaulting? |
In terms of defaulting, we are using CRD defaults, like this one:
That works if you don't set it through a yaml. But I think it doesn't work if you submit the object through the client, like we do in
So you could start adding those defaults. Next, we can look into validation. We don't have an exhaustive list yet, but you could start validating all the enums and integers (most of them should only be positive). You can go through all the APIs and check what makes sense to validate. |
@alculquicondor Hi! Thanks for your comments, that would definitely be a good start! I am trying to follow the steps described in https://book.kubebuilder.io/cronjob-tutorial/webhook-implementation.html to scaffold the webhook, but I failed:
It seems the current project layout confused |
It seems that we didn't do a good job keeping the
|
Changing to the group to perhaps only update the paths. |
I think for kubebuilder tool to work smoothly we indeed need to move |
Opened #219 |
Now that we started with |
as a hole? Are we sold on the idea of not adding the node affinities to the Workload, but add them directly to the Job? |
Is there a setup where we would consider adding affinities to the workload itself? |
I'm trying to think of ways to avoid the custom controllers to look at the ResourceFlavors and only look at the Workload. Although, just directly modifying the Workload's pod specs is probably not the best idea. Maybe at admission time we can add the node labels somewhere in the So, you are right, making the PodSpecs immutable makes sense. |
Adding the labels to spec.admission makes sense I think. ok, lets round up the workload validation with making the spec immutable and then perhaps we focus on the next one, queue is probably the easier? @knight42 would you like to send a PR validating that the PodSet is immutable? |
Yeah I am glad to do that! |
Did you already add a webhook for Queue? It would be useful to make |
Nope, now there is only webhook for |
We should also validate Workload updates. We probably want to make most of the fields immutable. Also, we should disallow changing the queue of an Admitted workload. |
To track what is left, lets try and list the validations we want to do:
|
@alculquicondor anything else? |
edited the comment above |
/cc |
@kerthcet do you want to send a PR for CQ validation? |
Yes, I'll finish it soon. |
Almost there, only one left is validating CQ |
FYI: We only leave one validation now.
|
We need to do that as well, we have scheduling logic assuming that this is validated. |
Done |
A webhook for APIs defaulting and validation; see example: https://book.kubebuilder.io/cronjob-tutorial/webhook-implementation.html
The text was updated successfully, but these errors were encountered: