diff --git a/charts/blob-upload/Chart.yaml b/charts/blob-upload/Chart.yaml new file mode 100644 index 00000000..9df11430 --- /dev/null +++ b/charts/blob-upload/Chart.yaml @@ -0,0 +1,9 @@ +apiVersion: v2 +name: blob-upload +type: application +description: Uploads files to Azure Blob Storage +version: 0.0.3 +appVersion: 0.0.1 +maintainers: + - name: danielscholl + url: https://github.com/azure/osdu-developer \ No newline at end of file diff --git a/charts/blob-upload/templates/_helpers.tpl b/charts/blob-upload/templates/_helpers.tpl new file mode 100644 index 00000000..7bc1d801 --- /dev/null +++ b/charts/blob-upload/templates/_helpers.tpl @@ -0,0 +1,52 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Expand the name of the chart. +*/}} +{{- define "blob-upload.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "blob-upload.fullname" -}} +{{- if .Values.fullnameOverride }} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- $name := default .Chart.Name .Values.nameOverride }} +{{- if contains $name .Release.Name }} +{{- .Release.Name | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} +{{- end }} +{{- end }} +{{- end }} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "blob-upload.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "blob-upload.labels" -}} +helm.sh/chart: {{ include "blob-upload.chart" . }} +{{ include "blob-upload.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "blob-upload.selectorLabels" -}} +app.kubernetes.io/name: {{ include "blob-upload.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} \ No newline at end of file diff --git a/charts/osdu-developer-base/templates/storage-container-job.yaml b/charts/blob-upload/templates/storage-container-job.yaml similarity index 94% rename from charts/osdu-developer-base/templates/storage-container-job.yaml rename to charts/blob-upload/templates/storage-container-job.yaml index 11a9c297..e7eabba9 100644 --- a/charts/osdu-developer-base/templates/storage-container-job.yaml +++ b/charts/blob-upload/templates/storage-container-job.yaml @@ -1,8 +1,7 @@ {{- if (default false .Values.blobUpload.enabled) -}} -{{/* Create resources directly for each storage account */}} {{- $i := 0 }} -{{- range $key, $value := (lookup "v1" "ConfigMap" .Values.global.targetNamespace "configmap-services").data }} +{{- range $key, $value := (lookup "v1" "ConfigMap" .Values.global.configNamespace "configmap-services").data }} {{- if hasPrefix "partition_storage_name_" $key }} --- apiVersion: v1 @@ -86,4 +85,4 @@ {{- end }} {{- end }} -{{- end }}{{/* end if .Values.blobUpload.enabled */}} \ No newline at end of file +{{- end }} \ No newline at end of file diff --git a/charts/blob-upload/values.yaml b/charts/blob-upload/values.yaml new file mode 100644 index 00000000..4bfa3ad2 --- /dev/null +++ b/charts/blob-upload/values.yaml @@ -0,0 +1,15 @@ + +fullnameOverride: blob-upload + +################################################################################ +# Specify the azure environment specific values +# +azure: + enabled: true + tenantId: + clientId: + keyvaultName: + +blobUpload: + enabled: false + container: "legal-service-azure-configuration" diff --git a/charts/osdu-developer-base/values.yaml b/charts/osdu-developer-base/values.yaml index 8c9b14c3..82db7a6b 100644 --- a/charts/osdu-developer-base/values.yaml +++ b/charts/osdu-developer-base/values.yaml @@ -1,20 +1,3 @@ -# Copyright © Microsoft Corporation -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Default values for osdu-azure. -# This is a YAML-formatted file. -# Declare variables to be passed into your templates. fullnameOverride: osdu-svc diff --git a/software/applications/osdu-core/base.yaml b/software/applications/osdu-core/base.yaml index 8078f22b..16673f2b 100644 --- a/software/applications/osdu-core/base.yaml +++ b/software/applications/osdu-core/base.yaml @@ -24,8 +24,6 @@ spec: name: config-map-values valuesKey: values.yaml values: - global: - targetNamespace: osdu-core enableRequestAuthentication: true azure: enabled: true @@ -34,10 +32,41 @@ spec: defaultMemoryRequests: "1Gi" 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 + azure: + enabled: true blobUpload: enabled: true - storageAccounts: - - "partition_storage_name_0" items: - name: legal file: "Legal_COO.json"