RedHatGov / serverless-workshop-dashboard

Lab guides for a workshop on OpenShift Serverless (Knative)
Apache License 2.0
5 stars 4 forks source link

lab 2.3 Export env variables command from OpenShift terminal to CRW Terminal #58

Closed gbengataylor closed 2 years ago

gbengataylor commented 3 years ago

Make it executable on the homeroom terminal then possibly change to


echo export AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY >> export.txt
echo export ENDPOINT_URL=$ENDPOINT_URL >> export.txt
echo export BUCKET_NAME=$BUCKET_NAME >> export.txt
echo export MODEL_FILE_NAME=model.pkl >> export.txt
cat export.txt```

ask attendees to cut and paste the output to CRW
theckang commented 3 years ago

another possibility - @andykrohg suggested that we make the export executable from homeroom and tunnel the command to run on CRW. something like

oc exec <crw-pod> -- export ...
andykrohg commented 3 years ago

That or we could do

oc rsh <crw-pod> -c python

export AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID
export AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY
export ENDPOINT_URL=$ENDPOINT_URL
export BUCKET_NAME=$BUCKET_NAME
export MODEL_FILE_NAME=model.pkl

FLASK_APP=prediction.py FLASK_ENV=development flask run
theckang commented 2 years ago

That or we could do

oc rsh <crw-pod> -c python

export AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID
export AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY
export ENDPOINT_URL=$ENDPOINT_URL
export BUCKET_NAME=$BUCKET_NAME
export MODEL_FILE_NAME=model.pkl

FLASK_APP=prediction.py FLASK_ENV=development flask run

I tested this, and unfortunately this does not work. The ENV variables don't carry over in the reverse shell session into the CRW pod. I will use the original suggestion of exporting to a text file and then outputting the contents.