kuberay icon indicating copy to clipboard operation
kuberay copied to clipboard

[Enhancement] Env Setting using command output as value is not working

Open Jeffwan opened this issue 3 years ago • 0 comments

Search before asking

  • [X] I had searched in the issues and found no similar feature requirement.

Description

In Kubernetes, there's no way to set env using a cmd like below

    - name: CLASSPATH
      value: /opt/tiger/bin/hadoop classpath

There're multiple ways to do that.

Option 1: Set Env when building image

RUN export CLASSPATH=$(/xxxx/hadoop/bin/hadoop classpath --glob); echo $CLASSPATH

this won't work well because the container image doesn't have Hadoop directory mounted.. and there's no way to mount volume in build phase.

Another way to make it is to set environment variables.

RUN echo 'export CLASSPATH=`/opt/tiger/yarn_deploy/hadoop/bin/hadoop classpath --glob`' >> /root/.bashrc

Option 2: Custom command

          command:
            - /bin/bash
          args:
            - -c
            - |
            - export CLASSPATH=$(/opt/tiger/yarn_deploy/hadoop/bin/hadoop classpath --glob); echo ${CLASSPATH}

The tricky thing is once we enable --bock, the rest part of the command won't run.

  Args:
      ulimit -n 65536; ray start --head  --dashboard-host=0.0.0.0  --block  --system-config='{"ping_gcs_rpc_server_max_retries": 20}'  --node-ip-address=$MY_POD_IP  --port=6379  --redis-password=LetMeInRay  --no-monitor  &&  /bin/bash  -c    export CLASSPATH=$(/xxx/hadoop/bin/hadoop classpath --glob); echo ${CLASSPATH}

So how can we better support such cases?

Use case

No response

Related issues

No response

Are you willing to submit a PR?

  • [ ] Yes I am willing to submit a PR!

Jeffwan avatar Mar 22 '22 01:03 Jeffwan