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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

shalberd
Copy link

@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

@openshift-ci openshift-ci bot requested review from atheo89 and paulovmr December 5, 2024 15:39
Copy link
Contributor

openshift-ci bot commented Dec 5, 2024

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign daniellutz for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found 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 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
Author

shalberd commented Dec 6, 2024

/retest

@shalberd
Copy link
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 from f68eb64 to fbcec28 Compare December 9, 2024 15:20
…, 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 <[email protected]>
@shalberd shalberd force-pushed the RStudio_make_workbench_container_proxyenv_vars_available_REnviron branch from fbcec28 to a1b1789 Compare December 9, 2024 15:25
Copy link
Contributor

openshift-ci bot commented Dec 9, 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/rstudio-notebook-e2e-tests a1b1789 link true /test rstudio-notebook-e2e-tests
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/images a1b1789 link true /test images

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.

@shalberd
Copy link
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
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
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

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
3 participants