From 750a2f41c2ae4b2d9d372153977d288460a2e2db Mon Sep 17 00:00:00 2001 From: Cole Walker Date: Fri, 24 May 2024 09:41:44 -0400 Subject: [PATCH] Rename app plugin to conform with app framework requirements Recent changes in the system application framework have resulted in ptp-notification failing to apply. This is because the plugin defined in python3-k8sapp-ptp-notification does not exactly match the app name. This change re-names the ptp-plugin from "ptp_notification" to "ptp-notification" and allows the application to apply correctly. It also adds required constances and a get_overrides() function to the ptp-notification plugin so that helm overrides can work properly. This logic has been implmented in the same way as other stx platform apps. The app framework change that revealed this issue is: https://review.opendev.org/c/starlingx/config/+/915377 Test-plan: Pass: Verify ptp-notification build Pass: Build and install iso Pass: Verify ptp-notification app apply/remove/override Story: 2011090 Task: 50183 Signed-off-by: Cole Walker Change-Id: Ia366eeb4c54aaccea65a9e568afaf8992bd825d5 --- .../common/constants.py | 3 ++- .../helm/ptp_notification.py | 20 ++++++++++++++++++- .../k8sapp_ptp_notification/setup.cfg | 4 ++-- 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/python3-k8sapp-ptp-notification/k8sapp_ptp_notification/k8sapp_ptp_notification/common/constants.py b/python3-k8sapp-ptp-notification/k8sapp_ptp_notification/k8sapp_ptp_notification/common/constants.py index 4f41771..c83524a 100644 --- a/python3-k8sapp-ptp-notification/k8sapp_ptp_notification/k8sapp_ptp_notification/common/constants.py +++ b/python3-k8sapp-ptp-notification/k8sapp_ptp_notification/k8sapp_ptp_notification/common/constants.py @@ -1,5 +1,5 @@ # -# Copyright (c) 2021 Wind River Systems, Inc. +# Copyright (c) 2021-2024 Wind River Systems, Inc. # # SPDX-License-Identifier: Apache-2.0 # @@ -7,3 +7,4 @@ # Helm: Supported charts: # These values match the names in the chart package's Chart.yaml HELM_CHART_PTP_NOTIFICATION = 'ptp-notification' +HELM_CHART_NS_NOTIFICATION = 'notification' diff --git a/python3-k8sapp-ptp-notification/k8sapp_ptp_notification/k8sapp_ptp_notification/helm/ptp_notification.py b/python3-k8sapp-ptp-notification/k8sapp_ptp_notification/k8sapp_ptp_notification/helm/ptp_notification.py index 0946e57..94aa8ec 100644 --- a/python3-k8sapp-ptp-notification/k8sapp_ptp_notification/k8sapp_ptp_notification/helm/ptp_notification.py +++ b/python3-k8sapp-ptp-notification/k8sapp_ptp_notification/k8sapp_ptp_notification/helm/ptp_notification.py @@ -1,16 +1,21 @@ # -# Copyright (c) 2021 Wind River Systems, Inc. +# Copyright (c) 2021-2024 Wind River Systems, Inc. # # SPDX-License-Identifier: Apache-2.0 # from k8sapp_ptp_notification.common import constants as app_constants +from oslo_log import log as logging + from sysinv.common import constants +from sysinv.common import exception from sysinv.helm import base from sysinv.helm import common +LOG = logging.getLogger(__name__) + class PTPNotificationHelm(base.BaseHelm): """Class to encapsulate helm operations for the ptp notification chart""" @@ -28,3 +33,16 @@ class PTPNotificationHelm(base.BaseHelm): def get_namespaces(self): return self.SUPPORTED_NAMESPACES + + def get_overrides(self, namespace=None): + overrides = { + app_constants.HELM_CHART_NS_NOTIFICATION: {} + } + + if namespace in self.SUPPORTED_NAMESPACES: + return overrides[namespace] + elif namespace: + raise exception.InvalidHelmNamespace(chart=self.CHART, + namespace=namespace) + else: + return overrides diff --git a/python3-k8sapp-ptp-notification/k8sapp_ptp_notification/setup.cfg b/python3-k8sapp-ptp-notification/k8sapp_ptp_notification/setup.cfg index 5c532e2..2907341 100644 --- a/python3-k8sapp-ptp-notification/k8sapp_ptp_notification/setup.cfg +++ b/python3-k8sapp-ptp-notification/k8sapp_ptp_notification/setup.cfg @@ -30,10 +30,10 @@ setup-hooks = [entry_points] systemconfig.helm_applications = - ptp_notification = systemconfig.helm_plugins.ptp_notification + ptp-notification = systemconfig.helm_plugins.ptp_notification systemconfig.helm_plugins.ptp_notification = - 001_ptp_notification = k8sapp_ptp_notification.helm.ptp_notification:PTPNotificationHelm + 001_ptp-notification = k8sapp_ptp_notification.helm.ptp_notification:PTPNotificationHelm [bdist_wheel] universal = 1