-
Notifications
You must be signed in to change notification settings - Fork 993
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
webhook(hypernode): validate memberSelectorType #3887
base: network-topology
Are you sure you want to change the base?
webhook(hypernode): validate memberSelectorType #3887
Conversation
3f9cb67
to
b619821
Compare
This PR is based on volcano-sh/apis#144 |
2a0a247
to
107dd3d
Compare
{ | ||
Selector: hypernodev1alpha1.MemberSelector{ | ||
Type: hypernodev1alpha1.ExactMatchMemberSelectorType, | ||
ExactMatch: &hypernodev1alpha1.ExactMatch{Name: ""}, |
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.
This case should verify that ExactMatch is nil and then return an 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.
yes, i'll fix it.
{ | ||
Selector: hypernodev1alpha1.MemberSelector{ | ||
Type: hypernodev1alpha1.RegexMatchMemberSelectorType, | ||
RegexMatch: &hypernodev1alpha1.RegexMatch{ |
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.
Same as above, RegexMatch should be nil
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.
updated, please check again. thx
107dd3d
to
52f8399
Compare
52f8399
to
7885fa5
Compare
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
7885fa5
to
8c87ee3
Compare
8c87ee3
to
0556fec
Compare
0556fec
to
2449df7
Compare
) | ||
|
||
const ( | ||
HyperNodeLabel = "volcano.sh/hypernodes" |
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.
Also remove this code
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.
removed
} | ||
|
||
for _, member := range hypernode.Spec.Members { | ||
if member.Selector == (hypernodev1alpha1.MemberSelector{}) { |
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.
We must specify one of exactMatch
or regexMatch
. Better to change to
if member.Selector.ExactMatch == nil && member.Selector.RegexMatch == nil {
return fmt.Errorf("either exactMatch or regexMatch must be specified")
}
here
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.
updated!
2449df7
to
e0670d8
Compare
e0670d8
to
fe61a82
Compare
/ok-to-test |
/lgtm |
go.mod
Outdated
@@ -46,7 +46,7 @@ require ( | |||
sigs.k8s.io/controller-runtime v0.13.0 | |||
sigs.k8s.io/yaml v1.4.0 | |||
stathat.com/c/consistent v1.0.0 | |||
volcano.sh/apis v1.10.0-alpha.0.0.20241016111016-bb93758bd51f | |||
volcano.sh/apis v1.10.0-alpha.0.0.20241218081838-e5d361b6bfbe |
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.
There is a new patch in api repo, please user commit id 6ca7b0187107448a5477d08ade59dc31ac3a13a9
to update go mod.
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.
done!
Signed-off-by: xuwentao <cutenear1993@yahoo.com>
fe61a82
to
aad5dee
Compare
New changes are detected. LGTM label has been removed. |
Realted to: #3883
MemberSelector
fileds.HyperNode
labelvolcano.sh/hypernodes