blob: f76be4c1909add58b245b72840a2fad3cd47ebe1 [file] [log] [blame]
Jack Lucasd41dbdb2021-02-16 11:07:28 -05001{{/*
2# Copyright © 2017 Amdocs, Bell Canada
3# Modifications Copyright © 2019 AT&T
4# Copyright (c) 2021 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
33initial configuration data. This configMap is used by an initContainer
34that loads the configuration into Consul. (See the documentation for
35dcaegen2-services-common.microserviceDeployment for more details.)
36
37If the microservice is using a logging sidecar (again, see the documentation
38for dcaegen2-services-common.microserviceDeployment for more details), the
39template generates an additiona configMap that supplies configuration
40information for the logging sidecar.
41*/}}
42
43{{- define "dcaegen2-services-common.configMap" -}}
Jack Lucasb880f892021-06-07 16:40:31 -040044{{- $appConf := .Values.applicationConfig | default (dict) -}}
Jack Lucasd41dbdb2021-02-16 11:07:28 -050045apiVersion: v1
46kind: ConfigMap
47metadata:
48 name: {{ include "common.fullname" . }}-application-config-configmap
49 namespace: {{ include "common.namespace" . }}
50 labels: {{ include "common.labels" . | nindent 6 }}
51data:
52 application_config.yaml: |
Jack Lucasb880f892021-06-07 16:40:31 -040053{{ $appConf | toYaml | indent 4 }}
Jack Lucasd41dbdb2021-02-16 11:07:28 -050054
ajay_dp001cf5232a2021-04-13 20:48:07 +053055{{- if .Values.drFeedConfig }}
56---
57apiVersion: v1
58kind: ConfigMap
59metadata:
60 name: {{ include "common.fullname" . }}-feeds-config
61 namespace: {{ include "common.namespace" . }}
62 labels: {{ include "common.labels" . | nindent 6 }}
63data:
64 {{- range $i, $feed := .Values.drFeedConfig }}
65 feedConfig-{{$i}}.json: |-
66 {{ $feed | toJson | indent 2 }}
67 {{- end }}
68{{- end }}
69
70{{- if .Values.drPubConfig }}
71---
72apiVersion: v1
73kind: ConfigMap
74metadata:
75 name: {{ include "common.fullname" . }}-drpub-config
76 namespace: {{ include "common.namespace" . }}
77 labels: {{ include "common.labels" . | nindent 6 }}
78data:
79 {{- range $i, $drpub := .Values.drPubConfig }}
80 drpubConfig-{{$i}}.json: |-
81 {{ $drpub | toJson | indent 2 }}
82 {{- end }}
83{{- end }}
84
85{{- if .Values.drSubConfig }}
86---
87apiVersion: v1
88kind: ConfigMap
89metadata:
90 name: {{ include "common.fullname" . }}-drsub-config
91 namespace: {{ include "common.namespace" . }}
92 labels: {{ include "common.labels" . | nindent 6 }}
93data:
94 {{- range $i, $drsub := .Values.drSubConfig }}
95 drsubConfig-{{$i}}.json: |-
96 {{ $drsub | toJson | indent 2 }}
97 {{- end }}
98{{- end }}
99
100{{- if .Values.mrTopicsConfig }}
101---
102apiVersion: v1
103kind: ConfigMap
104metadata:
105 name: {{ include "common.fullname" . }}-topics-config
106 namespace: {{ include "common.namespace" . }}
107 labels: {{ include "common.labels" . | nindent 6 }}
108data:
109 {{- range $i, $topics := .Values.mrTopicsConfig }}
110 topicsConfig-{{$i}}.json: |-
111 {{ $topics | toJson | indent 2 }}
112 {{- end }}
113{{- end }}
Maciej Wereski7000a7c2021-12-16 12:24:06 +0100114{{- end }}