From 0abaff01d7bf777b6b592d161c6264ad5b3dd58e Mon Sep 17 00:00:00 2001 From: Fabian Schindler <fabian.schindler.strauss@gmail.com> Date: Thu, 5 Nov 2020 20:23:51 +0100 Subject: [PATCH] Fixing templates for registrar and preprocessor --- chart/files/preprocessor-config.yaml | 35 +++++++++--- chart/files/registrar-config.yaml | 56 +++++++++++++++++++ .../preprocessor-config-configmap.yaml | 2 +- chart/values.yaml | 14 +++-- 4 files changed, 92 insertions(+), 15 deletions(-) diff --git a/chart/files/preprocessor-config.yaml b/chart/files/preprocessor-config.yaml index bfedb5c3..5bdc957e 100644 --- a/chart/files/preprocessor-config.yaml +++ b/chart/files/preprocessor-config.yaml @@ -1,7 +1,8 @@ -{{- define "preprocessor.storage" }} +source: + {{- with .Values.config.objectStorage.download }} type: {{ .type }} kwargs: -{{- if eq .type "swift" }} + {{- if eq .type "swift" }} username: {{ .username }} password: {{ .password }} tenant_name: {{ .tenant_name }} @@ -10,17 +11,33 @@ auth_url: {{ .auth_url }} auth_version: {{ .auth_version }} user_domain_name: {{ .user_domain_name }} -{{- else if eq .type "s3" }} + {{- else if eq .type "s3" }} bucket: {{ .bucket }} endpoint_url: {{ .endpoint_url }} access_key_id: {{ .access_key_id }} secret_access_key: {{ .secret_access_key }} region: {{ .region }} -{{- end }} -{{- end -}} -source: - {{ template "preprocessor.storage" .Values.config.objectStorage.download | indent 2 }} + {{- end }} + {{- end }} target: - {{ template "preprocessor.storage" .Values.config.objectStorage.data | indent 2 }} - + {{- with .Values.config.objectStorage.data }} + type: {{ .type }} + kwargs: + {{- if eq .type "swift" }} + username: {{ .username }} + password: {{ .password }} + tenant_name: {{ .tenant_name }} + tenant_id: {{ .tenant_id }} + region_name: {{ .region_name }} + auth_url: {{ .auth_url }} + auth_version: {{ .auth_version }} + user_domain_name: {{ .user_domain_name }} + {{- else if eq .type "s3" }} + bucket: {{ .bucket }} + endpoint_url: {{ .endpoint_url }} + access_key_id: {{ .access_key_id }} + secret_access_key: {{ .secret_access_key }} + region: {{ .region }} + {{- end }} + {{- end }} {{ toYaml .Values.config.preprocessor | indent 2 }} diff --git a/chart/files/registrar-config.yaml b/chart/files/registrar-config.yaml index e69de29b..1dbc0876 100644 --- a/chart/files/registrar-config.yaml +++ b/chart/files/registrar-config.yaml @@ -0,0 +1,56 @@ +sources: + - kwargs: + {{- with .Values.config.objectStorage.download }} + type: {{ .type }} + name: name # TODO + kwargs: + {{- if eq .type "swift" }} + username: {{ .username }} + password: {{ .password }} + tenant_name: {{ .tenant_name }} + tenant_id: {{ .tenant_id }} + region_name: {{ .region_name }} + auth_url: {{ .auth_url }} + auth_version: {{ .auth_version }} + user_domain_name: {{ .user_domain_name }} + {{- else if eq .type "s3" }} + bucket: {{ .bucket }} + endpoint_url: {{ .endpoint_url }} + access_key_id: {{ .access_key_id }} + secret_access_key: {{ .secret_access_key }} + region: {{ .region }} + {{- end }} + {{- end }} + +schemes: + {{- range .Values.config.registrar.schemes | default list }} + - {{ toYaml . }} + {{- end }} + +backends: + - type: eoxserver + filter: + kwargs: + instance_base_path: /var/www/pvs/dev + instance_name: pvs_instance + + mapping: + {{- range $product_type_name, $product_type := .Values.config.products.types }} + {{ $product_type_name }}: + {{- range $level := list "Level_1" "Level_3" }} + {{ $level }}: + product_type_name: {{ $product_type_name | quote }} + collections: + {{- range $collection_name, $collection_conf := $.Values.config.collections }} + {{- if and (has $product_type_name $collection_conf.product_types) (has $level $collection_conf.product_levels) }} + - {{ $collection_name }} + {{- end }} + {{- end }} + coverages: + {{ toYaml $product_type.coverages }} + masks: + {{- range $mask_name, $_ := $product_type.masks }} + {{ $mask_name }}: {{ $mask_name }} + {{- end }} + {{- end }} + {{- end }} diff --git a/chart/templates/preprocessor-config-configmap.yaml b/chart/templates/preprocessor-config-configmap.yaml index ab379486..f74f8202 100644 --- a/chart/templates/preprocessor-config-configmap.yaml +++ b/chart/templates/preprocessor-config-configmap.yaml @@ -3,4 +3,4 @@ kind: ConfigMap metadata: name: {{ include "vs.fullname" . }}-preprocessor-config data: - {{ (tpl (.Files.Glob "files/preprocessor-config.yaml").AsConfig . ) | indent 2 }} + {{ (tpl (.Files.Glob "files/preprocessor-config.yaml").AsConfig . ) | nindent 2 }} diff --git a/chart/values.yaml b/chart/values.yaml index 37f53ad8..f9703715 100644 --- a/chart/values.yaml +++ b/chart/values.yaml @@ -41,11 +41,11 @@ config: user_domain_name: "user_domain_name" cache: type: S3 - bucket: "bucket:" - endpoint_url: "endpoint_url:" - access_key_id: "access_key_id:" - secret_access_key: "secret_access_key:" - region: "region:" + bucket: "bucket" + endpoint_url: "endpoint_url" + access_key_id: "access_key_id" + secret_access_key: "secret_access_key" + region: "region" redis: REDIS_HOST: redis REDIS_PORT: "6379" @@ -193,6 +193,10 @@ config: PH1B: # just to pass validation nested: true + registrar: + schemes: + - type: gsc + # mapping of collection name to objects collections: VHR_IMAGE_2018: -- GitLab