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

Modified helm charts to allow for multiple persistent storages #71

Merged
merged 1 commit into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion repos/testing/rstudio/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ maintainers:
email: [email protected]
home: https://www.rstudio.com/products/RStudio/
icon: https://rstudio.com/wp-content/uploads/2018/10/RStudio-Logo-flat.svg
version: 0.4.2
version: 0.4.3
keywords:
- R web IDE
30 changes: 16 additions & 14 deletions repos/testing/rstudio/schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -74,20 +74,22 @@ properties:
examples:
- local-chart.example.com
persistentStorage:
type: object
properties:
existingClaim:
type: string
examples:
- ""
existingClaimName:
type: string
examples:
- example-name
subPath:
type: string
examples:
- /
type: array
items:
type: object
properties:
existingClaim:
type: string
examples:
- ""
existingClaimName:
type: string
examples:
- example-name
subPath:
type: string
examples:
- /
resources:
type: object
properties:
Expand Down
4 changes: 2 additions & 2 deletions repos/testing/rstudio/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ nobody:x:65534:65534:nobody:/nonexistent:/usr/sbin/nologin
_apt:x:100:65534::/nonexistent:/bin/false
rstudio-server:x:988:988::/home/rstudio-server:
shiny:x:998:998::/home/shiny:
{{ if ne .Values.persistentStorage.existingClaim "" }}
{{ if ne (first .Values.persistentStorage).existingClaim "" }}
{{ .Values.username }}:x:{{ .Values.uid }}:{{ .Values.gid }}::/home/{{ .Values.username }}:/bin/bash
{{ else }}
{{ .Values.username }}:x:{{ .Values.uid }}:{{ .Values.gid }}::/home/rstudio:/bin/bash
Expand Down Expand Up @@ -254,7 +254,7 @@ server-user={{ .Values.username }}
# Create rsession.conf
{{- define "rsession.conf" -}}
session-timeout-minutes=0
{{- if ne .Values.persistentStorage.existingClaim "" }}
{{- if ne (first .Values.persistentStorage).existingClaim "" }}
session-default-working-dir=/home/{{ .Values.username }}
{{- else }}
session-default-working-dir=/home/rstudio
Expand Down
42 changes: 24 additions & 18 deletions repos/testing/rstudio/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,12 @@ spec:
items:
- key: .Renviron
path: .Renviron
{{ if ne .Values.persistentStorage.existingClaim "" }}
- name: {{ .Values.persistentStorage.existingClaimName }}
{{ if ne (first .Values.persistentStorage).existingClaim "" }}
{{- range .Values.persistentStorage }}
- name: {{ .existingClaimName }}
persistentVolumeClaim:
claimName: {{ .Values.persistentStorage.existingClaim }}
claimName: {{ .existingClaim }}
{{- end }}
initContainers:
- name: busybox
image: busybox:1.33.1-glibc
Expand All @@ -99,12 +101,14 @@ spec:
- /bin/sh
- -c
- -x
- "mkdir -p /mnt/{{ .Values.persistentStorage.existingClaimName }}/.tools/{{ template "fullname" . }} /mnt/{{ .Values.persistentStorage.existingClaimName }}/home/{{ .Values.username }} && chmod g+w /mnt/{{ .Values.persistentStorage.existingClaimName }}/.tools /mnt/{{ .Values.persistentStorage.existingClaimName }}/home"
- "mkdir -p /mnt/{{ (first .Values.persistentStorage).existingClaimName }}/.tools/{{ template "fullname" . }} /mnt/{{ (first .Values.persistentStorage).existingClaimName }}/home/{{ .Values.username }} && chmod g+w /mnt/{{ (first .Values.persistentStorage).existingClaimName }}/.tools /mnt/{{ (first .Values.persistentStorage).existingClaimName }}/home"
volumeMounts:
- name: {{ .Values.persistentStorage.existingClaimName }}
mountPath: /mnt/{{ .Values.persistentStorage.existingClaimName }}
{{- range .Values.persistentStorage }}
- name: {{ .existingClaimName }}
mountPath: /mnt/{{ .existingClaimName }}
mountPropagation: HostToContainer
{{ end }}
{{- end }}
{{ end }}
hostname: {{ template "fullname" . }}
securityContext:
runAsNonRoot: true
Expand Down Expand Up @@ -168,11 +172,11 @@ spec:
value: {{ .Values.username }}
- name: HOME
value: /home/rstudio
{{- if ne .Values.persistentStorage.existingClaim "" }}
{{- if ne (first .Values.persistentStorage).existingClaim "" }}
- name: SHINY_APPS_PATH
value: /mnt/{{ .Values.persistentStorage.existingClaimName }}/.tools/{{ template "fullname" . }}/shiny-server
value: /mnt/{{ (first .Values.persistentStorage).existingClaimName }}/.tools/{{ template "fullname" . }}/shiny-server
- name: PVC_MOUNT_PATH
value: /mnt/{{ .Values.persistentStorage.existingClaimName }}
value: /mnt/{{ (first .Values.persistentStorage).existingClaimName }}
{{- end }}
volumeMounts:
- name: passwd
Expand All @@ -198,17 +202,19 @@ spec:
- name: renviron
mountPath: /home/rstudio/.Renviron
subPath: .Renviron
{{- if ne .Values.persistentStorage.existingClaim "" }}
- name: {{ .Values.persistentStorage.existingClaimName }}
mountPath: /mnt/{{ .Values.persistentStorage.existingClaimName }}
{{- if ne (first .Values.persistentStorage).existingClaim "" }}
{{- range .Values.persistentStorage}}
- name: {{ .existingClaimName }}
mountPath: /mnt/{{ .existingClaimName }}
mountPropagation: HostToContainer
readOnly: {{ .Values.persistentStorage.readOnly }}
{{ if ne .Values.persistentStorage.subPath "/" }}
subPath: {{ .Values.persistentStorage.subPath }}
readOnly: {{ .readOnly }}
{{ if ne .subPath "/" }}
subPath: {{ .subPath }}
{{ end }}
- name: {{ .Values.persistentStorage.existingClaimName }}
{{- end }}
- name: {{ (first .Values.persistentStorage).existingClaimName }}
mountPath: /home/{{ .Values.username }}
mountPropagation: HostToContainer
readOnly: {{ .Values.persistentStorage.readOnly }}
readOnly: {{ (first .Values.persistentStorage).readOnly }}
subPath: home/{{ .Values.username }}
{{- end -}}