-
Notifications
You must be signed in to change notification settings - Fork 480
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
[RayCluster] don't allow overriding ray.io/cluster label #2555
[RayCluster] don't allow overriding ray.io/cluster label #2555
Conversation
Steps to reproduce this bug:
|
(adding unit tests) |
Not related to this PR, but I am wondering if this line is incorrect
Shouldn't it be if k == utils.RayNodeTypeLabelKey { |
Actually I found this function very weird:
|
Maybe this is what the original author intended to do? WDYT @andrewsykim func labelPod(rayNodeType rayv1.RayNodeType, rayClusterName string, groupName string, labels map[string]string) map[string]string {
ret := map[string]string{
utils.RayNodeLabelKey: "yes",
utils.RayClusterLabelKey: rayClusterName,
utils.RayNodeTypeLabelKey: string(rayNodeType),
utils.RayNodeGroupLabelKey: groupName,
utils.RayIDLabelKey: utils.CheckLabel(utils.GenerateIdentifier(rayClusterName, rayNodeType)),
utils.KubernetesApplicationNameLabelKey: utils.ApplicationName,
utils.KubernetesCreatedByLabelKey: utils.ComponentName,
}
for k, v := range labels {
if _, ok := ret[k]; !ok {
ret[k] = v
}
}
return ret
} But I am not sure about the expected behavior of keys like |
996ed39
to
5abd28c
Compare
@MortalHappiness I noticed the same issues while adding tests, the existing code doesn't seem to be doing what it was intedned to do. I updated to fix the other labels, can you take a look? |
func labelPod(rayNodeType rayv1.RayNodeType, rayClusterName string, groupName string, labels map[string]string) map[string]string {
ret := map[string]string{
utils.RayNodeLabelKey: "yes",
utils.RayClusterLabelKey: rayClusterName,
utils.RayNodeTypeLabelKey: string(rayNodeType),
utils.RayNodeGroupLabelKey: groupName,
utils.RayIDLabelKey: utils.CheckLabel(utils.GenerateIdentifier(rayClusterName, rayNodeType)),
utils.KubernetesApplicationNameLabelKey: utils.ApplicationName,
utils.KubernetesCreatedByLabelKey: utils.ComponentName,
}
for k, v := range labels {
if _, ok := ret[k]; !ok {
ret[k] = v
}
}
return ret
} I didn't do this implementation because it seems like some labels are allowed to be overwritten, like |
5abd28c
to
992dc1b
Compare
Besides, the return value of this function should be changed from |
992dc1b
to
bbdf9e9
Compare
done |
bbdf9e9
to
ce1ab38
Compare
Signed-off-by: Andrew Sy Kim <[email protected]>
ce1ab38
to
7da2204
Compare
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.
LGTM
Why are these changes needed?
Currently it is possible to specify the
ray.io/cluster
label in the Head or Worker pod template. If the label value contains an incorrect cluster name, it will result in KubeRay doing an infinite loop of creating Pods since theray.io/cluster
label is used as a label selector.Similar to other labels like
ray.io/group
andray.io/node-type
, this PR ensures that overriding theray.io/cluster
is not possible.Related issue number
N/A
Checks