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 |
Jack Lucas | f86f629 | 2022-06-08 09:12:29 -0400 | [diff] [blame^] | 4 | # Copyright (c) 2021-2022 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 |
Jack Lucas | f86f629 | 2022-06-08 09:12:29 -0400 | [diff] [blame^] | 33 | initial configuration data. (See the documentation for |
Jack Lucas | d41dbdb | 2021-02-16 11:07:28 -0500 | [diff] [blame] | 34 | dcaegen2-services-common.microserviceDeployment for more details.) |
| 35 | |
Jack Lucas | f86f629 | 2022-06-08 09:12:29 -0400 | [diff] [blame^] | 36 | If the microservice is using one or more Data Router (DR) feeds, the |
| 37 | template produces a configMap containing the information needed to |
| 38 | provision the feed(s). An init container performs the provisioning. |
| 39 | |
| 40 | If the microservice acts as a DR publisher for one or more feeds, the |
| 41 | template produces a configMap containing the information needed to |
| 42 | provision the publisher(s). An init container performs the provisioning. |
| 43 | |
| 44 | If the microservice acts as a DR subscriber for one or more feeds, the |
| 45 | template produces a configMap containing the information needed to |
| 46 | provision the subscribeer(s). An init container performs the provisioning. |
| 47 | |
Jack Lucas | d41dbdb | 2021-02-16 11:07:28 -0500 | [diff] [blame] | 48 | */}} |
| 49 | |
| 50 | {{- define "dcaegen2-services-common.configMap" -}} |
Jack Lucas | b880f89 | 2021-06-07 16:40:31 -0400 | [diff] [blame] | 51 | {{- $appConf := .Values.applicationConfig | default (dict) -}} |
Jack Lucas | d41dbdb | 2021-02-16 11:07:28 -0500 | [diff] [blame] | 52 | apiVersion: v1 |
| 53 | kind: ConfigMap |
| 54 | metadata: |
| 55 | name: {{ include "common.fullname" . }}-application-config-configmap |
| 56 | namespace: {{ include "common.namespace" . }} |
| 57 | labels: {{ include "common.labels" . | nindent 6 }} |
| 58 | data: |
| 59 | application_config.yaml: | |
Jack Lucas | b880f89 | 2021-06-07 16:40:31 -0400 | [diff] [blame] | 60 | {{ $appConf | toYaml | indent 4 }} |
Jack Lucas | d41dbdb | 2021-02-16 11:07:28 -0500 | [diff] [blame] | 61 | |
ajay_dp001 | cf5232a | 2021-04-13 20:48:07 +0530 | [diff] [blame] | 62 | {{- if .Values.drFeedConfig }} |
| 63 | --- |
| 64 | apiVersion: v1 |
| 65 | kind: ConfigMap |
| 66 | metadata: |
| 67 | name: {{ include "common.fullname" . }}-feeds-config |
| 68 | namespace: {{ include "common.namespace" . }} |
| 69 | labels: {{ include "common.labels" . | nindent 6 }} |
| 70 | data: |
| 71 | {{- range $i, $feed := .Values.drFeedConfig }} |
| 72 | feedConfig-{{$i}}.json: |- |
| 73 | {{ $feed | toJson | indent 2 }} |
| 74 | {{- end }} |
| 75 | {{- end }} |
| 76 | |
| 77 | {{- if .Values.drPubConfig }} |
| 78 | --- |
| 79 | apiVersion: v1 |
| 80 | kind: ConfigMap |
| 81 | metadata: |
| 82 | name: {{ include "common.fullname" . }}-drpub-config |
| 83 | namespace: {{ include "common.namespace" . }} |
| 84 | labels: {{ include "common.labels" . | nindent 6 }} |
| 85 | data: |
| 86 | {{- range $i, $drpub := .Values.drPubConfig }} |
| 87 | drpubConfig-{{$i}}.json: |- |
| 88 | {{ $drpub | toJson | indent 2 }} |
| 89 | {{- end }} |
| 90 | {{- end }} |
| 91 | |
| 92 | {{- if .Values.drSubConfig }} |
| 93 | --- |
| 94 | apiVersion: v1 |
| 95 | kind: ConfigMap |
| 96 | metadata: |
| 97 | name: {{ include "common.fullname" . }}-drsub-config |
| 98 | namespace: {{ include "common.namespace" . }} |
| 99 | labels: {{ include "common.labels" . | nindent 6 }} |
| 100 | data: |
| 101 | {{- range $i, $drsub := .Values.drSubConfig }} |
| 102 | drsubConfig-{{$i}}.json: |- |
| 103 | {{ $drsub | toJson | indent 2 }} |
| 104 | {{- end }} |
| 105 | {{- end }} |
Maciej Wereski | 7000a7c | 2021-12-16 12:24:06 +0100 | [diff] [blame] | 106 | {{- end }} |