From 0b55d0e9a80676ca04a2592406b154a9f6a6dd36 Mon Sep 17 00:00:00 2001 From: Michael Beigelmacher Date: Mon, 9 Mar 2026 14:22:34 -0400 Subject: [PATCH] add support for configuring uv in Workbench --- charts/rstudio-workbench/README.md | 14 +++++ charts/rstudio-workbench/README.md.gotmpl | 14 +++++ .../rstudio-workbench/templates/_helpers.tpl | 5 ++ .../templates/configmap-general.yaml | 4 ++ .../tests/deployment_test.yaml | 58 +++++++++++++++++++ .../application-configuration/index.qmd | 3 +- ...udio-workbench-recommended-app-config.yaml | 4 ++ 7 files changed, 101 insertions(+), 1 deletion(-) diff --git a/charts/rstudio-workbench/README.md b/charts/rstudio-workbench/README.md index 57fca5e36..2921156e6 100644 --- a/charts/rstudio-workbench/README.md +++ b/charts/rstudio-workbench/README.md @@ -273,6 +273,20 @@ pip can be configured with `config.session.pip.conf`: trusted-host: packagemanager.posit.co ``` +#### uv repositories + +[uv](https://docs.astral.sh/uv/) can be configured with `config.session.uv.toml`. When defined, the chart +automatically mounts the file to `/etc/uv/uv.toml` on both the server and session pods: + + ```yaml + config: + session: + uv.toml: | + [[index]] + url = "https://packagemanager.posit.co/pypi/latest/simple" + default = true + ``` + #### R repositories R package repositories can be configured with `config.session.repos.conf`: diff --git a/charts/rstudio-workbench/README.md.gotmpl b/charts/rstudio-workbench/README.md.gotmpl index ef29fd3c9..1f4721920 100644 --- a/charts/rstudio-workbench/README.md.gotmpl +++ b/charts/rstudio-workbench/README.md.gotmpl @@ -219,6 +219,20 @@ pip can be configured with `config.session.pip.conf`: trusted-host: packagemanager.posit.co ``` +#### uv repositories + +[uv](https://docs.astral.sh/uv/) can be configured with `config.session.uv.toml`. When defined, the chart +automatically mounts the file to `/etc/uv/uv.toml` on both the server and session pods: + + ```yaml + config: + session: + uv.toml: | + [[index]] + url = "https://packagemanager.posit.co/pypi/latest/simple" + default = true + ``` + #### R repositories R package repositories can be configured with `config.session.repos.conf`: diff --git a/charts/rstudio-workbench/templates/_helpers.tpl b/charts/rstudio-workbench/templates/_helpers.tpl index 5b785c0ed..49be971f6 100644 --- a/charts/rstudio-workbench/templates/_helpers.tpl +++ b/charts/rstudio-workbench/templates/_helpers.tpl @@ -129,6 +129,11 @@ containers: mountPath: "/etc/pip.conf" subPath: "pip.conf" {{- end }} + {{- if hasKey .Values.config.session "uv.toml" }} + - name: rstudio-session-config + mountPath: "/etc/uv/uv.toml" + subPath: "uv.toml" + {{- end }} {{- if .Values.config.sessionSecret }} - name: rstudio-session-secret mountPath: {{ .Values.session.defaultSecretMountPath }} diff --git a/charts/rstudio-workbench/templates/configmap-general.yaml b/charts/rstudio-workbench/templates/configmap-general.yaml index fa736d575..f06a4c99e 100644 --- a/charts/rstudio-workbench/templates/configmap-general.yaml +++ b/charts/rstudio-workbench/templates/configmap-general.yaml @@ -21,6 +21,10 @@ {{- $pipVolumeMount := dict "mountPath" "/etc/pip.conf" "subPath" "pip.conf" "name" "session-config" }} {{- $volumeMountList = append $volumeMountList $pipVolumeMount }} {{- end }} + {{- if hasKey .Values.config.session "uv.toml" }} + {{- $uvVolumeMount := dict "mountPath" "/etc/uv/uv.toml" "subPath" "uv.toml" "name" "session-config" }} + {{- $volumeMountList = append $volumeMountList $uvVolumeMount }} + {{- end }} {{- $_ := set $sessionTemplate.pod "volumeMounts" $volumeMountList }} {{- end }} {{- if .Values.config.sessionSecret}} diff --git a/charts/rstudio-workbench/tests/deployment_test.yaml b/charts/rstudio-workbench/tests/deployment_test.yaml index 27cedfe35..f3462eb55 100644 --- a/charts/rstudio-workbench/tests/deployment_test.yaml +++ b/charts/rstudio-workbench/tests/deployment_test.yaml @@ -728,3 +728,61 @@ tests: asserts: - exists: path: 'spec.template.spec.containers[?(@.name=="sidecarTest")]' + - it: should mount uv.toml to /etc/uv/uv.toml if config.session.uv.toml is defined + template: deployment.yaml + set: + config: + session: + uv.toml: | + [[index]] + url = "https://packagemanager.posit.co/pypi/latest/simple" + default = true + asserts: + - contains: + path: 'spec.template.spec.containers[0].volumeMounts' + content: + name: "rstudio-session-config" + mountPath: "/etc/uv/uv.toml" + subPath: "uv.toml" + any: true + - it: should not mount uv.toml if config.session.uv.toml is not defined + template: deployment.yaml + asserts: + - notContains: + path: 'spec.template.spec.containers[0].volumeMounts' + content: + name: "rstudio-session-config" + mountPath: "/etc/uv/uv.toml" + subPath: "uv.toml" + any: true + - it: should include uv.toml in the session configmap + template: configmap-session.yaml + set: + config: + session: + uv.toml: | + [[index]] + url = "https://packagemanager.posit.co/pypi/latest/simple" + default = true + asserts: + - isKind: + of: ConfigMap + - matchRegex: + path: data["uv.toml"] + pattern: 'packagemanager\.posit\.co' + - it: should include uv.toml volumeMount in launcher template when config.session.uv.toml is defined + template: configmap-general.yaml + documentSelector: + path: metadata.name + value: RELEASE-NAME-rstudio-workbench-templates + set: + config: + session: + uv.toml: | + [[index]] + url = "https://packagemanager.posit.co/pypi/latest/simple" + default = true + asserts: + - matchRegex: + path: data["rstudio-library-templates-data.tpl"] + pattern: '/etc/uv/uv\.toml' diff --git a/examples/workbench/application-configuration/index.qmd b/examples/workbench/application-configuration/index.qmd index ddfe11156..cc9ee4b50 100644 --- a/examples/workbench/application-configuration/index.qmd +++ b/examples/workbench/application-configuration/index.qmd @@ -11,7 +11,8 @@ These settings are recommend for most deployments and are described below: - [Set replicas > 1 to deploy Workbench load balanced across multiple pods](https://docs.posit.co/ide/server-pro/load_balancing/configuration.html) - [Set a default Posit Connect URL](https://docs.posit.co/ide/server-pro/rstudio_pro_sessions/rstudio_connect_server.html) - [Set a default Posit Package Manager CRAN URL](https://docs.posit.co/ide/server-pro/rstudio_pro_sessions/package_installation.html#cran-repositories) - - [Set a default Posit Package Manager PyPI URL](https://pip.pypa.io/en/stable/topics/configuration/) + - [Set a default Posit Package Manager PyPI URL for pip](https://pip.pypa.io/en/stable/topics/configuration/) + - [Set a default Posit Package Manager PyPI URL for uv](https://docs.astral.sh/uv/concepts/configuration-files/) - [Set RStudio Pro IDE timeout settings](https://docs.posit.co/ide/server-pro/admin/rstudio_pro_sessions/user_and_group_profiles.html) - [Set Jupyter IDE timeout settings](https://docs.posit.co/ide/server-pro/jupyter_sessions/configuration.html) - [Enable the administrator dashboard and set user group(s) to have admin and admin super user permissions](https://docs.posit.co/ide/server-pro/server_management/administrative_dashboard.html) diff --git a/examples/workbench/application-configuration/rstudio-workbench-recommended-app-config.yaml b/examples/workbench/application-configuration/rstudio-workbench-recommended-app-config.yaml index 9b1a4b71e..ee073200e 100644 --- a/examples/workbench/application-configuration/rstudio-workbench-recommended-app-config.yaml +++ b/examples/workbench/application-configuration/rstudio-workbench-recommended-app-config.yaml @@ -50,6 +50,10 @@ config: "global": index-url: https://packagemanager.posit.co/pypi/latest/simple # TODO: Change this URL to point to your own Package Manager PyPI URL if desired trusted-host: packagemanager.posit.co # TODO: Change this to match the domain name specified in `index-url`. Do NOT include http:// or https:// + uv.toml: | + [[index]] + url = "https://packagemanager.posit.co/pypi/latest/simple" # TODO: Change this URL to point to your own Package Manager PyPI URL if desired + default = true server: rserver.conf: admin-enabled: 1 # More information at https://docs.posit.co/ide/server-pro/server_management/administrative_dashboard.html