diff --git a/ray-operator/controllers/ray/common/pod.go b/ray-operator/controllers/ray/common/pod.go index 180aec0b1e3..baba7776a70 100644 --- a/ray-operator/controllers/ray/common/pod.go +++ b/ray-operator/controllers/ray/common/pod.go @@ -675,8 +675,9 @@ func concatenateContainerCommand(nodeType rayiov1alpha1.RayNodeType, rayStartPar func convertParamMap(rayStartParams map[string]string) (s string) { flags := new(bytes.Buffer) + nonFlagParams := []string{"log-color", "include-dashboard"} for k, v := range rayStartParams { - if strings.ToLower(v) == "true" { + if strings.ToLower(v) == "true" && !utils.Contains(nonFlagParams, k) { fmt.Fprintf(flags, " --%s ", k) } else { fmt.Fprintf(flags, " --%s=%s ", k, v) diff --git a/ray-operator/controllers/ray/common/pod_test.go b/ray-operator/controllers/ray/common/pod_test.go index c4a51332c28..d3cdf3ae9eb 100644 --- a/ray-operator/controllers/ray/common/pod_test.go +++ b/ray-operator/controllers/ray/common/pod_test.go @@ -38,6 +38,8 @@ var instance = rayiov1alpha1.RayCluster{ "object-store-memory": "100000000", "redis-password": "LetMeInRay", "num-cpus": "1", + "include-dashboard": "true", + "log-color": "true", }, Template: v1.PodTemplateSpec{ ObjectMeta: metav1.ObjectMeta{ @@ -562,6 +564,9 @@ func TestValidateHeadRayStartParams_OK(t *testing.T) { isValid, err := ValidateHeadRayStartParams(*input) assert.Equal(t, true, isValid) assert.Nil(t, err) + command := convertParamMap(input.RayStartParams) + assert.True(t, strings.Contains(command, "--include-dashboard=true")) + assert.True(t, strings.Contains(command, "--log-color=true")) } func TestValidateHeadRayStartParams_ValidWithObjectStoreMemoryError(t *testing.T) { diff --git a/ray-operator/controllers/ray/utils/util.go b/ray-operator/controllers/ray/utils/util.go index 74d8fa66388..15c4a08fd7c 100644 --- a/ray-operator/controllers/ray/utils/util.go +++ b/ray-operator/controllers/ray/utils/util.go @@ -4,7 +4,6 @@ import ( "fmt" "math" "reflect" - "sort" "strconv" "strings" "time" @@ -212,9 +211,13 @@ func CalculateAvailableReplicas(pods corev1.PodList) int32 { return count } -func Contains(s []string, searchTerm string) bool { - i := sort.SearchStrings(s, searchTerm) - return i < len(s) && s[i] == searchTerm +func Contains(elems []string, searchTerm string) bool { + for _, s := range elems { + if searchTerm == s { + return true + } + } + return false } func FilterContainerByName(containers []corev1.Container, name string) (corev1.Container, error) {