Skip to content

Commit

Permalink
fix apiserver created raycluster metrics port missing and check (#356)
Browse files Browse the repository at this point in the history
Co-authored-by: chenyu.jiang <[email protected]>
  • Loading branch information
scarlet25151 and chenyu.jiang authored Jul 7, 2022
1 parent bae7b6d commit cb75cd0
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
4 changes: 4 additions & 0 deletions apiserver/pkg/util/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,10 @@ func buildHeadPodTemplate(cluster *api.Cluster, spec *api.HeadGroupSpec, compute
Name: "dashboard",
ContainerPort: 8265,
},
{
Name: "metrics",
ContainerPort: 8080,
},
},
Resources: v1.ResourceRequirements{
Limits: v1.ResourceList{
Expand Down
13 changes: 12 additions & 1 deletion ray-operator/controllers/ray/common/pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,18 @@ func DefaultHeadPodTemplate(instance rayiov1alpha1.RayCluster, headSpec rayiov1a
Name: "metrics",
ContainerPort: int32(DefaultMetricsPort),
}
podTemplate.Spec.Containers[0].Ports = append(podTemplate.Spec.Containers[0].Ports, metricsPort)
dupIndex := -1
for i, port := range podTemplate.Spec.Containers[0].Ports {
if port.Name == metricsPort.Name {
dupIndex = i
break
}
}
if dupIndex < 0 {
podTemplate.Spec.Containers[0].Ports = append(podTemplate.Spec.Containers[0].Ports, metricsPort)
} else {
podTemplate.Spec.Containers[0].Ports[dupIndex] = metricsPort
}

return podTemplate
}
Expand Down

0 comments on commit cb75cd0

Please sign in to comment.