-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
913ce26
commit 2680602
Showing
3 changed files
with
79 additions
and
1 deletion.
There are no files selected for viewing
77 changes: 77 additions & 0 deletions
77
charts/osdu-developer-base/templates/storage-container-job.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
{{- if .Values.blobUpload.enabled -}} | ||
{{- $configMap := (lookup "v1" "ConfigMap" .Release.Namespace "configmap-services").data }} | ||
{{- $storageAccounts := list }} | ||
{{- range $key, $value := $configMap }} | ||
{{- if hasPrefix "partition_storage_name_" $key }} | ||
{{- $storageAccounts = append $storageAccounts $value }} | ||
{{- end }} | ||
{{- end }} | ||
|
||
{{- if $storageAccounts }} | ||
{{- range $storageAccount := $storageAccounts }} | ||
apiVersion: storage.k8s.io/v1 | ||
kind: StorageClass | ||
metadata: | ||
name: {{ $.Release.Name }}-blob-storage-{{ $storageAccount }} | ||
provisioner: blob.csi.azure.com | ||
parameters: | ||
storageAccount: {{ $storageAccount }} | ||
containerName: {{ $.Values.blobUpload.container }} | ||
clientID: {{ $.Values.blobUpload.clientId | default $configMap.azure_msi_client_id }} | ||
mountOptions: | ||
- -o allow_other | ||
- --file-cache-timeout-in-seconds=120 | ||
--- | ||
apiVersion: v1 | ||
kind: PersistentVolumeClaim | ||
metadata: | ||
name: {{ $.Release.Name }}-blob-pvc-{{ $storageAccount }} | ||
namespace: {{ $.Release.Namespace }} | ||
spec: | ||
accessModes: | ||
- ReadWriteMany | ||
resources: | ||
requests: | ||
storage: 5Gi | ||
storageClassName: {{ $.Release.Name }}-blob-storage-{{ $storageAccount }} | ||
--- | ||
{{- range $.Values.blobUpload.items }} | ||
apiVersion: batch/v1 | ||
kind: Job | ||
metadata: | ||
name: {{ $.Release.Name }}-blob-upload-{{ .name }}-{{ $storageAccount }} | ||
namespace: {{ $.Release.Namespace }} | ||
spec: | ||
ttlSecondsAfterFinished: 300 | ||
template: | ||
spec: | ||
serviceAccountName: workload-identity-sa | ||
volumes: | ||
- name: blob-storage | ||
persistentVolumeClaim: | ||
claimName: {{ $.Release.Name }}-blob-pvc-{{ $storageAccount }} | ||
containers: | ||
- name: blob-upload | ||
image: mcr.microsoft.com/cbl-mariner/base/core:2.0 | ||
command: ["/bin/sh"] | ||
args: | ||
- -c | ||
- | | ||
# Install curl | ||
tdnf install -y curl | ||
# Download the file | ||
echo "Downloading file from {{ .url }}" | ||
curl -kso {{ .file }} "{{ .url }}" | ||
# Copy to mounted blob container | ||
cp {{ .file }} /mnt/blob/{{ $.Values.blobUpload.container }}/{{ .file }} | ||
echo "File uploaded to container {{ $.Values.blobUpload.container }} in storage account {{ $storageAccount }}" | ||
volumeMounts: | ||
- name: blob-storage | ||
mountPath: /mnt/blob | ||
restartPolicy: Never | ||
{{- end }} | ||
{{- end }} | ||
{{- end }} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters