Skip to content

Commit e579e66

Browse files
committed
fix: reference duplicate func and constant variables
1 parent 75e32a1 commit e579e66

File tree

3 files changed

+17
-18
lines changed

3 files changed

+17
-18
lines changed
Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
package v1
22

3-
// In KubeRay, the Ray container must be the first application container in a head or worker Pod.
4-
const RayContainerIndex = 0
3+
const (
4+
// In KubeRay, the Ray container must be the first application container in a head or worker Pod.
5+
RayContainerIndex = 0
56

6-
// Use as container env variable
7-
const RAY_REDIS_ADDRESS = "RAY_REDIS_ADDRESS"
7+
// Use as container env variable
8+
RAY_REDIS_ADDRESS = "RAY_REDIS_ADDRESS"
89

9-
// Ray GCS FT related annotations
10-
const RayFTEnabledAnnotationKey = "ray.io/ft-enabled"
10+
// Ray GCS FT related annotations
11+
RayFTEnabledAnnotationKey = "ray.io/ft-enabled"
12+
)

ray-operator/controllers/ray/utils/constant.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
package utils
22

3-
import "errors"
3+
import (
4+
"errors"
5+
6+
rayv1 "github.com/ray-project/kuberay/ray-operator/apis/ray/v1"
7+
)
48

59
const (
610

@@ -28,7 +32,7 @@ const (
2832
KubeRayVersion = "ray.io/kuberay-version"
2933

3034
// In KubeRay, the Ray container must be the first application container in a head or worker Pod.
31-
RayContainerIndex = 0
35+
RayContainerIndex = rayv1.RayContainerIndex
3236

3337
// Batch scheduling labels
3438
// TODO(tgaddair): consider making these part of the CRD
@@ -37,7 +41,7 @@ const (
3741
RayClusterGangSchedulingEnabled = "ray.io/gang-scheduling-enabled"
3842

3943
// Ray GCS FT related annotations
40-
RayFTEnabledAnnotationKey = "ray.io/ft-enabled"
44+
RayFTEnabledAnnotationKey = rayv1.RayFTEnabledAnnotationKey
4145
RayExternalStorageNSAnnotationKey = "ray.io/external-storage-namespace"
4246

4347
// If this annotation is set to "true", the KubeRay operator will not modify the container's command.
@@ -98,7 +102,7 @@ const (
98102
FQ_RAY_IP = "FQ_RAY_IP"
99103
RAY_PORT = "RAY_PORT"
100104
RAY_ADDRESS = "RAY_ADDRESS"
101-
RAY_REDIS_ADDRESS = "RAY_REDIS_ADDRESS"
105+
RAY_REDIS_ADDRESS = rayv1.RAY_REDIS_ADDRESS
102106
REDIS_PASSWORD = "REDIS_PASSWORD"
103107
RAY_DASHBOARD_ENABLE_K8S_DISK_USAGE = "RAY_DASHBOARD_ENABLE_K8S_DISK_USAGE"
104108
RAY_EXTERNAL_STORAGE_NS = "RAY_external_storage_namespace"

ray-operator/controllers/ray/utils/util.go

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -577,14 +577,7 @@ func IsJobFinished(j *batchv1.Job) (batchv1.JobConditionType, bool) {
577577
return "", false
578578
}
579579

580-
func EnvVarExists(envName string, envVars []corev1.EnvVar) bool {
581-
for _, env := range envVars {
582-
if env.Name == envName {
583-
return true
584-
}
585-
}
586-
return false
587-
}
580+
var EnvVarExists func(envName string, envVars []corev1.EnvVar) bool = rayv1.EnvVarExists
588581

589582
func UpsertEnvVar(envVars []corev1.EnvVar, newEnvVar corev1.EnvVar) []corev1.EnvVar {
590583
overridden := false

0 commit comments

Comments
 (0)