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

Add rclone push example without credentials #37

Open
wants to merge 2 commits into
base: azure
Choose a base branch
from
Open
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
21 changes: 21 additions & 0 deletions inst/helm-chart/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,24 @@ csi:
{{- end -}}
{{- end -}}
{{- end -}}

{{/*
Extract the filename portion from a file path
*/}}
{{- define "biockubeinstall.getFilenameFromPath" -}}
{{- printf "%s" (. | splitList "/" | last) -}}
{{- end -}}

{{/*
Make string DNS-compliant by turning to lowercase then removing all noncompliant characters
*/}}
{{- define "biockubeinstall.makeDnsCompliant" -}}
{{- (printf "%s" (regexReplaceAll "[^a-z0-9-]" (. | lower) "")) | trunc 63 | trimSuffix "-" }}
{{- end -}}

{{/*
Get unique name for extra files
*/}}
{{- define "biockubeinstall.getExtraFilesUniqueName" -}}
{{- (printf "%s" (include "biockubeinstall.makeDnsCompliant" (printf "extra-%s-%s" (include "biockubeinstall.getFilenameFromPath" .) (. | sha256sum)))) }}
{{- end -}}
23 changes: 23 additions & 0 deletions inst/helm-chart/templates/extrafilemappings.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{{- range $key, $entry := .Values.extraFileMappings -}}
{{- if $entry }}
apiVersion: v1
metadata:
# Extract the filename portion only
name: {{ printf "%s-%s" "extrafiles" (include "biockubeinstall.getExtraFilesUniqueName" $key) }}
{{- if $entry.useSecret }}
kind: Secret
type: Opaque
stringData:
{{- else }}
kind: ConfigMap
data:
{{- end }}
{{- include "biockubeinstall.getFilenameFromPath" $key | nindent 2 }}: |
{{- if $entry.tpl }}
{{- tpl (tpl $entry.content $) $ | nindent 4 }}
{{- else }}
{{- $entry.content | nindent 4 }}
{{- end }}
---
{{- end }}
{{- end }}
85 changes: 83 additions & 2 deletions inst/helm-chart/templates/manager-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ metadata:
labels:
app: rstudio
spec:
containers:
initContainers:
- name: manager
image: {{ .Values.manager.image.repository }}:{{ .Values.manager.image.tag }}
imagePullPolicy: {{ .Values.pullPolicy }}
Expand All @@ -14,6 +14,13 @@ spec:
volumeMounts:
- name: nfs-data
mountPath: {{ .Values.persistence.mountPath }}
{{- range $key, $entry := .Values.extraFileMappings -}}
{{- if $entry.applyToManager }}
- name: {{ include "biockubeinstall.getExtraFilesUniqueName" $key }}
mountPath: {{ $key }}
subPath: {{ include "biockubeinstall.getFilenameFromPath" $key }}
{{- end }}
{{- end }}
env:
- name: PASSWORD
value: {{ .Values.rstudioPassword | quote }}
Expand All @@ -26,8 +33,82 @@ spec:
{{- tpl .Values.manager.extraCommand $ }};
{{- end -}}
{{ tpl .Values.manager.defaultCommand . }}
containers:
- name: osn-rclone-copy
image: rclone/rclone:latest
command:
- /bin/sh
- -c
args:
- rclone copyto /host/binary_{{ .Values.biocVersion | replace "." "_" }} osn:bir190004-bucket01/bioconductor-packages/{{ .Values.biocVersion }}/container-binaries/bioconductor_docker -v && rclone copyto /host/library_{{ .Values.biocVersion | replace "." "_" }} osn:bir190004-bucket01/bioconductor-packages/{{ .Values.biocVersion }}/container-binaries/bioconductor_docker/src/contrib -v && rclone copyto /host/logs_{{ .Values.biocVersion | replace "." "_" }} osn:bir190004-bucket01/bioconductor-packages/{{ .Values.biocVersion }}/container-binaries/bioconductor_docker/src/package_logs -v
volumeMounts:
- name: nfs-data
mountPath: {{ .Values.persistence.mountPath }}
{{- range $key, $entry := .Values.extraFileMappings -}}
{{- if $entry.applyToRclone }}
- name: {{ include "biockubeinstall.getExtraFilesUniqueName" $key }}
mountPath: {{ $key }}
subPath: {{ include "biockubeinstall.getFilenameFromPath" $key }}
{{- end }}
{{- end }}
resources:
requests:
memory: 100Mi
cpu: 100m
- name: azure-rclone-copy
image: rclone/rclone:latest
command:
- /bin/sh
- -c
args:
- rclone copyto /host/binary_{{ .Values.biocVersion | replace "." "_" }} azurebuckets:bioconductor-packages/{{ .Values.biocVersion }}/container-binaries/bioconductor_docker -v && rclone copyto /host/library_{{ .Values.biocVersion | replace "." "_" }} azurebuckets:bioconductor-packages/{{ .Values.biocVersion }}/container-binaries/bioconductor_docker/src/contrib -v && rclone copyto /host/logs_{{ .Values.biocVersion | replace "." "_" }} azurebuckets:bioconductor-packages/{{ .Values.biocVersion }}/container-binaries/bioconductor_docker/src/package_logs -v
volumeMounts:
- name: nfs-data
mountPath: {{ .Values.persistence.mountPath }}
{{- range $key, $entry := .Values.extraFileMappings -}}
{{- if $entry.applyToRclone }}
- name: {{ include "biockubeinstall.getExtraFilesUniqueName" $key }}
mountPath: {{ $key }}
subPath: {{ include "biockubeinstall.getFilenameFromPath" $key }}
{{- end }}
{{- end }}
resources:
requests:
memory: 100Mi
cpu: 100m
- name: gcp-rclone-copy
image: rclone/rclone:latest
command:
- /bin/sh
- -c
args:
- rclone copyto /host/binary_{{ .Values.biocVersion | replace "." "_" }} gcpbuckets:bioconductor-packages/{{ .Values.biocVersion }}/container-binaries/bioconductor_docker -v && rclone copyto /host/library_{{ .Values.biocVersion | replace "." "_" }} gcpbuckets:bioconductor-packages/{{ .Values.biocVersion }}/container-binaries/bioconductor_docker/src/contrib -v && rclone copyto /host/logs_{{ .Values.biocVersion | replace "." "_" }} gcpbuckets:bioconductor-packages/{{ .Values.biocVersion }}/container-binaries/bioconductor_docker/src/package_logs -v
volumeMounts:
- name: nfs-data
mountPath: {{ .Values.persistence.mountPath }}
{{- range $key, $entry := .Values.extraFileMappings -}}
{{- if $entry.applyToRclone }}
- name: {{ include "biockubeinstall.getExtraFilesUniqueName" $key }}
mountPath: {{ $key }}
subPath: {{ include "biockubeinstall.getFilenameFromPath" $key }}
{{- end }}
{{- end }}
resources:
requests:
memory: 100Mi
cpu: 100m
restartPolicy: {{ .Values.restartPolicy | quote}}
volumes:
- name: nfs-data
persistentVolumeClaim:
claimName: {{.Release.Namespace}}-nfs
claimName: {{.Release.Namespace}}-nfs
{{- range $key, $entry := .Values.extraFileMappings }}
- name: {{ include "biockubeinstall.getExtraFilesUniqueName" $key }}
{{- if $entry.useSecret }}
secret:
secretName: {{ printf "%s-%s" "extrafiles" (include "biockubeinstall.getExtraFilesUniqueName" $key) }}
{{- else }}
configMap:
name: {{ printf "%s-%s" "extrafiles" (include "biockubeinstall.getExtraFilesUniqueName" $key) }}
{{- end }}
{{- end }}
34 changes: 34 additions & 0 deletions inst/helm-chart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -90,3 +90,37 @@ redis:
redisImage: redis
redisImageTag: '5.0'
containerPort: 6379

extraFileMappings:
/root/.rclone.conf:
useSecret: true
applyToRclone: true
applyToManager: false
tpl: false
content: |
[azurebuckets]
sas_url = https://bioconductorhubs.blob.core.windows.net/bucketname?sp=rl&sas-secret
type = azureblob

[osn]
type = s3
provider = AWS
access_key_id = accesskey
secret_access_key = secretkey
endpoint = https://mghp.osn.xsede.org
acl = private
no_check_bucket = true

[awsopendata]
type = s3
provider = AWS
access_key_id = accesskey
secret_access_key = secretkey
acl = private

[gcpbuckets]
type = google cloud storage
service_account_file = /path/to/service_account
project_number = 12345678
object_acl = private
bucket_acl = private