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

Add envs in cluster service api #432

Merged
merged 12 commits into from
Aug 4, 2022
Merged

Add envs in cluster service api #432

merged 12 commits into from
Aug 4, 2022

Conversation

MissiontoMars
Copy link
Contributor

@MissiontoMars MissiontoMars commented Aug 1, 2022

Why are these changes needed?

Add environment variables in ClusterService create cluster api. The json format looks like:

{
  "name": "test-cluster",
  "namespace": "ray-system",
  "user": "missiontomars",
  "version": "1.13",
  "environment": "DEV",
  "envs": {                            // Add envs here.
        "TEST_ENV2": "10000",
        "TEST_ENV3": "20000"
   },
  "clusterSpec": {
    "headGroupSpec": {
      "computeTemplate": "compute-templates-test1",
      "image": "kuberay/ray_test:91af42534b05995b818f9b4baa3acb57",
      "serviceType": "NodePort",
      "rayStartParams": {
        "node-ip-address": "$MY_POD_IP",
        "port": "6379",
        "dashboard-host": "0.0.0.0"
      },
      "volumes": []
    },
    "workerGroupSpec": [
      {
        "groupName": "workergroup1",
        "computeTemplate": "compute-templates-test1",
        "image": "hub.byted.org/kuberay/ray_test_hdfs:91af42534b05995b818f9b4baa3acb57",
        "replicas": 2,
        "minReplicas": 2,
        "maxReplicas": 2,
        "rayStartParams": {
        "node-ip-address": "$MY_POD_IP"
      },
        "volumes": []
      }
    ]
  }
}

The ray operator set the environment variables in envs fields to all containers in the ray cluster.

Related issue number

Checks

  • I've made sure the tests are passing.
  • Testing Strategy
    • Unit tests
    • Manual tests
    • This PR is not tested :(

@MissiontoMars MissiontoMars changed the title [WIP]Add envs in cluster service api Add envs in cluster service api Aug 2, 2022
@MissiontoMars
Copy link
Contributor Author

@Jeffwan This PR is ready to review. :)

ray-operator/controllers/ray/raycluster_controller.go Outdated Show resolved Hide resolved
@@ -589,6 +589,9 @@ func setContainerEnvVars(pod *v1.Pod, rayContainerIndex int, rayNodeType rayiov1
}
}
}

// Set all fields in envs to the container.
container.Env = append(container.Env, envs...)
Copy link
Collaborator

Choose a reason for hiding this comment

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

If we already set envs in the podTemplate, this would be unnecessary. this method set additional environments.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

@MissiontoMars
Copy link
Contributor Author

@Jeffwan Maybe we can merge this PR now.

@Jeffwan Jeffwan merged commit 7ded191 into ray-project:master Aug 4, 2022
lowang-bh pushed a commit to lowang-bh/kuberay that referenced this pull request Sep 24, 2023
* debug

* debug complete

* remove useless code

* add unit test

* fix lint

* fix tests

* fix tests

* fix tests

* do not modify crd

* fix lint

* revert useless

* fix duplicated envs
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