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

Improve ray-cluster.external-redis.yaml #986

Merged
merged 1 commit into from
Mar 25, 2023

Conversation

Yicheng-Lu-llll
Copy link
Contributor

@Yicheng-Lu-llll Yicheng-Lu-llll commented Mar 24, 2023

Why are these changes needed?

The Kuberay pull request #950 discusses using Redis password secrets as environment variables, as described in the Kubernetes documentation.

Specifically, a new environment variable RAY_REDIS_PASSWORD is created and assigned a value from a secret:

 - name: RAY_REDIS_PASSWORD
            valueFrom:
              secretKeyRef:
                name: redis-password-secret
                key: password

Additionally, the rayStartParams configuration includes a reference to this environment variable:

rayStartParams:
   redis-password: $REDIS_PASSWORD

However, the current Kuberay implementation sets another environment variable, REDIS_PASSWORD based on rayStartParams["redis-password"] if the user does not define it.

	if !envVarExists(REDIS_PASSWORD, container.Env) {
		// setting the REDIS_PASSWORD env var from the params
		port := v1.EnvVar{Name: REDIS_PASSWORD}
		if value, ok := rayStartParams["redis-password"]; ok {
			port.Value = value
		}
		container.Env = append(container.Env, port)
	}

This leads to issues:

  • As shown below, the REDIS_PASSWORD environment variable is redundant, as it only points to the RAY_REDIS_PASSWORD environment variable.
    Environment:
      RAY_REDIS_ADDRESS:               redis:6379
      RAY_REDIS_PASSWORD:              <set to the key 'password' in secret 'redis-password-secret'>  Optional: false
      RAY_CLUSTER_NAME:                 (v1:metadata.labels['ray.io/cluster'])
      RAY_PORT:                        6379
      RAY_ADDRESS:                     127.0.0.1:6379
      RAY_USAGE_STATS_KUBERAY_IN_USE:  1
      REDIS_PASSWORD:                  $RAY_REDIS_PASSWORD
      RAY_external_storage_namespace:  my-raycluster-storage-namespace

To resolve this, it is advisable to set RAY_REDIS_PASSWORD as REDIS_PASSWORD in the ray-cluster.external-redis.yaml to eliminate duplicate environment variables.

Related issue number

Checks

kubectl apply -f kuberay/ray-operator/config/samples/ray-cluster.external-redis.yaml
kubectl describe  $(kubectl get pods -o=name | grep head)
    Environment:
      RAY_REDIS_ADDRESS:               redis:6379
      REDIS_PASSWORD:                  <set to the key 'password' in secret 'redis-password-secret'>  Optional: false
      RAY_CLUSTER_NAME:                 (v1:metadata.labels['ray.io/cluster'])
      RAY_PORT:                        6379
      RAY_ADDRESS:                     127.0.0.1:6379
      RAY_USAGE_STATS_KUBERAY_IN_USE:  1
      RAY_external_storage_namespace:  my-raycluster-storage-namespace
  • I've made sure the tests are passing.
  • Testing Strategy
    • Unit tests
    • Manual tests
    • This PR is not tested :(

Signed-off-by: Yicheng-Lu-llll <luyc58576@gmail.com>
Copy link
Member

@kevin85421 kevin85421 left a comment

Choose a reason for hiding this comment

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

LGTM. The YAML file is included in the CI's config test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants