Skip to content

Commit

Permalink
fix controller: use Service's TargetPort
Browse files Browse the repository at this point in the history
instead of NodePort which is usually "0"
for updating RayCluster's `status.endpoints`.

follow up to ray-project#341
  • Loading branch information
davidxia committed Jul 15, 2022
1 parent a3b8fc6 commit fe427c1
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions ray-operator/controllers/ray/raycluster_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -684,10 +684,16 @@ func (r *RayClusterReconciler) updateStatus(instance *rayiov1alpha1.RayCluster)
}
for _, port := range svc.Spec.Ports {
if len(port.Name) == 0 {
r.Log.Info("updateStatus", "service port name is empty", port)
r.Log.Info("updateStatus", "service port's name is empty. Not adding it to RayCluster status.endpoints", port)
continue
}
instance.Status.Endpoints[port.Name] = fmt.Sprintf("%d", port.NodePort)
if port.TargetPort.IntVal != 0 {
instance.Status.Endpoints[port.Name] = fmt.Sprintf("%d", port.TargetPort.IntVal)
} else if port.TargetPort.StrVal != "" {
instance.Status.Endpoints[port.Name] = port.TargetPort.StrVal
} else {
r.Log.Info("updateStatus", "service port's targetPort is empty. Not adding it to RayCluster status.endpoints", port)
}
}
}
timeNow := metav1.Now()
Expand Down

0 comments on commit fe427c1

Please sign in to comment.