Skip to content
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

In code CRD validation #106

Closed
wants to merge 1 commit into from
Closed

In code CRD validation #106

wants to merge 1 commit into from

Conversation

alok87
Copy link
Contributor

@alok87 alok87 commented Jul 17, 2020

Adds in code CRD validation, since could not figure out quickly reading the docs on how to do it using the OpenAPIV3 spec. Created: https://stackoverflow.com/questions/62953678/openapiv3-conditional-validation-between-properties

Fixes #92

@alok87 alok87 force-pushed the add-validations branch from ed2115d to 033e760 Compare July 17, 2020 13:07
@alok87 alok87 added the wip label Jul 17, 2020
// validate check if the caller has set the right fields.
func validate(s *v1alpha1.WorkerPodAutoScaler) error {
if *s.Spec.MaxReplicas < 1 {
return fmt.Errorf("'max' is a required parameter and must be at least 1")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be useful to set max=0 sometimes (like when you want to temporarily disable processing of jobs). Also, we can put the static CRD validations like this one in the OpenAPI spec itself. min >= 0 and max >= 0 makes sense for me.

@alok87
Copy link
Contributor Author

alok87 commented Aug 4, 2020

Will recreate a PR when i start working on it. This code is not getting executed. Need to figure out why.

@alok87 alok87 closed this Aug 4, 2020
@alok87 alok87 deleted the add-validations branch August 13, 2020 07:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

minReplicas can be manually edited to be set more than maxReplicas, no validations
2 participants