blob: 5313b0782abbdb65a321919654650c7ced5cc645 [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
55{{- if .Values.logDirectory }}
56---
57apiVersion: v1
58kind: ConfigMap
59metadata:
60 name: {{ include "common.fullname" . }}-filebeat-configmap
61 namespace: {{ include "common.namespace" . }}
62 labels: {{ include "common.labels" . | nindent 6 }}
63data:
64 filebeat.yml: |-
65{{ include "dcaegen2-services-common.filebeatConfiguration" . | indent 4 }}
66{{- end }}
ajay_dp001cf5232a2021-04-13 20:48:07 +053067
68{{- if .Values.drFeedConfig }}
69---
70apiVersion: v1
71kind: ConfigMap
72metadata:
73 name: {{ include "common.fullname" . }}-feeds-config
74 namespace: {{ include "common.namespace" . }}
75 labels: {{ include "common.labels" . | nindent 6 }}
76data:
77 {{- range $i, $feed := .Values.drFeedConfig }}
78 feedConfig-{{$i}}.json: |-
79 {{ $feed | toJson | indent 2 }}
80 {{- end }}
81{{- end }}
82
83{{- if .Values.drPubConfig }}
84---
85apiVersion: v1
86kind: ConfigMap
87metadata:
88 name: {{ include "common.fullname" . }}-drpub-config
89 namespace: {{ include "common.namespace" . }}
90 labels: {{ include "common.labels" . | nindent 6 }}
91data:
92 {{- range $i, $drpub := .Values.drPubConfig }}
93 drpubConfig-{{$i}}.json: |-
94 {{ $drpub | toJson | indent 2 }}
95 {{- end }}
96{{- end }}
97
98{{- if .Values.drSubConfig }}
99---
100apiVersion: v1
101kind: ConfigMap
102metadata:
103 name: {{ include "common.fullname" . }}-drsub-config
104 namespace: {{ include "common.namespace" . }}
105 labels: {{ include "common.labels" . | nindent 6 }}
106data:
107 {{- range $i, $drsub := .Values.drSubConfig }}
108 drsubConfig-{{$i}}.json: |-
109 {{ $drsub | toJson | indent 2 }}
110 {{- end }}
111{{- end }}
112
113{{- if .Values.mrTopicsConfig }}
114---
115apiVersion: v1
116kind: ConfigMap
117metadata:
118 name: {{ include "common.fullname" . }}-topics-config
119 namespace: {{ include "common.namespace" . }}
120 labels: {{ include "common.labels" . | nindent 6 }}
121data:
122 {{- range $i, $topics := .Values.mrTopicsConfig }}
123 topicsConfig-{{$i}}.json: |-
124 {{ $topics | toJson | indent 2 }}
125 {{- end }}
126{{- end }}
Jack Lucasd41dbdb2021-02-16 11:07:28 -0500127{{- end }}