Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 21 additions & 10 deletions ray-operator/controllers/ray/common/pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -504,20 +504,31 @@ func initLivenessAndReadinessProbe(rayContainer *corev1.Container, rayNodeType r
rayContainer.ReadinessProbe.Exec = &corev1.ExecAction{Command: []string{"bash", "-c", strings.Join(commands, " && ")}}
}

// For worker Pods serving traffic, we need to add an additional HTTP proxy health check for the readiness probe.
// For worker Pods serving traffic, the readiness probe checks the proxy
// instead of the raylet.
// Note: head Pod checks the HTTP proxy's health at every rayservice controller reconcile instaed of using readiness probe.
// See https://github.com/ray-project/kuberay/pull/1808 for reasons.
if creatorCRDType == utils.RayServiceCRD && rayNodeType == rayv1.WorkerNode {
rayContainer.ReadinessProbe.FailureThreshold = utils.ServeReadinessProbeFailureThreshold
rayServeProxyHealthCommand := fmt.Sprintf(
utils.BaseWgetHealthCommand,
utils.DefaultReadinessProbeInitialDelaySeconds,
utils.FindContainerPort(rayContainer, utils.ServingPortName, utils.DefaultServingPort),
utils.RayServeProxyHealthPath,
)
commands = append(commands, rayServeProxyHealthCommand)
rayContainer.ReadinessProbe.HTTPGet = nil
rayContainer.ReadinessProbe.Exec = &corev1.ExecAction{Command: []string{"bash", "-c", strings.Join(commands, " && ")}}
if httpHealthCheck {
rayContainer.ReadinessProbe.Exec = nil
rayContainer.ReadinessProbe.HTTPGet = &corev1.HTTPGetAction{
Path: utils.RayServeProxyHealthPath,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this makes, but just calling out the assumption that the server proxy health check likely depends on the raylet health already.

@rueian @Future-Outlier does it make sense to you?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will there ever be a case where serve proxy health check passes but raylet probe fails? Seems unlikely to me but maybe I'm missing something

Port: intstr.IntOrString{
Type: intstr.Int,
IntVal: utils.FindContainerPort(rayContainer, utils.ServingPortName, utils.DefaultServingPort),
},
}
} else {
rayServeProxyHealthCommand := fmt.Sprintf(
utils.BaseWgetHealthCommand,
utils.DefaultReadinessProbeInitialDelaySeconds,
utils.FindContainerPort(rayContainer, utils.ServingPortName, utils.DefaultServingPort),
utils.RayServeProxyHealthPath,
)
rayContainer.ReadinessProbe.HTTPGet = nil
rayContainer.ReadinessProbe.Exec = &corev1.ExecAction{Command: []string{"bash", "-c", rayServeProxyHealthCommand}}
}
}
}
}
Expand Down
11 changes: 6 additions & 5 deletions ray-operator/controllers/ray/common/pod_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1773,7 +1773,8 @@ func TestInitLivenessAndReadinessProbe(t *testing.T) {
}
initLivenessAndReadinessProbe(rayContainer, rayv1.WorkerNode, utils.RayServiceCRD, rayServiceWorkerParams, "")
rayServiceReadinessCommand := strings.Join(rayContainer.ReadinessProbe.Exec.Command, " ")
assert.Contains(t, rayServiceReadinessCommand, ":8500", "RayService worker should use custom dashboard-agent-listen-port")
rayServiceLivenessCommand := strings.Join(rayContainer.LivenessProbe.Exec.Command, " ")
assert.Contains(t, rayServiceLivenessCommand, ":8500", "RayService worker should use custom dashboard-agent-listen-port")
assert.Contains(t, rayServiceReadinessCommand, utils.RayServeProxyHealthPath, "RayService worker should include serve proxy health check")
assert.Equal(t, int32(utils.ServeReadinessProbeFailureThreshold), rayContainer.ReadinessProbe.FailureThreshold, "RayService worker should have correct failure threshold")

Expand Down Expand Up @@ -1813,15 +1814,15 @@ func TestInitLivenessAndReadinessProbe(t *testing.T) {
assert.NotNil(t, rayContainer.LivenessProbe.HTTPGet)
assert.NotNil(t, rayContainer.ReadinessProbe.HTTPGet)

// Ray Serve workers still use exec probes for readiness to check the proxy actor.
// Ray Serve workers check the proxy actor for readiness.
rayContainer.LivenessProbe = nil
rayContainer.ReadinessProbe = nil
initLivenessAndReadinessProbe(rayContainer, rayv1.WorkerNode, utils.RayServiceCRD, rayStartParams, "2.53.0")
assert.NotNil(t, rayContainer.LivenessProbe.HTTPGet)
assert.Nil(t, rayContainer.LivenessProbe.Exec)
assert.Nil(t, rayContainer.ReadinessProbe.HTTPGet)
assert.NotNil(t, rayContainer.ReadinessProbe.Exec)
assert.Contains(t, strings.Join(rayContainer.ReadinessProbe.Exec.Command, " "), utils.RayServeProxyHealthPath)
assert.Nil(t, rayContainer.ReadinessProbe.Exec)
assert.NotNil(t, rayContainer.ReadinessProbe.HTTPGet)
assert.Equal(t, int32(utils.DefaultServingPort), rayContainer.ReadinessProbe.HTTPGet.Port.IntVal)

// Versions parsed below 2.53 must use exec probes.
rayContainer.LivenessProbe = nil
Expand Down
Loading