Skip to content

Commit

Permalink
Updated
Browse files Browse the repository at this point in the history
  • Loading branch information
danielscholl committed Nov 12, 2024
1 parent e892552 commit e7a709c
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 84 deletions.
25 changes: 13 additions & 12 deletions bicep/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -948,18 +948,19 @@ module gitOpsUpload 'br/public:avm/res/resources/deployment-script:0.4.0' = [for
}
}]

module storageAcl 'modules/network_acl_storage.bicep' = {
name: '${configuration.name}-storage-acl'
params: {
storageName: storage.outputs.name
location: location
skuName: configuration.storage.sku
natClusterIP: clusterBlade.outputs.natClusterIP
}
dependsOn: [
gitOpsUpload
]
}
//TODO: This can't be done yet.
// module storageAcl 'modules/network_acl_storage.bicep' = {
// name: '${configuration.name}-storage-acl'
// params: {
// storageName: storage.outputs.name
// location: location
// skuName: configuration.storage.sku
// natClusterIP: clusterBlade.outputs.natClusterIP
// }
// dependsOn: [
// gitOpsUpload
// ]
// }


/*
Expand Down
52 changes: 26 additions & 26 deletions bicep/modules/blade_partition.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -671,34 +671,34 @@ module partitonNamespace 'br/public:avm/res/service-bus/namespace:0.9.1' = [for


// TODO: This should be moved to the Kubernetes Job.
// module blobUpload 'br/public:avm/res/resources/deployment-script:0.4.0' = [for (partition, index) in partitions: {
// name: '${bladeConfig.sectionName}-storage-blob-upload-${index}'
// params: {
// name: 'script-${storage[index].outputs.name}-Legal_COO'
// location: location
// cleanupPreference: 'Always'
// retentionInterval: 'PT1H'
// timeout: 'PT30M'
// runOnce: true
module blobUpload 'br/public:avm/res/resources/deployment-script:0.4.0' = [for (partition, index) in partitions: {
name: '${bladeConfig.sectionName}-storage-blob-upload-${index}'
params: {
name: 'script-${storage[index].outputs.name}-Legal_COO'
location: location
cleanupPreference: 'Always'
retentionInterval: 'PT1H'
timeout: 'PT30M'
runOnce: true

// managedIdentities: {
// userAssignedResourcesIds: [
// stampIdentity.id
// ]
// }

// kind: 'AzureCLI'
// azCliVersion: '2.63.0'
managedIdentities: {
userAssignedResourcesIds: [
stampIdentity.id
]
}

kind: 'AzureCLI'
azCliVersion: '2.63.0'

// environmentVariables: [
// { name: 'CONTENT', value: loadTextContent('./deploy-scripts/Legal_COO.json') }
// { name: 'FILE_NAME', value: 'Legal_COO.json' }
// { name: 'CONTAINER', value: 'legal-service-azure-configuration' }
// { name: 'AZURE_STORAGE_ACCOUNT', value: storage[index].outputs.name }
// ]
// scriptContent: loadTextContent('./deploy-scripts/blob_upload.sh')
// }
// }]
environmentVariables: [
{ name: 'CONTENT', value: loadTextContent('./deploy-scripts/Legal_COO.json') }
{ name: 'FILE_NAME', value: 'Legal_COO.json' }
{ name: 'CONTAINER', value: 'legal-service-azure-configuration' }
{ name: 'AZURE_STORAGE_ACCOUNT', value: storage[index].outputs.name }
]
scriptContent: loadTextContent('./deploy-scripts/blob_upload.sh')
}
}]


// TODO: ACL can only be applied after the blob upload.
Expand Down
12 changes: 2 additions & 10 deletions charts/blob-upload/templates/storage-container-job.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,6 @@ metadata:
spec:
ttlSecondsAfterFinished: 300
template:
metadata:
labels:
azure.workload.identity/use: "true"
annotations:
azure.workload.identity/client-id: {{ $.Values.azure.clientId | quote }}
azure.workload.identity/tenant-id: {{ $.Values.azure.tenantId | quote }}
spec:
serviceAccountName: workload-identity-sa
containers:
Expand All @@ -35,10 +29,7 @@ spec:
curl -kso {{ .file }} "{{ .url }}"
# Login using workload identity
az login --service-principal \
--username {{ $.Values.azure.clientId }} \
--tenant {{ $.Values.azure.tenantId }} \
--identity
az login --identity
# Upload directly to blob storage using Azure CLI
az storage blob upload \
Expand All @@ -49,6 +40,7 @@ spec:
--auth-mode login
echo "File uploaded to container {{ $.Values.blobUpload.container }} in storage account {{ $value }}"
sleep 300000
restartPolicy: Never
{{- end }}
{{- $i = add $i 1 }}
Expand Down
72 changes: 36 additions & 36 deletions software/applications/osdu-core/base.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,39 +33,39 @@ spec:
defaultCpuLimits: "2"
defaultMemoryLimits: "4Gi"
---
apiVersion: helm.toolkit.fluxcd.io/v2beta1
kind: HelmRelease
metadata:
name: blob-upload
namespace: default
annotations:
clusterconfig.azure.com/use-managed-source: "true"
spec:
dependsOn:
- name: osdu-developer-base-core
namespace: default
targetNamespace: osdu-core
chart:
spec:
chart: ./charts/blob-upload
sourceRef:
kind: GitRepository
name: flux-system
namespace: flux-system
interval: 5m0s
install:
remediation:
retries: 3
valuesFrom:
- kind: ConfigMap
name: config-map-values
valuesKey: values.yaml
values:
global:
configmapNamespace: osdu-core
blobUpload:
enabled: true
items:
- name: legal
file: "Legal_COO.json"
url: "https://raw.githubusercontent.com/Azure/osdu-developer/refs/heads/main/bicep/modules/script-blob-upload/Legal_COO.json"
# apiVersion: helm.toolkit.fluxcd.io/v2beta1
# kind: HelmRelease
# metadata:
# name: blob-upload
# namespace: default
# annotations:
# clusterconfig.azure.com/use-managed-source: "true"
# spec:
# dependsOn:
# - name: osdu-developer-base-core
# namespace: default
# targetNamespace: osdu-core
# chart:
# spec:
# chart: ./charts/blob-upload
# sourceRef:
# kind: GitRepository
# name: flux-system
# namespace: flux-system
# interval: 5m0s
# install:
# remediation:
# retries: 3
# valuesFrom:
# - kind: ConfigMap
# name: config-map-values
# valuesKey: values.yaml
# values:
# global:
# configmapNamespace: osdu-core
# blobUpload:
# enabled: true
# items:
# - name: legal
# file: "Legal_COO.json"
# url: "https://raw.githubusercontent.com/Azure/osdu-developer/refs/heads/main/bicep/modules/script-blob-upload/Legal_COO.json"

0 comments on commit e7a709c

Please sign in to comment.