Skip to content

Commit

Permalink
Added Legal COO kubernetes Job.
Browse files Browse the repository at this point in the history
  • Loading branch information
danielscholl committed Nov 10, 2024
1 parent 913ce26 commit 2680602
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 1 deletion.
77 changes: 77 additions & 0 deletions charts/osdu-developer-base/templates/storage-container-job.yaml
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 }}
3 changes: 2 additions & 1 deletion software/applications/osdu-core/base.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,9 @@ spec:
defaultMemoryRequests: "1Gi"
defaultCpuLimits: "2"
defaultMemoryLimits: "4Gi"
share:
blobUpload:
enabled: true
container: "legal-service-azure-configuration"
items:
- name: legal
file: "Legal_COO.json"
Expand Down

0 comments on commit 2680602

Please sign in to comment.