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

RHOAIENG-16604: feat(RStudio): grab proxy-related env vars from container env context and set them in R default environment #797

Conversation

shalberd
Copy link
Contributor

@shalberd shalberd commented Dec 5, 2024

https://issues.redhat.com/browse/RHOAIENG-16604

@guimou Needed so that R proxy settings do not need to be done at user-home level, instead globally, if the information is already present in notebook container env vars.
https://support.posit.co/hc/en-us/articles/200488488-Configuring-R-to-Use-an-HTTP-or-HTTPS-Proxy

Description

added one more line to startup script, similar to the already-existing KUBERNETES_ env variables.
Only difference in R Studio is, key needs to be lowercased.

How Has This Been Tested?

command-line tested, tested in ~/.Renviron
Created a new project in R studio with version control.
Url of Git used required use of proxy cause it is not directly accessible.
Worked fine.

If this PR can create a PR- labeled notebook image R studio, I can test, too.

Merge criteria:

  • The commits are squashed in a cohesive manner and have meaningful messages.
  • Testing instructions have been added in the PR body (for PRs involving changes that are not immediately obvious).
  • The developer has manually tested the changes and verified that the changes work

Copy link
Contributor

openshift-ci bot commented Dec 5, 2024

Hi @shalberd. Thanks for your PR.

I'm waiting for a opendatahub-io member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@shalberd shalberd changed the title added grabbing proxy-related env vars from container env context RStudio added grabbing proxy-related env vars from container env context Dec 5, 2024
@shalberd shalberd force-pushed the RStudio_make_workbench_container_proxyenv_vars_available_REnviron branch from e57eb03 to 6aa943b Compare December 5, 2024 15:55
@jiridanek jiridanek changed the title RStudio added grabbing proxy-related env vars from container env context RHOAIENG-16604: RStudio added grabbing proxy-related env vars from container env context and setting them in R default environment Dec 5, 2024
@jiridanek jiridanek changed the title RHOAIENG-16604: RStudio added grabbing proxy-related env vars from container env context and setting them in R default environment RHOAIENG-16604: feat(RStudio) grab proxy-related env vars from container env context and set them in R default environment Dec 5, 2024
@jiridanek jiridanek changed the title RHOAIENG-16604: feat(RStudio) grab proxy-related env vars from container env context and set them in R default environment RHOAIENG-16604: feat(RStudio): grab proxy-related env vars from container env context and set them in R default environment Dec 5, 2024
@shalberd
Copy link
Contributor Author

shalberd commented Dec 6, 2024

/retest

@shalberd
Copy link
Contributor Author

shalberd commented Dec 9, 2024

Hi @jiridanek unsure why the tests fail on setup of the cluster, not execution, it seems.

Same for the other PR #798

@jstourac
Copy link
Member

jstourac commented Dec 9, 2024

Hi @shalberd, thank you for this contribution. The change seems fine, I put one comment there. The failed tests are probably because of the env instability of the big image building.

If you want to check the final image that is based on your changes, you can get the image from https://quay.io/repository/opendatahub/workbench-images?tab=tags&tag=latest and use filter for -pr-797.

@shalberd shalberd force-pushed the RStudio_make_workbench_container_proxyenv_vars_available_REnviron branch 2 times, most recently from fbcec28 to a1b1789 Compare December 9, 2024 15:25
@shalberd
Copy link
Contributor Author

shalberd commented Dec 10, 2024

@jiridanek @jstourac tested with built image quay.io/opendatahub/workbench-images:rstudio-c9s-python-3.9-pr-797

situation before:

pre-image Change with env variables

Terminal Container

(app-root) sh-5.1$ cat /usr/lib64/R/etc/Renviron.site
KUBERNETES_SERVICE_PORT_HTTPS=443
KUBERNETES_SERVICE_PORT=443
KUBERNETES_PORT_443_TCP=tcp://172.30.0.1:443
KUBERNETES_PORT_443_TCP_PROTO=tcp
KUBERNETES_PORT_443_TCP_ADDR=172.30.0.1
KUBERNETES_SERVICE_HOST=172.30.0.1
KUBERNETES_PORT=tcp://172.30.0.1:443
KUBERNETES_PORT_443_TCP_PORT=443


(app-root) sh-5.1$ env | grep PROXY
NO_PROXY=.cluster.local,.ocp4.intra.com,.intra.com,.svc,.mycloud.com,10.0.0.0/16,10.0.0.0/8,10.128.0.0/14,127.0.0.1,172.30.0.0/16
HTTPS_PROXY=http://my-proxy.mycompany.com:9999
HTTP_PROXY=http://my-proxy.mycompany.com:9999

Terminal in R Studio GUI:

[1001350000@r-studio-stand-november-2024-0 ~]$ env | grep KUBERNETES
KUBERNETES_SERVICE_PORT_HTTPS=443
KUBERNETES_SERVICE_PORT=443
KUBERNETES_PORT_443_TCP=tcp://172.30.0.1:443
KUBERNETES_PORT_443_TCP_PROTO=tcp
KUBERNETES_PORT_443_TCP_ADDR=172.30.0.1
KUBERNETES_SERVICE_HOST=172.30.0.1
KUBERNETES_PORT=tcp://172.30.0.1:443
KUBERNETES_PORT_443_TCP_PORT=443

Container proxy-related env variables not available in R Studio and thus e.g. version Control / Git R Project pull times out

[1001350000@r-studio-stand-november-2024-0 ~]$ env | grep -i proxy
[1001350000@r-studio-stand-november-2024-0 ~]$

Image PR-797:

Terminal Container

(app-root) sh-5.1$ cat /usr/lib64/R/etc/Renviron.site
KUBERNETES_SERVICE_PORT_HTTPS=443
KUBERNETES_SERVICE_PORT=443
KUBERNETES_PORT_443_TCP=tcp://172.30.0.1:443
KUBERNETES_PORT_443_TCP_PROTO=tcp
KUBERNETES_PORT_443_TCP_ADDR=172.30.0.1
KUBERNETES_SERVICE_HOST=172.30.0.1
KUBERNETES_PORT=tcp://172.30.0.1:443
KUBERNETES_PORT_443_TCP_PORT=443
http_proxy=http://my-proxy.mycompany.com:9999
https_proxy=http://my-proxy.mycompany.com:9999
no_proxy=.cluster.local,.ocp4.intra.com,.intra.com,.svc,.mycloud.com,10.0.0.0/16,10.0.0.0/8,10.128.0.0/14,127.0.0.1,172.30.0.0/16

all previous KUBERNETES env variables in global file, as before, plus new the container proxy-related env variables:

(app-root) sh-5.1$ env | grep PROXY
NO_PROXY=.cluster.local,.ocp4.intra.com,.intra.com,.svc,.mycloud.com,10.0.0.0/16,10.0.0.0/8,10.128.0.0/14,127.0.0.1,172.30.0.0/16
HTTPS_PROXY=http://my-proxy.mycompany.com:9999
HTTP_PROXY=http://my-proxy.mycompany.com:9999

Terminal in R Studio GUI

[1001350000@r-studio-stand-november-2024-0 ~]$ env | grep KUBERNETES
KUBERNETES_SERVICE_PORT_HTTPS=443
KUBERNETES_SERVICE_PORT=443
KUBERNETES_PORT_443_TCP=tcp://172.30.0.1:443
KUBERNETES_PORT_443_TCP_PROTO=tcp
KUBERNETES_PORT_443_TCP_ADDR=172.30.0.1
KUBERNETES_SERVICE_HOST=172.30.0.1
KUBERNETES_PORT=tcp://172.30.0.1:443
KUBERNETES_PORT_443_TCP_PORT=443

same as before PR

[1001350000@r-studio-stand-november-2024-0 ~]$ env | grep -i proxy
no_proxy=.cluster.local,.ocp4.intra.com,.intra.com,.svc,.mycloud.com,10.0.0.0/16,10.0.0.0/8,10.128.0.0/14,127.0.0.1,172.30.0.0/16
https_proxy=http://my-proxy.mycompany.com:9999
http_proxy=http://my-proxy.mycompany.com:9999

now, proxy-related env vars are available in R Studio. Creating a new project with version control Gitlab / Github Url not listed in no_proxy no longer leads to timeout. Checkout successful.

Copy link
Contributor

openshift-ci bot commented Dec 11, 2024

@shalberd: shalberd unauthorized: /override is restricted to Repo administrators, approvers in top level OWNERS file, and the following github teams:.

In response to this:

