Jack Lucas | d41dbdb | 2021-02-16 11:07:28 -0500 | [diff] [blame] | 1 | {{/* |
| 2 | # Copyright © 2017 Amdocs, Bell Canada |
| 3 | # Modifications Copyright © 2019 AT&T |
| 4 | # Copyright (c) 2021 J. F. Lucas. All rights reserved. |
ajay_dp001 | cf5232a | 2021-04-13 20:48:07 +0530 | [diff] [blame] | 5 | # Copyright (c) 2021 Nordix Foundation. |
Jack Lucas | d41dbdb | 2021-02-16 11:07:28 -0500 | [diff] [blame] | 6 | # |
| 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 | {{/* |
| 21 | dcaegen2-services-common.configMap: |
| 22 | This template produces Kubernetes configMap(s) needed by a |
| 23 | DCAE microservice. |
| 24 | |
| 25 | The template expects the full chart context as input. A chart for a |
| 26 | DCAE microservice references this template using: |
| 27 | {{ include "dcaegen2-services-common.configMap" . }} |
| 28 | The template directly references data in .Values, and indirectly (through its |
| 29 | use of templates from the ONAP "common" collection) references data in |
| 30 | .Release. |
| 31 | |
| 32 | The template always produces a configMap containing the microservice's |
| 33 | initial configuration data. This configMap is used by an initContainer |
| 34 | that loads the configuration into Consul. (See the documentation for |
| 35 | dcaegen2-services-common.microserviceDeployment for more details.) |
| 36 | |
| 37 | If the microservice is using a logging sidecar (again, see the documentation |
| 38 | for dcaegen2-services-common.microserviceDeployment for more details), the |
| 39 | template generates an additiona configMap that supplies configuration |
| 40 | information for the logging sidecar. |
| 41 | */}} |
| 42 | |
| 43 | {{- define "dcaegen2-services-common.configMap" -}} |
Jack Lucas | b880f89 | 2021-06-07 16:40:31 -0400 | [diff] [blame] | 44 | {{- $appConf := .Values.applicationConfig | default (dict) -}} |
Jack Lucas | d41dbdb | 2021-02-16 11:07:28 -0500 | [diff] [blame] | 45 | apiVersion: v1 |
| 46 | kind: ConfigMap |
| 47 | metadata: |
| 48 | name: {{ include "common.fullname" . }}-application-config-configmap |
| 49 | namespace: {{ include "common.namespace" . }} |
| 50 | labels: {{ include "common.labels" . | nindent 6 }} |
| 51 | data: |
| 52 | application_config.yaml: | |
Jack Lucas | b880f89 | 2021-06-07 16:40:31 -0400 | [diff] [blame] | 53 | {{ $appConf | toYaml | indent 4 }} |
Jack Lucas | d41dbdb | 2021-02-16 11:07:28 -0500 | [diff] [blame] | 54 | |
| 55 | {{- if .Values.logDirectory }} |
| 56 | --- |
| 57 | apiVersion: v1 |
| 58 | kind: ConfigMap |
| 59 | metadata: |
| 60 | name: {{ include "common.fullname" . }}-filebeat-configmap |
| 61 | namespace: {{ include "common.namespace" . }} |
| 62 | labels: {{ include "common.labels" . | nindent 6 }} |
| 63 | data: |
| 64 | filebeat.yml: |- |
| 65 | {{ include "dcaegen2-services-common.filebeatConfiguration" . | indent 4 }} |
| 66 | {{- end }} |
ajay_dp001 | cf5232a | 2021-04-13 20:48:07 +0530 | [diff] [blame] | 67 | |
| 68 | {{- if .Values.drFeedConfig }} |
| 69 | --- |
| 70 | apiVersion: v1 |
| 71 | kind: ConfigMap |
| 72 | metadata: |
| 73 | name: {{ include "common.fullname" . }}-feeds-config |
| 74 | namespace: {{ include "common.namespace" . }} |
| 75 | labels: {{ include "common.labels" . | nindent 6 }} |
| 76 | data: |
| 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 | --- |
| 85 | apiVersion: v1 |
| 86 | kind: ConfigMap |
| 87 | metadata: |
| 88 | name: {{ include "common.fullname" . }}-drpub-config |
| 89 | namespace: {{ include "common.namespace" . }} |
| 90 | labels: {{ include "common.labels" . | nindent 6 }} |
| 91 | data: |
| 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 | --- |
| 100 | apiVersion: v1 |
| 101 | kind: ConfigMap |
| 102 | metadata: |
| 103 | name: {{ include "common.fullname" . }}-drsub-config |
| 104 | namespace: {{ include "common.namespace" . }} |
| 105 | labels: {{ include "common.labels" . | nindent 6 }} |
| 106 | data: |
| 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 | --- |
| 115 | apiVersion: v1 |
| 116 | kind: ConfigMap |
| 117 | metadata: |
| 118 | name: {{ include "common.fullname" . }}-topics-config |
| 119 | namespace: {{ include "common.namespace" . }} |
| 120 | labels: {{ include "common.labels" . | nindent 6 }} |
| 121 | data: |
| 122 | {{- range $i, $topics := .Values.mrTopicsConfig }} |
| 123 | topicsConfig-{{$i}}.json: |- |
| 124 | {{ $topics | toJson | indent 2 }} |
| 125 | {{- end }} |
| 126 | {{- end }} |
Jack Lucas | d41dbdb | 2021-02-16 11:07:28 -0500 | [diff] [blame] | 127 | {{- end }} |