From e9b1e32bbdcb5338d7f98825bafefd23a4afebdd Mon Sep 17 00:00:00 2001 From: ajay_dp001 Date: Tue, 2 Nov 2021 20:42:12 +0530 Subject: [OOM] Avoid duplicate DrPublisher creation via DCAE - Username/Password passed as k8s Secret while dr_pub creation. Issue-ID: DCAEGEN2-2861 Signed-off-by: ajay_dp001 Change-Id: Ib767c8a17e2d7edabf4a9952ac7277d8062c7988 --- .../common/common/templates/_dmaapProvisioning.tpl | 3 +-- kubernetes/common/repositoryGenerator/values.yaml | 4 +-- .../dcae-datafile-collector/templates/secret.yaml | 19 +++++++++++++ .../components/dcae-datafile-collector/values.yaml | 31 +++++++++++++++++++--- 4 files changed, 50 insertions(+), 7 deletions(-) create mode 100644 kubernetes/dcaegen2-services/components/dcae-datafile-collector/templates/secret.yaml (limited to 'kubernetes') diff --git a/kubernetes/common/common/templates/_dmaapProvisioning.tpl b/kubernetes/common/common/templates/_dmaapProvisioning.tpl index d28494aacd..eefd00d7bf 100644 --- a/kubernetes/common/common/templates/_dmaapProvisioning.tpl +++ b/kubernetes/common/common/templates/_dmaapProvisioning.tpl @@ -138,6 +138,7 @@ args: - -c - | + set -uex -o pipefail if [ -d /opt/app/config/cache ]; then cd /opt/app/config/cache for file in $(ls feed*); do @@ -147,8 +148,6 @@ done for file in $(ls drpub*); do NUM=$(echo "$file" | sed 's/drpubConfig-\([0-9]\+\)-resp.json/\1/') - export DR_USERNAME_"$NUM"="$(grep -o '"username":"[^"]*' "$file" | cut -d '"' -f4)" - export DR_PASSWORD_"$NUM"="$(grep -o '"userpwd":"[^"]*' "$file" | cut -d '"' -f4)" export DR_FILES_PUBLISHER_ID_"$NUM"="$(grep -o '"pubId":"[^"]*' "$file" | cut -d '"' -f4)" done for file in $(ls drsub*); do diff --git a/kubernetes/common/repositoryGenerator/values.yaml b/kubernetes/common/repositoryGenerator/values.yaml index 5a43eefc03..c168e4e1d7 100644 --- a/kubernetes/common/repositoryGenerator/values.yaml +++ b/kubernetes/common/repositoryGenerator/values.yaml @@ -1,6 +1,6 @@ # Copyright © 2020 Orange # Copyright © 2021 Nokia, AT&T -# Modifications Copyright (C) 2021 Nordix Foundation. +# Modifications Copyright (c) 2022 Nordix Foundation. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -37,7 +37,7 @@ global: postgresImage: crunchydata/crunchy-postgres:centos8-13.2-4.6.1 readinessImage: onap/oom/readiness:3.0.1 dcaePolicySyncImage: onap/org.onap.dcaegen2.deployments.dcae-services-policy-sync:1.0.1 - dbcClientImage: onap/dmaap/dbc-client:2.0.7 + dbcClientImage: onap/dmaap/dbc-client:2.0.9 quitQuitImage: onap/oom/readiness:4.1.0 # Default credentials diff --git a/kubernetes/dcaegen2-services/components/dcae-datafile-collector/templates/secret.yaml b/kubernetes/dcaegen2-services/components/dcae-datafile-collector/templates/secret.yaml new file mode 100644 index 0000000000..13a14a5e12 --- /dev/null +++ b/kubernetes/dcaegen2-services/components/dcae-datafile-collector/templates/secret.yaml @@ -0,0 +1,19 @@ +{{/* +################################################################################ +# Copyright (c) 2022 Nordix Foundation. # +# # +# Licensed under the Apache License, Version 2.0 (the "License"); # +# you may not use this file except in compliance with the License. # +# You may obtain a copy of the License at # +# # +# http://www.apache.org/licenses/LICENSE-2.0 # +# # +# Unless required by applicable law or agreed to in writing, software # +# distributed under the License is distributed on an "AS IS" BASIS, # +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # +# See the License for the specific language governing permissions and # +# limitations under the License. # +################################################################################ +*/}} + +{{ include "common.secretFast" . }} \ No newline at end of file diff --git a/kubernetes/dcaegen2-services/components/dcae-datafile-collector/values.yaml b/kubernetes/dcaegen2-services/components/dcae-datafile-collector/values.yaml index 7408f44416..2ce6c89775 100644 --- a/kubernetes/dcaegen2-services/components/dcae-datafile-collector/values.yaml +++ b/kubernetes/dcaegen2-services/components/dcae-datafile-collector/values.yaml @@ -1,6 +1,6 @@ # ================================ LICENSE_START ========================== # ========================================================================= -# Copyright (C) 2021 Nordix Foundation. +# Copyright (c) 2021 Nordix Foundation. # ========================================================================= # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -30,6 +30,16 @@ filebeatConfig: logstashServiceName: log-ls logstashPort: 5044 +################################################################# +# Secrets Configuration. +################################################################# +secrets: + - uid: &drPubCredsUID drpubcreds + type: basicAuth + login: '{{ .Values.drPubscriberCreds.username }}' + password: '{{ .Values.drPubscriberCreds.password }}' + passwordPolicy: required + ################################################################# # InitContainer Images. ################################################################# @@ -116,6 +126,19 @@ applicationEnv: # It's a workaround because DMAAP specific env variables are not available in main container. CBS_CLIENT_CONFIG_PATH: '' +# Data Router Publisher Credentials +drPubscriberCreds: + username: username + password: password + +credentials: +- name: DR_USERNAME + uid: *drPubCredsUID + key: login +- name: DR_PASSWORD + uid: *drPubCredsUID + key: password + # Initial Application Configuration applicationConfig: dmaap.certificateConfig.keyCert: /opt/app/datafile/etc/cert/cert.p12 @@ -139,8 +162,8 @@ applicationConfig: location: loc00 log_url: ${DR_LOG_URL_0} publish_url: ${DR_FILES_PUBLISHER_URL_0} - username: ${DR_USERNAME_0} - password: ${DR_PASSWORD_0} + username: ${DR_USERNAME} + password: ${DR_PASSWORD} type: data_router streams_subscribes: dmaap_subscriber: @@ -159,6 +182,8 @@ drFeedConfig: # DataRouter Publisher Configuration drPubConfig: - feedName: bulk_pm_feed + username: ${DR_USERNAME} + userpwd: ${DR_PASSWORD} dcaeLocationName: loc00 # ConfigMap Configuration for Feed, Dr_Publisher -- cgit 1.2.3-korg