/override ci/prow/images

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@shalberd
Copy link
Contributor Author

@shalberd: shalberd unauthorized: /override is restricted to Repo administrators, approvers in top level OWNERS file, and the following github teams:.

:-)

@jiridanek
Copy link
Member

OpenShift CI is having a bad day, looks like.

@shalberd
Copy link
Contributor Author

OpenShift CI is having a bad day, looks like.

that, and I was not able to override with /override, as I am not a maintainer

@jiridanek
Copy link
Member

there's enough time to override when the pr is about to go in; openshift-ci likes to retest just before merge, so overriding in advance turns to be a waste of time, usually

@shalberd
Copy link
Contributor Author

/retest

…, setting them in R global env file.

Also changed env var search to beginning-of-line regex format for all env vars.

Signed-off-by: shalberd <21118431+shalberd@users.noreply.github.com>
@shalberd shalberd force-pushed the RStudio_make_workbench_container_proxyenv_vars_available_REnviron branch from a1b1789 to 5721e3e Compare December 20, 2024 12:50
@shalberd
Copy link
Contributor Author

shalberd commented Dec 20, 2024

@jstourac @atheo89 rebased here, too, as R Studio Python 3.9 no longer present in main due to @jiridanek changes :-)

@shalberd shalberd requested a review from jstourac December 20, 2024 12:51
@atheo89
Copy link
Member

atheo89 commented Dec 20, 2024

Thank you Sven, for this enhancement!
/ok-to-test
/lgtm

@shalberd
Copy link
Contributor Author

/retest-required

@shalberd
Copy link
Contributor Author

Hi all, is there a general problem with those two jobs, image-build-related?
Screenshot 2024-12-22 at 14 26 45

@jiridanek
Copy link
Member

Hi all, is there a general problem with those two jobs, image-build-related?
Yeah, @caponetto filled https://issues.redhat.com/browse/RHOAIENG-16587 to have it fixed.

@jiridanek
Copy link
Member

/lgtm

@jiridanek
Copy link
Member

I'll be playing with the OCP-CI for a while, and then I'll override anything that did not pass.
/retest-required

@jiridanek
Copy link
Member

/approve

Copy link
Contributor

openshift-ci bot commented Dec 22, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jiridanek

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Copy link
Contributor

openshift-ci bot commented Dec 22, 2024

@shalberd: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/notebook-cuda-rstudio-c9s-python-3-9-pr-image-mirror a1b1789 link true /test notebook-cuda-rstudio-c9s-python-3-9-pr-image-mirror
ci/prow/runtimes-ubi9-e2e-tests a1b1789 link true /test runtimes-ubi9-e2e-tests
ci/prow/rocm-notebooks-e2e-tests a1b1789 link true /test rocm-notebooks-e2e-tests
ci/prow/rocm-runtimes-ubi9-e2e-tests a1b1789 link true /test rocm-runtimes-ubi9-e2e-tests
ci/prow/notebooks-ubi9-e2e-tests a1b1789 link true /test notebooks-ubi9-e2e-tests
ci/prow/intel-notebooks-e2e-tests a1b1789 link true /test intel-notebooks-e2e-tests
ci/prow/codeserver-notebook-e2e-tests a1b1789 link true /test codeserver-notebook-e2e-tests

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

@jiridanek
Copy link
Member

/override ci/prow/rstudio-notebook-e2e-tests

Copy link
Contributor

openshift-ci bot commented Dec 22, 2024

@jiridanek: Overrode contexts on behalf of jiridanek: ci/prow/rstudio-notebook-e2e-tests

In response to this:

/override ci/prow/rstudio-notebook-e2e-tests

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@jiridanek
Copy link
Member

/override ci/prow/images

Copy link
Contributor

openshift-ci bot commented Dec 22, 2024

@jiridanek: Overrode contexts on behalf of jiridanek: ci/prow/images

In response to this:

/override ci/prow/images

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@openshift-merge-bot openshift-merge-bot bot merged commit dfc40fe into opendatahub-io:main Dec 22, 2024
5 checks passed
@shalberd
Copy link
Contributor Author

thank you, @jiridanek can you do the same, please, for #798

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

Successfully merging this pull request may close these issues.

RStudio: make workbench env variables HTTP_PROXY and HTTPS_PROXY available in REnviron.site
5 participants