-
Notifications
You must be signed in to change notification settings - Fork 39
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
RStudio not inheriting gh-scoped-creds env vars #5551
Comments
Here is one general approach without making it specific to gh-scoped-creds:
This is code in Renviron.site, but it doesn't violate the spirit of the file I think. This way we could add any number of different env vars without having to alter the setup code each time. I'll think about it a little more though. The configmap would be redundant with the extra env vars, so maybe there's a way to consolidate. |
More spitballing... In hub/templates/gh-scoped-creds.yaml we'd have: {{ if .Values.ghScopedCreds.enabled }}
apiVersion: v1
kind: ConfigMap
metadata:
name: gh-scoped-creds
data:
GH_SCOPED_CREDS_CLIENT_ID: {{ .Values.ghScopedCreds.clientID | quote }}
GH_SCOPED_CREDS_APP_URL: {{ .Values.ghScopedCreds.appURL | quote }}
{{ end }} This is similar to how we define NFS server config per hub. We'd set the default in hub/values.yaml: ghScopedCreds:
enabled: false And we'd prepare hub-specific config at deployments/deployment_name/config/common.yaml: ghScopedCreds:
enabled: true
clientID: ...client ID...
appURL: ...app url... Then in singleuser.extraEnv we'd export the configmap as env vars: - name: GH_SCOPED_CREDS_CLIENT_ID
valueFrom:
configMapKeyRef:
name: gh-scoped-creds
key: GH_SCOPED_CREDS_CLIENT_ID
- name: GH_SCOPED_CREDS_APP_URL
valueFrom:
configMapKeyRef:
name: gh-scoped-creds
key: GH_SCOPED_CREDS_APP_URL And in singleuser we make the configmap available as a file: extraVolumes:
- name: gh-scoped-creds
configMap:
name: gh-scoped-creds
extraVolumeMounts:
- name: gh-scoped-creds
mountPath: /etc/R/Renviron.d/gh-scoped-creds.env
subPath: gh-scoped-creds.env
readOnly: true This lets us set the gh-scoped-creds key/values once in per-deployment config, and it will both export them in the environment, and make the vars available via file for RStudio to pick up. All at the expense of more yaml up front. The alternative is to add the env vars within files to the singleuser image, which involves rebuilds for small changes. I wonder if we can sweep up the latter two sections above into the template or in some other conditional way, since they'd be boilerplate whenever ghScopedCreds is enabled. @shaneknapp Thoughts? I'll test this with manual hubploys before I make a PR since I've never created a template before. I'll need to modify /etc/R/Renviron.site with a separate PR as described above. @balajialg Once I'm confident that the env vars are being passed to RStudio correctly, I'll make a PR that defines the variables for dlab. |
Another alternative is to use singleuser.extraFiles. This is simpler, but we'd have to set the variables twice: once in extraEnv and once in extraFiles. (along with the code addition to Renviron.site) singleuser:
extraFiles:
gh-scoped-creds:
mountPath: /etc/R/Renviron.d/gh-scoped-creds.r
stringData: |
GH_SCOPED_CREDS_APP_URL=...
GH_SCOPED_CREDS_CLIENT_ID=...
mode: 0644 I have a feeling this is the right choice, although the configmap method would be interesting if it could be streamlined. |
This should enable R and RStudio to read dynamically created files. Part of berkeley-dsep-infra#5551.
@ryanlovett my post-doc suggested to me -- would it be possible to install |
@cboettig The |
@ryanlovett I tried testing gh-scoped-creds from R Studio's terminal in D Lab hub, I entered
I invoked gh-scoped-creds in lab and it seems to work fine (ref: snapshot). What am I doing wrong while invoking gh-scoped-creds in R Studio?
|
The client ID and app URL are reversed. Preparing a fix... |
@balajialg and I discovered over slack that any open RStudio Terminals will need to be restarted. This is true even if RStudio was launched in a previous jupyterhub session. |
looks good for me too on dlab-staging 🎉 Will this make it to the main r.datahub / datahub? btw, Yuvi and I dug into the official |
@cboettig Okay, great. Yes, we can make the vars available on the other hubs in the same way. I need to add this config setup to our docs too. |
@cboettig When it comes to the other hubs which serve larger communities, there may need to be more than one pair of variables set. We could set the env vars based on course enrollments, although even then there could be conflicts. It isn't a problem now because most courses/communities don't take advantage of the tool, but we'll need to sort out how to support it before there is a conflict. |
This should enable R and RStudio to read dynamically created files. Part of berkeley-dsep-infra#5551.
Originally posted by @cboettig in #5515 (comment)
The text was updated successfully, but these errors were encountered: