From 19841dd96ffc8d321b07993188a275548682d81b Mon Sep 17 00:00:00 2001 From: Tara Nath Subedi Date: Thu, 19 Dec 2024 13:21:51 -0500 Subject: [PATCH] Rework RabbitMQ credential configuration PTP Notification deploys two separate rabbitmq instances: registration and notification-broker, with a default user/password of admin/admin. This commit enables PTP notification to function with an user-defined name, password and also AMQP port for both instances. TEST PLAN: PASS: PTP pull/push notifications with default notification/registration user/password/port (without helm override for these) PASS: PTP pull/push notifications with changing notification/registration user/password/port (with helm overide for these) system helm-override-update ptp-notification ptp-notification \ notification --values ~/notification-override.yaml registration: endpoint: port: 5673 user: admin-reg pass: Registration1234 notification: endpoint: port: 5674 user: admin-noti pass: Notification1234 Story: 2011332 Task: 51620 Signed-off-by: Tara Nath Subedi Change-Id: Id98c2ae68a1adb5b17f1a336ac609cd57fe3a026 --- .../ptp-notification/templates/daemonset.yaml | 34 +++++++++---------- .../templates/deployment.yaml | 10 +++--- .../ptp-notification/templates/service.yaml | 4 +-- .../notificationclientsdk/services/ptp.py | 4 +-- 4 files changed, 26 insertions(+), 26 deletions(-) diff --git a/helm-charts/custom/ptp-notification-helm/ptp-notification-helm/ptp-notification/templates/daemonset.yaml b/helm-charts/custom/ptp-notification-helm/ptp-notification-helm/ptp-notification/templates/daemonset.yaml index 9e1bdf1..d94ba32 100644 --- a/helm-charts/custom/ptp-notification-helm/ptp-notification-helm/ptp-notification/templates/daemonset.yaml +++ b/helm-charts/custom/ptp-notification-helm/ptp-notification-helm/ptp-notification/templates/daemonset.yaml @@ -1,5 +1,5 @@ # -# Copyright (c) 2021-2024 Wind River Systems, Inc. +# Copyright (c) 2021-2025 Wind River Systems, Inc. # # SPDX-License-Identifier: Apache-2.0 # @@ -54,11 +54,11 @@ spec: - name: THIS_NAMESPACE value: {{ .Values.global.namespace }} - name: RABBITMQ_DEFAULT_USER - value: "admin" + value: "{{ .Values.notification.endpoint.user }}" - name: RABBITMQ_DEFAULT_PASS - value: "admin" - - name: RABBITMQ_DEFAULT_PORT - value: "5672" + value: "{{ .Values.notification.endpoint.pass }}" + - name: RABBITMQ_NODE_PORT + value: "{{ .Values.notification.endpoint.port }}" - name: {{ .Chart.Name }}-location image: "{{ .Values.location.image.repository }}:{{ .Values.location.image.tag }}" imagePullPolicy: {{ .Values.location.image.pullPolicy }} @@ -141,17 +141,17 @@ spec: - name: OVERALL_HOLDOVER_SECONDS value: "{{ .Values.ptptrackingv2.overall.holdover_seconds }}" - name: NOTIFICATIONSERVICE_USER - value: "admin" + value: "{{ .Values.notification.endpoint.user }}" - name: NOTIFICATIONSERVICE_PASS - value: "admin" + value: "{{ .Values.notification.endpoint.pass }}" - name: NOTIFICATIONSERVICE_PORT - value: "5672" + value: "{{ .Values.notification.endpoint.port }}" - name: REGISTRATION_USER - value: "admin" + value: "{{ .Values.registration.endpoint.user }}" - name: REGISTRATION_PASS - value: "admin" + value: "{{ .Values.registration.endpoint.pass }}" - name: REGISTRATION_PORT - value: "5672" + value: "{{ .Values.registration.endpoint.port }}" - name: REGISTRATION_HOST value: "registration.{{.Values.global.namespace}}.svc.cluster.local" - name: HEALTH_API_HOST @@ -250,17 +250,17 @@ spec: - name: PTP_POLL_FREQ_SECONDS value: "{{ .Values.ptptracking.device.poll_freq_seconds }}" - name: NOTIFICATIONSERVICE_USER - value: "admin" + value: "{{ .Values.notification.endpoint.user }}" - name: NOTIFICATIONSERVICE_PASS - value: "admin" + value: "{{ .Values.notification.endpoint.pass }}" - name: NOTIFICATIONSERVICE_PORT - value: "5672" + value: "{{ .Values.notification.endpoint.port }}" - name: REGISTRATION_USER - value: "admin" + value: "{{ .Values.registration.endpoint.user }}" - name: REGISTRATION_PASS - value: "admin" + value: "{{ .Values.registration.endpoint.pass }}" - name: REGISTRATION_PORT - value: "5672" + value: "{{ .Values.registration.endpoint.port }}" - name: REGISTRATION_HOST value: "registration.{{.Values.global.namespace}}.svc.cluster.local" - name: HEALTH_API_HOST diff --git a/helm-charts/custom/ptp-notification-helm/ptp-notification-helm/ptp-notification/templates/deployment.yaml b/helm-charts/custom/ptp-notification-helm/ptp-notification-helm/ptp-notification/templates/deployment.yaml index d181101..6a619c8 100644 --- a/helm-charts/custom/ptp-notification-helm/ptp-notification-helm/ptp-notification/templates/deployment.yaml +++ b/helm-charts/custom/ptp-notification-helm/ptp-notification-helm/ptp-notification/templates/deployment.yaml @@ -1,5 +1,5 @@ # -# Copyright (c) 2021 Wind River Systems, Inc. +# Copyright (c) 2021-2025 Wind River Systems, Inc. # # SPDX-License-Identifier: Apache-2.0 # @@ -43,9 +43,9 @@ spec: image: "{{ .Values.registration.image.repository }}:{{ .Values.registration.image.tag }}" env: - name: RABBITMQ_DEFAULT_USER - value: "admin" + value: "{{ .Values.registration.endpoint.user }}" - name: RABBITMQ_DEFAULT_PASS - value: "admin" - - name: RABBITMQ_DEFAULT_PORT - value: "5672" + value: "{{ .Values.registration.endpoint.pass }}" + - name: RABBITMQ_NODE_PORT + value: "{{ .Values.registration.endpoint.port }}" --- diff --git a/helm-charts/custom/ptp-notification-helm/ptp-notification-helm/ptp-notification/templates/service.yaml b/helm-charts/custom/ptp-notification-helm/ptp-notification-helm/ptp-notification/templates/service.yaml index 5592a28..93ecbf0 100644 --- a/helm-charts/custom/ptp-notification-helm/ptp-notification-helm/ptp-notification/templates/service.yaml +++ b/helm-charts/custom/ptp-notification-helm/ptp-notification-helm/ptp-notification/templates/service.yaml @@ -1,5 +1,5 @@ # -# Copyright (c) 2021 Wind River Systems, Inc. +# Copyright (c) 2021,2024-2025 Wind River Systems, Inc. # # SPDX-License-Identifier: Apache-2.0 # @@ -13,7 +13,7 @@ spec: #clusterIP: None ports: - name: rabbitmq - port: 5672 + port: {{ .Values.registration.endpoint.port }} protocol: TCP selector: app: rabbitmq \ No newline at end of file diff --git a/notificationclient-base/docker/notificationclient-sidecar/notificationclientsdk/services/ptp.py b/notificationclient-base/docker/notificationclient-sidecar/notificationclientsdk/services/ptp.py index 45faaac..bb192d6 100644 --- a/notificationclient-base/docker/notificationclient-sidecar/notificationclientsdk/services/ptp.py +++ b/notificationclient-base/docker/notificationclient-sidecar/notificationclientsdk/services/ptp.py @@ -224,7 +224,7 @@ class PtpService(object): } raise client_exception.SubscriptionAlreadyExists( subscriptioninfo) - + _, nodename, _, _, _ = subscription_helper.parse_resource_address( resource_address) @@ -353,4 +353,4 @@ class PtpService(object): LOG.warning("subscription {0} is not deleted due to:" "{1}/{2}".format(self.subscriptionid, type(ex), str(ex))) - raise ex + raise ex \ No newline at end of file