2 ################################################################################
3 # Copyright (C) 2021 Nordix Foundation. #
4 # Copyright (c) 2022-2023 J. F. Lucas. All rights reserved. #
6 # Licensed under the Apache License, Version 2.0 (the "License"); #
7 # you may not use this file except in compliance with the License. #
8 # You may obtain a copy of the License at #
10 # http://www.apache.org/licenses/LICENSE-2.0 #
12 # Unless required by applicable law or agreed to in writing, software #
13 # distributed under the License is distributed on an "AS IS" BASIS, #
14 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
15 # See the License for the specific language governing permissions and #
16 # limitations under the License. #
17 ################################################################################
21 This template generates a Kubernetes init containers common template to enable applications to provision
22 DMaaP feeds (on Data Router) for DCAE microservices, with associated authorization.
23 DMaap Data Router (DR) endpoints are used to provision:
24 - Feeds on DR, with associated user authentication.
25 - Subscribers to feeds on DR, to provide DR with username, password, and URL needed to deliver
28 common.dmaap.provisioning.initContainer:
29 This template creates an initContainer with some associated volumes. The initContainer
30 (oom/kubernetes/dmaap-datarouter/drprov-client) runs a script (drprov-client.sh) that uses the
31 DR provisioning API to create the feeds and subscribers needed by a microservice. The script
32 updates the microservice's configuration to supply information needed to access the feeds. The
33 configuration information comes from two volumes that are created by the dcaegen2-services-common
35 - app-config-input: comes from a configMap generated from the microservice's values.yaml file.
36 It may contain references to environment variables as placeholders for feed information that
37 will become available after feeds are provisioned.
38 - app-config: this template will copy the configuration file from the app-config-input volume,
39 replaced the environment variable references with the actual values for feed information, based
40 on data returned by the DR provisioning API.
42 The template directly references data in .Values, and indirectly (through its
43 use of templates from the ONAP "common" collection) references data in .Release.
45 Parameters for _dmaapProvisioning to be defined in values.yaml:
47 # DataRouter Feed Configuration
48 # (Note that DR configures publishers as part of the feed.)
50 - feedName: bulk_pm_feed
52 classification: unclassified
53 feedDescription: DFC Feed Creation
58 # DataRouter Subscriber Configuration
60 - feedName: bulk_pm_feed
63 privilegedSubscriber: True
64 deliveryURL: https://dcae-pm-mapper:8443/delivery
66 # ConfigMap Configuration for DR Feed, Dr_Subscriber
69 path: /opt/app/config/feeds
71 path: /opt/app/config/dr_subs
73 In deployments/jobs/stateful include:
75 {{- include "common.dmaap.provisioning.initContainer" . | nindent XX }}
77 {{- include "common.dmaap.provisioning._volumes" . | nindent XX -}}
80 {{- define "common.dmaap.provisioning._volumeMounts" -}}
81 {{- $dot := default . .dot -}}
82 - mountPath: /config-input
83 name: app-config-input
86 {{- range $name, $volume := $dot.Values.volumes }}
87 - name: {{ $volume.name }}
88 mountPath: {{ $volume.path }}
92 {{- define "common.dmaap.provisioning._volumes" -}}
93 {{- $dot := default . .dot -}}
94 {{- range $name, $volume := $dot.Values.volumes }}
95 - name: {{ $volume.name }}
98 name: {{ include "common.fullname" $dot }}-{{ printf "%s" $volume.name }}
102 {{- define "common.dmaap.provisioning.initContainer" -}}
103 {{- $dot := default . .dot -}}
104 {{- $drNeedProvisioning := or $dot.Values.drFeedConfig $dot.Values.drSubConfig -}}
105 {{- if $drNeedProvisioning -}}
106 - name: {{ include "common.name" $dot }}-init-dmaap-provisioning
107 image: {{ include "repositoryGenerator.image.drProvClient" $dot }}
108 imagePullPolicy: {{ $dot.Values.global.pullPolicy | default $dot.Values.pullPolicy }}
111 value: "X-DMAAP-DR-ON-BEHALF-OF: drprovcl"
112 {{- range $cred := $dot.Values.credentials }}
113 - name: {{ $cred.name }}
114 {{- include "common.secret.envFromSecretFast" (dict "global" $dot "uid" $cred.uid "key" $cred.key) | nindent 4 }}
117 {{- include "common.dmaap.provisioning._volumeMounts" $dot | trim | nindent 2 }}
118 resources: {{ include "common.resources" $dot | nindent 4 }}