Skip to content
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][Feature] add redis username to head pod from GcsFaultToleranceOptions #2760

Merged
merged 3 commits into from
Jan 21, 2025
Merged
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
Prev Previous commit
Next Next commit
Resloved conflicts
Signed-off-by: win5923 <[email protected]>
win5923 committed Jan 20, 2025
commit 4abe1b171a255e825c9eee287746099780e71715
3 changes: 3 additions & 0 deletions ray-operator/controllers/ray/common/pod.go
Original file line number Diff line number Diff line change
@@ -148,6 +148,9 @@ func configureGCSFaultTolerance(podTemplate *corev1.PodTemplateSpec, instance ra
})
}
} else {
// If users directly set the `redis-username` in `rayStartParams` instead of referring
Copy link
Member

Choose a reason for hiding this comment

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

I am considering not adding any specific logic for redis-username (i.e. remove the change from L151 to L159) in the old configurations to avoid maintenance costs and to provide an incentive for users to migrate to the new API, GcsFaultToleranceOptions. HDYT @rueian?

Copy link
Contributor

Choose a reason for hiding this comment

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

ok, then should we make the incentive clear in the validateRayClusterSpec?

// to a K8s secret, we need to set the `REDIS_USERNAME` env var so that the Redis cleanup
// job can connect to Redis using the username.
if !utils.EnvVarExists(utils.REDIS_USERNAME, container.Env) {
// setting the REDIS_USERNAME env var from the params
redisUsernameEnv := corev1.EnvVar{Name: utils.REDIS_USERNAME}
8 changes: 7 additions & 1 deletion ray-operator/controllers/ray/common/pod_test.go
Original file line number Diff line number Diff line change
@@ -365,7 +365,6 @@ func TestConfigureGCSFaultToleranceWithAnnotations(t *testing.T) {
isHeadPod: false,
},
{
// The most common case.
name: "GCS FT enabled with redis username and password env and ray start params referring to env",
gcsFTEnabled: true,
redisUsernameEnv: "test-username",
@@ -389,6 +388,9 @@ func TestConfigureGCSFaultToleranceWithAnnotations(t *testing.T) {
for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
// Validate the test input
if test.redisUsernameEnv != "" && test.redisUsernameRayStartParams != "" {
assert.True(t, test.redisUsernameRayStartParams == "$REDIS_USERNAME")
}
if test.redisPasswordEnv != "" && test.redisPasswordRayStartParams != "" {
assert.True(t, test.redisPasswordRayStartParams == "$REDIS_PASSWORD")
}
@@ -475,6 +477,10 @@ func TestConfigureGCSFaultToleranceWithAnnotations(t *testing.T) {
assert.Equal(t, podTemplate.Annotations[utils.RayExternalStorageNSAnnotationKey], test.storageNS)
assert.True(t, utils.EnvVarExists(utils.RAY_EXTERNAL_STORAGE_NS, container.Env))
}
if test.redisUsernameEnv != "" {
env := getEnvVar(container, utils.REDIS_USERNAME)
assert.Equal(t, env.Value, test.redisUsernameEnv)
}
if test.redisPasswordEnv != "" {
env := getEnvVar(container, utils.REDIS_PASSWORD)
assert.Equal(t, env.Value, test.redisPasswordEnv)
181 changes: 0 additions & 181 deletions ray-operator/ray-cluster.external-redis.yaml

This file was deleted.