Skip to content

Commit 0b55d0e

Browse files
committed
add support for configuring uv in Workbench
1 parent a74a7fb commit 0b55d0e

File tree

7 files changed

+101
-1
lines changed

7 files changed

+101
-1
lines changed

charts/rstudio-workbench/README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,20 @@ pip can be configured with `config.session.pip.conf`:
273273
trusted-host: packagemanager.posit.co
274274
```
275275

276+
#### uv repositories
277+
278+
[uv](https://docs.astral.sh/uv/) can be configured with `config.session.uv.toml`. When defined, the chart
279+
automatically mounts the file to `/etc/uv/uv.toml` on both the server and session pods:
280+
281+
```yaml
282+
config:
283+
session:
284+
uv.toml: |
285+
[[index]]
286+
url = "https://packagemanager.posit.co/pypi/latest/simple"
287+
default = true
288+
```
289+
276290
#### R repositories
277291

278292
R package repositories can be configured with `config.session.repos.conf`:

charts/rstudio-workbench/README.md.gotmpl

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,20 @@ pip can be configured with `config.session.pip.conf`:
219219
trusted-host: packagemanager.posit.co
220220
```
221221
222+
#### uv repositories
223+
224+
[uv](https://docs.astral.sh/uv/) can be configured with `config.session.uv.toml`. When defined, the chart
225+
automatically mounts the file to `/etc/uv/uv.toml` on both the server and session pods:
226+
227+
```yaml
228+
config:
229+
session:
230+
uv.toml: |
231+
[[index]]
232+
url = "https://packagemanager.posit.co/pypi/latest/simple"
233+
default = true
234+
```
235+
222236
#### R repositories
223237
224238
R package repositories can be configured with `config.session.repos.conf`:

charts/rstudio-workbench/templates/_helpers.tpl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,11 @@ containers:
129129
mountPath: "/etc/pip.conf"
130130
subPath: "pip.conf"
131131
{{- end }}
132+
{{- if hasKey .Values.config.session "uv.toml" }}
133+
- name: rstudio-session-config
134+
mountPath: "/etc/uv/uv.toml"
135+
subPath: "uv.toml"
136+
{{- end }}
132137
{{- if .Values.config.sessionSecret }}
133138
- name: rstudio-session-secret
134139
mountPath: {{ .Values.session.defaultSecretMountPath }}

charts/rstudio-workbench/templates/configmap-general.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@
2121
{{- $pipVolumeMount := dict "mountPath" "/etc/pip.conf" "subPath" "pip.conf" "name" "session-config" }}
2222
{{- $volumeMountList = append $volumeMountList $pipVolumeMount }}
2323
{{- end }}
24+
{{- if hasKey .Values.config.session "uv.toml" }}
25+
{{- $uvVolumeMount := dict "mountPath" "/etc/uv/uv.toml" "subPath" "uv.toml" "name" "session-config" }}
26+
{{- $volumeMountList = append $volumeMountList $uvVolumeMount }}
27+
{{- end }}
2428
{{- $_ := set $sessionTemplate.pod "volumeMounts" $volumeMountList }}
2529
{{- end }}
2630
{{- if .Values.config.sessionSecret}}

charts/rstudio-workbench/tests/deployment_test.yaml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -728,3 +728,61 @@ tests:
728728
asserts:
729729
- exists:
730730
path: 'spec.template.spec.containers[?(@.name=="sidecarTest")]'
731+
- it: should mount uv.toml to /etc/uv/uv.toml if config.session.uv.toml is defined
732+
template: deployment.yaml
733+
set:
734+
config:
735+
session:
736+
uv.toml: |
737+
[[index]]
738+
url = "https://packagemanager.posit.co/pypi/latest/simple"
739+
default = true
740+
asserts:
741+
- contains:
742+
path: 'spec.template.spec.containers[0].volumeMounts'
743+
content:
744+
name: "rstudio-session-config"
745+
mountPath: "/etc/uv/uv.toml"
746+
subPath: "uv.toml"
747+
any: true
748+
- it: should not mount uv.toml if config.session.uv.toml is not defined
749+
template: deployment.yaml
750+
asserts:
751+
- notContains:
752+
path: 'spec.template.spec.containers[0].volumeMounts'
753+
content:
754+
name: "rstudio-session-config"
755+
mountPath: "/etc/uv/uv.toml"
756+
subPath: "uv.toml"
757+
any: true
758+
- it: should include uv.toml in the session configmap
759+
template: configmap-session.yaml
760+
set:
761+
config:
762+
session:
763+
uv.toml: |
764+
[[index]]
765+
url = "https://packagemanager.posit.co/pypi/latest/simple"
766+
default = true
767+
asserts:
768+
- isKind:
769+
of: ConfigMap
770+
- matchRegex:
771+
path: data["uv.toml"]
772+
pattern: 'packagemanager\.posit\.co'
773+
- it: should include uv.toml volumeMount in launcher template when config.session.uv.toml is defined
774+
template: configmap-general.yaml
775+
documentSelector:
776+
path: metadata.name
777+
value: RELEASE-NAME-rstudio-workbench-templates
778+
set:
779+
config:
780+
session:
781+
uv.toml: |
782+
[[index]]
783+
url = "https://packagemanager.posit.co/pypi/latest/simple"
784+
default = true
785+
asserts:
786+
- matchRegex:
787+
path: data["rstudio-library-templates-data.tpl"]
788+
pattern: '/etc/uv/uv\.toml'

examples/workbench/application-configuration/index.qmd

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ These settings are recommend for most deployments and are described below:
1111
- [Set replicas > 1 to deploy Workbench load balanced across multiple pods](https://docs.posit.co/ide/server-pro/load_balancing/configuration.html)
1212
- [Set a default Posit Connect URL](https://docs.posit.co/ide/server-pro/rstudio_pro_sessions/rstudio_connect_server.html)
1313
- [Set a default Posit Package Manager CRAN URL](https://docs.posit.co/ide/server-pro/rstudio_pro_sessions/package_installation.html#cran-repositories)
14-
- [Set a default Posit Package Manager PyPI URL](https://pip.pypa.io/en/stable/topics/configuration/)
14+
- [Set a default Posit Package Manager PyPI URL for pip](https://pip.pypa.io/en/stable/topics/configuration/)
15+
- [Set a default Posit Package Manager PyPI URL for uv](https://docs.astral.sh/uv/concepts/configuration-files/)
1516
- [Set RStudio Pro IDE timeout settings](https://docs.posit.co/ide/server-pro/admin/rstudio_pro_sessions/user_and_group_profiles.html)
1617
- [Set Jupyter IDE timeout settings](https://docs.posit.co/ide/server-pro/jupyter_sessions/configuration.html)
1718
- [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)

examples/workbench/application-configuration/rstudio-workbench-recommended-app-config.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@ config:
5050
"global":
5151
index-url: https://packagemanager.posit.co/pypi/latest/simple # TODO: Change this URL to point to your own Package Manager PyPI URL if desired
5252
trusted-host: packagemanager.posit.co # TODO: Change this to match the domain name specified in `index-url`. Do NOT include http:// or https://
53+
uv.toml: |
54+
[[index]]
55+
url = "https://packagemanager.posit.co/pypi/latest/simple" # TODO: Change this URL to point to your own Package Manager PyPI URL if desired
56+
default = true
5357
server:
5458
rserver.conf:
5559
admin-enabled: 1 # More information at https://docs.posit.co/ide/server-pro/server_management/administrative_dashboard.html

0 commit comments

Comments
 (0)