From 8679c0e9b5b98efdda1e42089478d98cb5977306 Mon Sep 17 00:00:00 2001 From: Jozef Kralik Date: Tue, 9 Jul 2024 16:01:43 +0000 Subject: [PATCH] helm/snippet-service: remove configuration for unsupported cqlDB --- charts/plgd-hub/templates/_helpers.tpl | 26 ++++++++++++++----- .../templates/snippet-service/config.yaml | 21 --------------- charts/plgd-hub/values.yaml | 4 +-- 3 files changed, 22 insertions(+), 29 deletions(-) diff --git a/charts/plgd-hub/templates/_helpers.tpl b/charts/plgd-hub/templates/_helpers.tpl index bfd4aabcf..d9e85a965 100644 --- a/charts/plgd-hub/templates/_helpers.tpl +++ b/charts/plgd-hub/templates/_helpers.tpl @@ -170,6 +170,19 @@ tls: useSystemCAPool: {{ $http.tls.useSystemCAPool }} {{- end }} +{{- define "plgd-hub.authorizationFilterEndpoints" }} + {{- $ := index . 0 }} + {{- $endpoints := index . 1 }} + {{- $result := list}} + {{- range $endpoints }} + {{- $authority := include "plgd-hub.resolveTemplateString" (list $ .authority) }} + {{- if $authority }} + {{- $result = append $result . }} + {{- end }} + {{- end }} + {{- dict "Values" $result | toYaml }} +{{- end }} + {{- define "plgd-hub.basicAuthorizationConfig" }} {{- $ := index . 0 }} {{- $authorization := index . 1 }} @@ -193,13 +206,14 @@ tls: {{- if eq (len $endpoints) 0 }} {{- $endpoints = $.Values.global.authorization.endpoints }} {{- end }} - {{- if eq (len $endpoints) 0 }} - {{- fail (printf "%s.authorization.endpoints or global.authorization.endpoints is required" $prefix) }} + {{- $mapEndpoints := include "plgd-hub.authorizationFilterEndpoints" (list $ $endpoints) | fromYaml }} + {{- if eq (len $mapEndpoints.Values) 0 }} + {{- fail (printf "%s.endpoints or global.authorization.endpoints is required" $prefix) }} {{- end}} {{- if not $.Values.mockoauthserver.enabled }} - audience: {{ include "plgd-hub.resolveTemplateString" (list $ $audience) }} + audience: {{ include "plgd-hub.resolveTemplateString" (list $ $audience) }} endpoints: - {{- range $endpoints }} + {{- range $mapEndpoints.Values }} {{- $authority := include "plgd-hub.resolveTemplateString" (list $ .authority) }} {{- if $authority }} - authority: {{ include "plgd-hub.resolveTemplateString" (list $ .authority) }} @@ -208,9 +222,9 @@ tls: {{- end }} {{- end }} {{- else }} - audience: {{ include "plgd-hub.resolveTemplateString" (list $ $audience) }} + audience: {{ include "plgd-hub.resolveTemplateString" (list $ $audience) }} endpoints: - {{- range $endpoints }} + {{- range $mapEndpoints.Values }} {{- $authority := include "plgd-hub.resolveTemplateString" (list $ .authority) }} {{- if not $authority }} {{- $authority = include "plgd-hub.mockoauthserver.uri" $ }} diff --git a/charts/plgd-hub/templates/snippet-service/config.yaml b/charts/plgd-hub/templates/snippet-service/config.yaml index 384f60237..9066fa720 100644 --- a/charts/plgd-hub/templates/snippet-service/config.yaml +++ b/charts/plgd-hub/templates/snippet-service/config.yaml @@ -71,27 +71,6 @@ data: {{- $mongoDbTls := .clients.storage.mongoDB.tls }} {{- include "plgd-hub.certificateConfig" (list $ $mongoDbTls $cert ) | indent 10 }} useSystemCAPool: {{ .clients.storage.mongoDB.tls.useSystemCAPool }} - cqlDB: - hosts: - {{- include "plgd-hub.cqlDBHosts" (list $ .clients.storage.cqlDB.hosts ) | indent 8 }} - port: {{ .clients.storage.cqlDB.port | default 9142 }} - table: {{ .clients.storage.cqlDB.table | quote }} - numConnections: {{ .clients.storage.cqlDB.numConnections }} - connectTimeout: {{ .clients.storage.cqlDB.connectTimeout }} - useHostnameResolution: {{ .clients.storage.cqlDB.useHostnameResolution }} - reconnectionPolicy: - constant: - interval: {{ .clients.storage.cqlDB.reconnectionPolicy.constant.interval }} - maxRetries: {{ .clients.storage.cqlDB.reconnectionPolicy.constant.maxRetries }} - keyspace: - name: {{ .clients.storage.cqlDB.keyspace.name }} - create: {{ .clients.storage.cqlDB.keyspace.create }} - replication: - {{- toYaml .clients.storage.cqlDB.keyspace.replication | nindent 14 }} - tls: - {{- $cqlDbTls := .clients.storage.cqlDB.tls }} - {{- include "plgd-hub.certificateConfig" (list $ $cqlDbTls $cert ) | indent 10 }} - useSystemCAPool: {{ .clients.storage.cqlDB.tls.useSystemCAPool }} resourceUpdater: cleanUpExpiredUpdates: {{ .clients.resourceUpdater.cleanUpExpiredUpdates | quote }} grpc: diff --git a/charts/plgd-hub/values.yaml b/charts/plgd-hub/values.yaml index 082f9e255..22099dbe4 100644 --- a/charts/plgd-hub/values.yaml +++ b/charts/plgd-hub/values.yaml @@ -29,7 +29,7 @@ global: audience: "{{ include \"plgd-hub.globalAudience\" . }}" endpoints: # -- Authorization endpoint to Customer OAuth server - - address: "{{ include \"plgd-hub.globalAuthority\" . }}" + - authority: "{{ include \"plgd-hub.globalAuthority\" . }}" http: maxIdleConns: 16 maxConnsPerHost: 32 @@ -41,7 +41,7 @@ global: keyFile: certFile: useSystemCAPool: true - - address: "{{ include \"plgd-hub.m2mOAuthServerAuthority\" . }}" + - authority: "{{ include \"plgd-hub.m2mOAuthServerAuthority\" . }}" http: maxIdleConns: 16 maxConnsPerHost: 32