apis icon indicating copy to clipboard operation
apis copied to clipboard

Hypernode memberSelector validation rule error

Open JesseStutler opened this issue 10 months ago • 2 comments

Describe the bug

Image Currently, the kubebuilder validation in the memberSelector of hypernode is written to ensure that all three match cases cannot exist simultaneously, but the actual requirement is that only one should exist.

Expected behavior The current implementation does not check for the case where two matches exist at the same time. We should modify to like this:

// +kubebuilder:validation:XValidation:rule="has(self.exactMatch) || has(self.regexMatch) || has(self.labelMatch)",message="Either ExactMatch or RegexMatch or LabelMatch must be specified"
// +kubebuilder:validation:XValidation:rule="count([has(self.exactMatch), has(self.regexMatch), has(self.labelMatch)]) == 1",message="Only one of ExactMatch, RegexMatch, or LabelMatch can be specified"

JesseStutler avatar Mar 17 '25 04:03 JesseStutler

/assign @ecosysbin

JesseStutler avatar Mar 17 '25 04:03 JesseStutler

/assign

JesseStutler avatar Mar 28 '25 15:03 JesseStutler

https://github.com/volcano-sh/apis/pull/167 fixed it, close

JesseStutler avatar Apr 08 '25 11:04 JesseStutler