blob: bb35e80848adc185f96574f3e7a3497585e2d1e8 [file] [log] [blame]
Jack Lucasd41dbdb2021-02-16 11:07:28 -05001{{/*
2# Copyright © 2017 Amdocs, Bell Canada
3# Modifications Copyright © 2019 AT&T
Jack Lucas838ce7e2023-07-18 17:52:13 -04004# Copyright (c) 2021-2023 J. F. Lucas. All rights reserved.
ajay_dp001cf5232a2021-04-13 20:48:07 +05305# Copyright (c) 2021 Nordix Foundation.
Jack Lucasd41dbdb2021-02-16 11:07:28 -05006#
7# Licensed under the Apache License, Version 2.0 (the "License");
8# you may not use this file except in compliance with the License.
9# You may obtain a copy of the License at
10#
11# http://www.apache.org/licenses/LICENSE-2.0
12#
13# Unless required by applicable law or agreed to in writing, software
14# distributed under the License is distributed on an "AS IS" BASIS,
15# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16# See the License for the specific language governing permissions and
17# limitations under the License.
18*/}}
19
20{{/*
21dcaegen2-services-common.configMap:
22This template produces Kubernetes configMap(s) needed by a
23DCAE microservice.
24
25The template expects the full chart context as input. A chart for a
26DCAE microservice references this template using:
27{{ include "dcaegen2-services-common.configMap" . }}
28The template directly references data in .Values, and indirectly (through its
29use of templates from the ONAP "common" collection) references data in
30.Release.
31
32The template always produces a configMap containing the microservice's
Jack Lucasf86f6292022-06-08 09:12:29 -040033initial configuration data. (See the documentation for
Jack Lucasd41dbdb2021-02-16 11:07:28 -050034dcaegen2-services-common.microserviceDeployment for more details.)
35
Jack Lucas838ce7e2023-07-18 17:52:13 -040036If the microservice is publishing to one or more Data Router (DR) feeds, the
Jack Lucasf86f6292022-06-08 09:12:29 -040037template produces a configMap containing the information needed to
38provision the feed(s). An init container performs the provisioning.
39
Jack Lucasf86f6292022-06-08 09:12:29 -040040If the microservice acts as a DR subscriber for one or more feeds, the
41template produces a configMap containing the information needed to
42provision the subscribeer(s). An init container performs the provisioning.
43
Jack Lucasd41dbdb2021-02-16 11:07:28 -050044*/}}
45
46{{- define "dcaegen2-services-common.configMap" -}}
Jack Lucasb880f892021-06-07 16:40:31 -040047{{- $appConf := .Values.applicationConfig | default (dict) -}}
Jack Lucasd41dbdb2021-02-16 11:07:28 -050048apiVersion: v1
49kind: ConfigMap
50metadata:
51 name: {{ include "common.fullname" . }}-application-config-configmap
52 namespace: {{ include "common.namespace" . }}
53 labels: {{ include "common.labels" . | nindent 6 }}
54data:
55 application_config.yaml: |
Jack Lucasb880f892021-06-07 16:40:31 -040056{{ $appConf | toYaml | indent 4 }}
Jack Lucasd41dbdb2021-02-16 11:07:28 -050057
ajay_dp001cf5232a2021-04-13 20:48:07 +053058{{- if .Values.drFeedConfig }}
59---
60apiVersion: v1
61kind: ConfigMap
62metadata:
63 name: {{ include "common.fullname" . }}-feeds-config
64 namespace: {{ include "common.namespace" . }}
65 labels: {{ include "common.labels" . | nindent 6 }}
66data:
67 {{- range $i, $feed := .Values.drFeedConfig }}
68 feedConfig-{{$i}}.json: |-
Jack Lucas838ce7e2023-07-18 17:52:13 -040069 {
70 "name": {{ $feed.feedName | quote }},
71 "version": {{ $feed.feedVersion | quote }},
72 "description": {{ $feed.feedDescription | default "None" | quote }},
73 "authorization": {
74 "classification": {{ $feed.classification | quote }},
75 "endpoint_addrs": [
76 ],
77 "endpoint_ids": [
78 {
79 "id": {{ $feed.publisher.username | quote }},
80 "password": {{ $feed.publisher.password | quote }}
81 }
82 ]
83 }
84 }
ajay_dp001cf5232a2021-04-13 20:48:07 +053085 {{- end }}
86{{- end }}
87
88{{- if .Values.drSubConfig }}
89---
90apiVersion: v1
91kind: ConfigMap
92metadata:
93 name: {{ include "common.fullname" . }}-drsub-config
94 namespace: {{ include "common.namespace" . }}
95 labels: {{ include "common.labels" . | nindent 6 }}
96data:
97 {{- range $i, $drsub := .Values.drSubConfig }}
98 drsubConfig-{{$i}}.json: |-
Jack Lucas838ce7e2023-07-18 17:52:13 -040099 {
100 "feed": {
101 "name": {{ $drsub.feedName | quote }},
102 "version": {{ $drsub.feedVersion | quote }}
103 },
104 "delivery": {
105 "url": {{ $drsub.deliveryURL | quote }},
106 "user": {{ $drsub.username | quote }},
107 "password": {{ $drsub.userpwd | quote }},
108 "use100": {{ $drsub.use100 | default false }}
109 },
110 "metadataOnly": {{ $drsub.metadataOnly | default false }},
111 "groupid": {{ $drsub.groupId | default 0 }},
112 "follow_redirect": {{ $drsub.followRedirect | default true }},
113 "privileged_subscriber": {{ $drsub.privilegedSubscriber | default false }},
114 "decompress": {{ $drsub.decompress | default false }}
115 }
ajay_dp001cf5232a2021-04-13 20:48:07 +0530116 {{- end }}
117{{- end }}
Maciej Wereski7000a7c2021-12-16 12:24:06 +0100118{{- end }}