diff --git a/notificationclient-base/debian/Dockerfile b/notificationclient-base/debian/Dockerfile index 04f99a5..d5cf9b5 100644 --- a/notificationclient-base/debian/Dockerfile +++ b/notificationclient-base/debian/Dockerfile @@ -15,7 +15,7 @@ RUN pip3 install --user pecan \ && pip3 install oslo-config \ && pip3 install oslo-messaging \ && pip3 install WSME \ - && pip3 install sqlalchemy + && pip3 install sqlalchemy==1.4.12 WORKDIR /opt/ COPY ./notificationclient-sidecar /opt/notificationclient diff --git a/notificationclient-base/docker/notificationclient-sidecar/notificationclientsdk/client/notificationservice.py b/notificationclient-base/docker/notificationclient-sidecar/notificationclientsdk/client/notificationservice.py index dd3245a..e1e3479 100644 --- a/notificationclient-base/docker/notificationclient-sidecar/notificationclientsdk/client/notificationservice.py +++ b/notificationclient-base/docker/notificationclient-sidecar/notificationclientsdk/client/notificationservice.py @@ -1,5 +1,5 @@ # -# Copyright (c) 2021-2022 Wind River Systems, Inc. +# Copyright (c) 2021-2023 Wind River Systems, Inc. # # SPDX-License-Identifier: Apache-2.0 # @@ -63,7 +63,7 @@ class NotificationServiceClient(BrokerClientBase): resource_qualifier_json=None, resource_address=None, optional=None): - topic = '{0}-Status'.format(resource_type) + topic = '{0}-Status-v2'.format(resource_type) server = '{0}-Tracking-{1}'.format(resource_type, self.target_node_name) return self.call( topic, server, 'QueryStatus', @@ -76,7 +76,7 @@ class NotificationServiceClient(BrokerClientBase): if not status_handler: status_handler = NotificationHandlerBase() - topic='{0}-Event-{1}'.format(resource_type, self.broker_name) + topic='{0}-Event-v2-{1}'.format(resource_type, self.broker_name) server="{0}-EventListener-{1}".format(resource_type, self.Id) endpoints = [NotificationServiceClient.ListenerEndpoint(status_handler)] @@ -85,14 +85,14 @@ class NotificationServiceClient(BrokerClientBase): return True def remove_resource_status_listener(self, resource_type): - topic='{0}-Event-{1}'.format(resource_type, self.broker_name) + topic='{0}-Event-v2-{1}'.format(resource_type, self.broker_name) server="{0}-EventListener-{1}".format(resource_type, self.Id) super(NotificationServiceClient, self).remove_listener( topic, server) pass def is_listening_on_resource(self, resource_type): - topic='{0}-Event-{1}'.format(resource_type, self.broker_name) + topic='{0}-Event-v2-{1}'.format(resource_type, self.broker_name) server="{0}-EventListener-{1}".format(resource_type, self.Id) return super(NotificationServiceClient, self).is_listening( topic, server) diff --git a/notificationservice-base-v2/docker/ptptrackingfunction/trackingfunctionsdk/client/ptpeventproducer.py b/notificationservice-base-v2/docker/ptptrackingfunction/trackingfunctionsdk/client/ptpeventproducer.py index e177029..d06d396 100644 --- a/notificationservice-base-v2/docker/ptptrackingfunction/trackingfunctionsdk/client/ptpeventproducer.py +++ b/notificationservice-base-v2/docker/ptptrackingfunction/trackingfunctionsdk/client/ptpeventproducer.py @@ -78,7 +78,7 @@ class PtpEventProducer(object): def publish_status_local(self, ptpstatus, source, retry=3): if not self.local_broker_client: return False - topic = '{0}-Event-{1}'.format(source, self.node_name) + topic = '{0}-Event-v2-{1}'.format(source, self.node_name) server = None isretrystopped = False while not isretrystopped: @@ -101,7 +101,7 @@ class PtpEventProducer(object): def publish_status_all(self, ptpstatus, retry=3): if not self.registration_broker_client: return False - topic_all = 'PTP-Event-*' + topic_all = 'PTP-Event-v2-*' server = None isretrystopped = False while not isretrystopped: @@ -133,7 +133,7 @@ class PtpEventProducer(object): if not self.local_broker_client: return False - topic = 'PTP-Status' + topic = 'PTP-Status-v2' server = 'PTP-Tracking-{0}'.format(self.node_name) endpoints = [PtpEventProducer.ListenerEndpoint(handler)] @@ -145,7 +145,7 @@ class PtpEventProducer(object): if not self.registration_broker_client: return False - topic = 'PTP-Status' + topic = 'PTP-Status-v2' server = 'PTP-Tracking-{0}'.format(self.node_name) endpoints = [PtpEventProducer.ListenerEndpoint(handler)] @@ -164,7 +164,7 @@ class PtpEventProducer(object): if not self.local_broker_client: return False - topic = 'PTP-Status' + topic = 'PTP-Status-v2' server = "PTP-Tracking-{0}".format(self.node_name) self.local_broker_client.remove_listener( topic, server) @@ -173,7 +173,7 @@ class PtpEventProducer(object): if not self.registration_broker_client: return False - topic = 'PTP-Status' + topic = 'PTP-Status-v2' server = "PTP-Tracking-{0}".format(self.node_name) self.registration_broker_client.remove_listener( topic, server) @@ -189,7 +189,7 @@ class PtpEventProducer(object): if not self.local_broker_client: return False - topic = 'PTP-Status' + topic = 'PTP-Status-v2' server = "PTP-Tracking-{0}".format(self.node_name) return self.local_broker_client.is_listening( topic, server) @@ -197,7 +197,7 @@ class PtpEventProducer(object): def is_listening_all(self): if not self.registration_broker_client: return False - topic = 'PTP-Status' + topic = 'PTP-Status-v2' server = "PTP-Tracking-{0}".format(self.node_name) return self.registration_broker_client.is_listening( topic, server) diff --git a/stx-ptp-notification-helm/stx-ptp-notification-helm/helm-charts/ptp-notification/resources/scripts/init/ptptracking_start.py b/stx-ptp-notification-helm/stx-ptp-notification-helm/helm-charts/ptp-notification/resources/scripts/init/ptptracking_start.py index e4f9f16..a18e2f8 100644 --- a/stx-ptp-notification-helm/stx-ptp-notification-helm/helm-charts/ptp-notification/resources/scripts/init/ptptracking_start.py +++ b/stx-ptp-notification-helm/stx-ptp-notification-helm/helm-charts/ptp-notification/resources/scripts/init/ptptracking_start.py @@ -1,130 +1,60 @@ # -# Copyright (c) 2021-2022 Wind River Systems, Inc. +# Copyright (c) 2023 Wind River Systems, Inc. # # SPDX-License-Identifier: Apache-2.0 # -#!/usr/bin/python3 -# -*- coding: UTF-8 -*- -import glob -import json -import logging -import os -import re -from trackingfunctionsdk.common.helpers import log_helper -from trackingfunctionsdk.common.helpers import constants -from trackingfunctionsdk.services.daemon import DaemonControl + +# !/usr/bin/python3 +# -*- coding: UTF-8 -*- +import logging LOG = logging.getLogger(__name__) +from trackingfunctionsdk.common.helpers import log_helper + log_helper.config_logger(LOG) +import os +import json +import time +import oslo_messaging +from oslo_config import cfg +from trackingfunctionsdk.services.daemon import DaemonControl THIS_NAMESPACE = os.environ.get("THIS_NAMESPACE", 'notification') -THIS_NODE_NAME = os.environ.get("THIS_NODE_NAME", 'controller-0') +THIS_NODE_NAME = os.environ.get("THIS_NODE_NAME", 'controller-1') THIS_POD_IP = os.environ.get("THIS_POD_IP", '127.0.0.1') -REGISTRATION_USER = os.environ.get("REGISTRATION_USER", "guest") -REGISTRATION_PASS = os.environ.get("REGISTRATION_PASS", "guest") +REGISTRATION_USER = os.environ.get("REGISTRATION_USER", "admin") +REGISTRATION_PASS = os.environ.get("REGISTRATION_PASS", "admin") REGISTRATION_PORT = os.environ.get("REGISTRATION_PORT", "5672") -# REGISTRATION_HOST = \ -# os.environ.get("REGISTRATION_HOST", -# 'registration.notification.svc.cluster.local') -REGISTRATION_HOST = os.environ.get("REGISTRATION_HOST", 'localhost') - +REGISTRATION_HOST = os.environ.get("REGISTRATION_HOST", + 'registration.notification.svc.cluster.local') # 'rabbit://admin:admin@[127.0.0.1]:5672/' # 'rabbit://admin:admin@[::1]:5672/' REGISTRATION_TRANSPORT_ENDPOINT = 'rabbit://{0}:{1}@[{2}]:{3}'.format( REGISTRATION_USER, REGISTRATION_PASS, REGISTRATION_HOST, REGISTRATION_PORT) - -NOTIFICATION_BROKER_USER = os.environ.get("NOTIFICATIONSERVICE_USER", "guest") -NOTIFICATION_BROKER_PASS = os.environ.get("NOTIFICATIONSERVICE_PASS", "guest") +NOTIFICATION_BROKER_USER = os.environ.get("NOTIFICATIONSERVICE_USER", "admin") +NOTIFICATION_BROKER_PASS = os.environ.get("NOTIFICATIONSERVICE_PASS", "admin") NOTIFICATION_BROKER_PORT = os.environ.get("NOTIFICATIONSERVICE_PORT", "5672") - NOTIFICATION_TRANSPORT_ENDPOINT = 'rabbit://{0}:{1}@[{2}]:{3}'.format( - NOTIFICATION_BROKER_USER, NOTIFICATION_BROKER_PASS, THIS_POD_IP, - NOTIFICATION_BROKER_PORT) - -PTP_DEVICE_SIMULATED = os.environ.get("PTP_DEVICE_SIMULATED", True) - + NOTIFICATION_BROKER_USER, NOTIFICATION_BROKER_PASS, THIS_POD_IP, NOTIFICATION_BROKER_PORT) +PTP_DEVICE_SIMULATED = os.environ.get("PTP_DEVICE_SIMULATED", False) PTP_HOLDOVER_SECONDS = os.environ.get("PTP_HOLDOVER_SECONDS", 30) -GNSS_HOLDOVER_SECONDS = os.environ.get("GNSS_HOLDOVER_SECONDS", 30) -OS_CLOCK_HOLDOVER_SECONDS = os.environ.get("OS_CLOCK_HOLDOVER_SECONDS", 30) -OVERALL_HOLDOVER_SECONDS = os.environ.get("OVERALL_HOLDOVER_SECONDS", 30) - -PHC2SYS_CONFIG = None -PHC2SYS_SERVICE_NAME = None -if os.environ.get("PHC2SYS_SERVICE_NAME").lower() == "false": - LOG.info("OS Clock tracking disabled.") -else: - PHC2SYS_CONFIGS = glob.glob(constants.PHC2SYS_CONFIG_PATH + "phc2sys-*") - LOG.debug('Looked for phc2sys configuration file(s) in %s, found %d' - % (constants.PHC2SYS_CONFIG_PATH, len(PHC2SYS_CONFIGS))) - if len(PHC2SYS_CONFIGS) == 0: - LOG.warning("No phc2sys config found.") - else: - PHC2SYS_CONFIG = PHC2SYS_CONFIGS[0] - if len(PHC2SYS_CONFIGS) > 1: - LOG.warning("Multiple phc2sys instances found, selecting %s" % - PHC2SYS_CONFIG) - pattern = '(?<=' + constants.PHC2SYS_CONFIG_PATH + \ - 'phc2sys-).*(?=.conf)' - match = re.search(pattern, PHC2SYS_CONFIG) - PHC2SYS_SERVICE_NAME = match.group() - -PTP4L_CONFIGS = [] -PTP4L_INSTANCES = [] -if os.environ.get("PTP4L_SERVICE_NAME").lower() == "false": - LOG.info("PTP4L instance tracking disabled.") -else: - PTP4L_CONFIGS = glob.glob(constants.PTP_CONFIG_PATH + "ptp4l-*") - LOG.debug('Looked for ptp4l configuration file(s) in %s, found %d' - % (constants.PTP_CONFIG_PATH, len(PTP4L_CONFIGS))) - PTP4L_INSTANCES = [] - pattern = '(?<=' + constants.PTP_CONFIG_PATH + 'ptp4l-).*(?=.conf)' - for conf in PTP4L_CONFIGS: - match = re.search(pattern, conf) - PTP4L_INSTANCES.append(match.group()) - -GNSS_CONFIGS = [] -GNSS_INSTANCES = [] -if os.environ.get("TS2PHC_SERVICE_NAME").lower() == "false": - LOG.info("GNSS instance tracking disabled.") -else: - GNSS_CONFIGS = glob.glob(constants.TS2PHC_CONFIG_PATH + "ts2phc-*") - LOG.debug('Looked for ts2phc configuration file(s) in %s, found %d' - % (constants.TS2PHC_CONFIG_PATH, len(GNSS_CONFIGS))) - GNSS_INSTANCES = [] - pattern = '(?<=' + constants.TS2PHC_CONFIG_PATH + 'ts2phc-).*(?=.conf)' - for conf in GNSS_CONFIGS: - match = re.search(pattern, conf) - GNSS_INSTANCES.append(match.group()) - +PTP_POLL_FREQ_SECONDS = os.environ.get("PTP_POLL_FREQ_SECONDS", 2) context = { 'THIS_NAMESPACE': THIS_NAMESPACE, 'THIS_NODE_NAME': THIS_NODE_NAME, 'THIS_POD_IP': THIS_POD_IP, 'REGISTRATION_TRANSPORT_ENDPOINT': REGISTRATION_TRANSPORT_ENDPOINT, 'NOTIFICATION_TRANSPORT_ENDPOINT': NOTIFICATION_TRANSPORT_ENDPOINT, - 'GNSS_CONFIGS': GNSS_CONFIGS, - 'PHC2SYS_CONFIG': PHC2SYS_CONFIG, - 'PHC2SYS_SERVICE_NAME': PHC2SYS_SERVICE_NAME, - 'PTP4L_CONFIGS': PTP4L_CONFIGS, - 'GNSS_INSTANCES': GNSS_INSTANCES, - 'PTP4L_INSTANCES': PTP4L_INSTANCES, - + # 'NOTIFICATION_BROKER_USER': NOTIFICATION_BROKER_USER, + # 'NOTIFICATION_BROKER_PASS': NOTIFICATION_BROKER_PASS, + # 'NOTIFICATION_BROKER_PORT': NOTIFICATION_BROKER_PORT 'ptptracker_context': { 'device_simulated': PTP_DEVICE_SIMULATED, - 'holdover_seconds': PTP_HOLDOVER_SECONDS - }, - 'gnsstracker_context': { - 'holdover_seconds': GNSS_HOLDOVER_SECONDS - }, - 'osclocktracker_context': { - 'holdover_seconds': OS_CLOCK_HOLDOVER_SECONDS - }, - 'overalltracker_context': { - 'holdover_seconds': OVERALL_HOLDOVER_SECONDS + 'holdover_seconds': PTP_HOLDOVER_SECONDS, + 'poll_freq_seconds': PTP_POLL_FREQ_SECONDS } } - sqlalchemy_conf = { 'url': 'sqlite:///apiserver.db', 'echo': False, @@ -132,9 +62,9 @@ sqlalchemy_conf = { 'pool_recycle': 3600, 'encoding': 'utf-8' } -LOG.info("PTP tracking service startup context %s" % context) sqlalchemy_conf_json = json.dumps(sqlalchemy_conf) -default_daemoncontrol = DaemonControl(sqlalchemy_conf_json, - json.dumps(context)) - +default_daemoncontrol = DaemonControl(sqlalchemy_conf_json, json.dumps(context)) default_daemoncontrol.refresh() +while True: + pass + diff --git a/stx-ptp-notification-helm/stx-ptp-notification-helm/helm-charts/ptp-notification/resources/scripts/init/ptptracking_start_v2.py b/stx-ptp-notification-helm/stx-ptp-notification-helm/helm-charts/ptp-notification/resources/scripts/init/ptptracking_start_v2.py new file mode 100644 index 0000000..dc97320 --- /dev/null +++ b/stx-ptp-notification-helm/stx-ptp-notification-helm/helm-charts/ptp-notification/resources/scripts/init/ptptracking_start_v2.py @@ -0,0 +1,140 @@ +# +# Copyright (c) 2021-2023 Wind River Systems, Inc. +# +# SPDX-License-Identifier: Apache-2.0 +# +#!/usr/bin/python3 +# -*- coding: UTF-8 -*- +import glob +import json +import logging +import os +import re + +from trackingfunctionsdk.common.helpers import log_helper +from trackingfunctionsdk.common.helpers import constants +from trackingfunctionsdk.services.daemon import DaemonControl + +LOG = logging.getLogger(__name__) +log_helper.config_logger(LOG) + +THIS_NAMESPACE = os.environ.get("THIS_NAMESPACE", 'notification') +THIS_NODE_NAME = os.environ.get("THIS_NODE_NAME", 'controller-0') +THIS_POD_IP = os.environ.get("THIS_POD_IP", '127.0.0.1') +REGISTRATION_USER = os.environ.get("REGISTRATION_USER", "guest") +REGISTRATION_PASS = os.environ.get("REGISTRATION_PASS", "guest") +REGISTRATION_PORT = os.environ.get("REGISTRATION_PORT", "5672") +# REGISTRATION_HOST = \ +# os.environ.get("REGISTRATION_HOST", +# 'registration.notification.svc.cluster.local') +REGISTRATION_HOST = os.environ.get("REGISTRATION_HOST", 'localhost') + +# 'rabbit://admin:admin@[127.0.0.1]:5672/' +# 'rabbit://admin:admin@[::1]:5672/' +REGISTRATION_TRANSPORT_ENDPOINT = 'rabbit://{0}:{1}@[{2}]:{3}'.format( + REGISTRATION_USER, REGISTRATION_PASS, REGISTRATION_HOST, REGISTRATION_PORT) + +NOTIFICATION_BROKER_USER = os.environ.get("NOTIFICATIONSERVICE_USER", "guest") +NOTIFICATION_BROKER_PASS = os.environ.get("NOTIFICATIONSERVICE_PASS", "guest") +NOTIFICATION_BROKER_PORT = os.environ.get("NOTIFICATIONSERVICE_PORT", "5672") + +NOTIFICATION_TRANSPORT_ENDPOINT = 'rabbit://{0}:{1}@[{2}]:{3}'.format( + NOTIFICATION_BROKER_USER, NOTIFICATION_BROKER_PASS, THIS_POD_IP, + NOTIFICATION_BROKER_PORT) + +PTP_DEVICE_SIMULATED = os.environ.get("PTP_DEVICE_SIMULATED", True) + +PTP_HOLDOVER_SECONDS = os.environ.get("PTP_HOLDOVER_SECONDS", 30) +GNSS_HOLDOVER_SECONDS = os.environ.get("GNSS_HOLDOVER_SECONDS", 30) +OS_CLOCK_HOLDOVER_SECONDS = os.environ.get("OS_CLOCK_HOLDOVER_SECONDS", 30) +OVERALL_HOLDOVER_SECONDS = os.environ.get("OVERALL_HOLDOVER_SECONDS", 30) + +PHC2SYS_CONFIG = None +PHC2SYS_SERVICE_NAME = None +if os.environ.get("PHC2SYS_SERVICE_NAME").lower() == "false": + LOG.info("OS Clock tracking disabled.") +else: + PHC2SYS_CONFIGS = glob.glob(constants.PHC2SYS_CONFIG_PATH + "phc2sys-*") + LOG.debug('Looked for phc2sys configuration file(s) in %s, found %d' + % (constants.PHC2SYS_CONFIG_PATH, len(PHC2SYS_CONFIGS))) + if len(PHC2SYS_CONFIGS) == 0: + LOG.warning("No phc2sys config found.") + else: + PHC2SYS_CONFIG = PHC2SYS_CONFIGS[0] + if len(PHC2SYS_CONFIGS) > 1: + LOG.warning("Multiple phc2sys instances found, selecting %s" % + PHC2SYS_CONFIG) + pattern = '(?<=' + constants.PHC2SYS_CONFIG_PATH + \ + 'phc2sys-).*(?=.conf)' + match = re.search(pattern, PHC2SYS_CONFIG) + PHC2SYS_SERVICE_NAME = match.group() + +PTP4L_CONFIGS = [] +PTP4L_INSTANCES = [] +if os.environ.get("PTP4L_SERVICE_NAME").lower() == "false": + LOG.info("PTP4L instance tracking disabled.") +else: + PTP4L_CONFIGS = glob.glob(constants.PTP_CONFIG_PATH + "ptp4l-*") + LOG.debug('Looked for ptp4l configuration file(s) in %s, found %d' + % (constants.PTP_CONFIG_PATH, len(PTP4L_CONFIGS))) + PTP4L_INSTANCES = [] + pattern = '(?<=' + constants.PTP_CONFIG_PATH + 'ptp4l-).*(?=.conf)' + for conf in PTP4L_CONFIGS: + match = re.search(pattern, conf) + PTP4L_INSTANCES.append(match.group()) + +GNSS_CONFIGS = [] +GNSS_INSTANCES = [] +if os.environ.get("TS2PHC_SERVICE_NAME").lower() == "false": + LOG.info("GNSS instance tracking disabled.") +else: + GNSS_CONFIGS = glob.glob(constants.TS2PHC_CONFIG_PATH + "ts2phc-*") + LOG.debug('Looked for ts2phc configuration file(s) in %s, found %d' + % (constants.TS2PHC_CONFIG_PATH, len(GNSS_CONFIGS))) + GNSS_INSTANCES = [] + pattern = '(?<=' + constants.TS2PHC_CONFIG_PATH + 'ts2phc-).*(?=.conf)' + for conf in GNSS_CONFIGS: + match = re.search(pattern, conf) + GNSS_INSTANCES.append(match.group()) + +context = { + 'THIS_NAMESPACE': THIS_NAMESPACE, + 'THIS_NODE_NAME': THIS_NODE_NAME, + 'THIS_POD_IP': THIS_POD_IP, + 'REGISTRATION_TRANSPORT_ENDPOINT': REGISTRATION_TRANSPORT_ENDPOINT, + 'NOTIFICATION_TRANSPORT_ENDPOINT': NOTIFICATION_TRANSPORT_ENDPOINT, + 'GNSS_CONFIGS': GNSS_CONFIGS, + 'PHC2SYS_CONFIG': PHC2SYS_CONFIG, + 'PHC2SYS_SERVICE_NAME': PHC2SYS_SERVICE_NAME, + 'PTP4L_CONFIGS': PTP4L_CONFIGS, + 'GNSS_INSTANCES': GNSS_INSTANCES, + 'PTP4L_INSTANCES': PTP4L_INSTANCES, + + 'ptptracker_context': { + 'device_simulated': PTP_DEVICE_SIMULATED, + 'holdover_seconds': PTP_HOLDOVER_SECONDS + }, + 'gnsstracker_context': { + 'holdover_seconds': GNSS_HOLDOVER_SECONDS + }, + 'osclocktracker_context': { + 'holdover_seconds': OS_CLOCK_HOLDOVER_SECONDS + }, + 'overalltracker_context': { + 'holdover_seconds': OVERALL_HOLDOVER_SECONDS + } +} + +sqlalchemy_conf = { + 'url': 'sqlite:///apiserver.db', + 'echo': False, + 'echo_pool': False, + 'pool_recycle': 3600, + 'encoding': 'utf-8' +} +LOG.info("PTP tracking service startup context %s" % context) +sqlalchemy_conf_json = json.dumps(sqlalchemy_conf) +default_daemoncontrol = DaemonControl(sqlalchemy_conf_json, + json.dumps(context)) + +default_daemoncontrol.refresh() diff --git a/stx-ptp-notification-helm/stx-ptp-notification-helm/helm-charts/ptp-notification/templates/daemonset.yaml b/stx-ptp-notification-helm/stx-ptp-notification-helm/helm-charts/ptp-notification/templates/daemonset.yaml index 9003a36..3a46677 100644 --- a/stx-ptp-notification-helm/stx-ptp-notification-helm/helm-charts/ptp-notification/templates/daemonset.yaml +++ b/stx-ptp-notification-helm/stx-ptp-notification-helm/helm-charts/ptp-notification/templates/daemonset.yaml @@ -1,5 +1,5 @@ # -# Copyright (c) 2021 Wind River Systems, Inc. +# Copyright (c) 2021-2023 Wind River Systems, Inc. # # SPDX-License-Identifier: Apache-2.0 # @@ -91,9 +91,10 @@ spec: volumeMounts: - name: scripts mountPath: /mnt - - name: {{ .Chart.Name }}-ptptracking - image: "{{ .Values.ptptracking.image.repository }}:{{ .Values.ptptracking.image.tag }}" - imagePullPolicy: {{ .Values.ptptracking.image.pullPolicy }} +{{- if .Values.ptptrackingv2.enabled }} + - name: {{ .Chart.Name }}-ptptrackingv2 + image: "{{ .Values.ptptrackingv2.image.repository }}:{{ .Values.ptptrackingv2.image.tag }}" + imagePullPolicy: {{ .Values.ptptrackingv2.image.pullPolicy }} tty: true stdin: true env: @@ -110,13 +111,13 @@ spec: - name: THIS_NAMESPACE value: {{ .Values.global.namespace }} - name: PTP_DEVICE_SIMULATED - value: "{{ .Values.ptptracking.device.simulated }}" + value: "{{ .Values.ptptrackingv2.device.simulated }}" - name: PTP_HOLDOVER_SECONDS - value: "{{ .Values.ptptracking.device.holdover_seconds }}" + value: "{{ .Values.ptptrackingv2.device.holdover_seconds }}" - name: OS_CLOCK_HOLDOVER_SECONDS - value: "{{ .Values.ptptracking.osclock.holdover_seconds }}" + value: "{{ .Values.ptptrackingv2.osclock.holdover_seconds }}" - name: OVERALL_HOLDOVER_SECONDS - value: "{{ .Values.ptptracking.overall.holdover_seconds }}" + value: "{{ .Values.ptptrackingv2.overall.holdover_seconds }}" - name: NOTIFICATIONSERVICE_USER value: "admin" - name: NOTIFICATIONSERVICE_PASS @@ -132,16 +133,16 @@ spec: - name: REGISTRATION_HOST value: "registration.{{.Values.global.namespace}}.svc.cluster.local" - name: PTP4L_SERVICE_NAME - value: "{{ .Values.ptptracking.ptp4lServiceName }}" + value: "{{ .Values.ptptrackingv2.ptp4lServiceName }}" - name: PHC2SYS_SERVICE_NAME - value: "{{ .Values.ptptracking.phc2sysServiceName }}" + value: "{{ .Values.ptptrackingv2.phc2sysServiceName }}" - name: TS2PHC_SERVICE_NAME - value: "{{ .Values.ptptracking.ts2phcServiceName }}" + value: "{{ .Values.ptptrackingv2.ts2phcServiceName }}" - name: LOGGING_LEVEL - value: "{{ .Values.ptptracking.log_level }}" + value: "{{ .Values.ptptrackingv2.log_level }}" - name: CONTROL_TIMEOUT - value: "{{ .Values.ptptracking.control_timeout }}" - command: ["python3", "/mnt/ptptracking_start.py"] + value: "{{ .Values.ptptrackingv2.control_timeout }}" + command: ["python3", "/mnt/ptptracking_start_v2.py"] securityContext: privileged: true capabilities: @@ -150,14 +151,11 @@ spec: volumeMounts: - name: scripts mountPath: /mnt - {{ if .Values.ptptracking.device.simulated }} + {{ if .Values.ptptrackingv2.device.simulated }} {{ else }} - name: ptpdir mountPath: /var/run/ readOnly: false - - name: varrun - mountPath: {{ .Values.ptptracking.ptp4lSocket }} - readOnly: false - name: pmc mountPath: /usr/sbin/pmc readOnly: false @@ -179,6 +177,76 @@ spec: - name: hostsys mountPath: /hostsys/ readOnly: true +{{ end }} +{{- if .Values.ptptracking.enabled }} + - name: {{ .Chart.Name }}-ptptracking + image: "{{ .Values.ptptracking.image.repository }}:{{ .Values.ptptracking.image.tag }}" + imagePullPolicy: {{ .Values.ptptracking.image.pullPolicy }} + tty: true + stdin: true + env: + - name: THIS_NODE_NAME + valueFrom: + fieldRef: + fieldPath: spec.nodeName + - name: THIS_POD_IP + valueFrom: + fieldRef: + fieldPath: status.podIP + - name: THIS_NAMESPACE + value: {{ .Values.global.namespace }} + - name: PTP_DEVICE_SIMULATED + value: "{{ .Values.ptptracking.device.simulated }}" + - name: PTP_HOLDOVER_SECONDS + value: "{{ .Values.ptptracking.device.holdover_seconds }}" + - name: PTP_POLL_FREQ_SECONDS + value: "{{ .Values.ptptracking.device.poll_freq_seconds }}" + - name: NOTIFICATIONSERVICE_USER + value: "admin" + - name: NOTIFICATIONSERVICE_PASS + value: "admin" + - name: NOTIFICATIONSERVICE_PORT + value: "5672" + - name: REGISTRATION_USER + value: "admin" + - name: REGISTRATION_PASS + value: "admin" + - name: REGISTRATION_PORT + value: "5672" + - name: REGISTRATION_HOST + value: "registration.{{.Values.global.namespace}}.svc.cluster.local" + - name: PTP4L_SERVICE_NAME + value: "{{ .Values.ptptracking.ptp4lServiceName }}" + - name: PHC2SYS_SERVICE_NAME + value: "{{ .Values.ptptracking.phc2sysServiceName }}" + - name: PYTHONPATH + value: "/opt/ptptrackingfunction" + - name: LOGGING_LEVEL + value: "{{ .Values.ptptracking.logging_level }}" + command: ["python3", "/mnt/ptptracking_start.py"] + securityContext: + privileged: true + capabilities: + add: + - CAP_SYS_ADMIN + volumeMounts: + - name: scripts + mountPath: /mnt + {{ if .Values.ptptracking.device.simulated }} + {{ else }} + - name: ptpdir + mountPath: /var/run/ + readOnly: false + - name: varrun + mountPath: {{ .Values.ptptracking.ptp4lSocket }} + readOnly: false + - name: pmc + mountPath: /usr/sbin/pmc + readOnly: false + {{ end }} + - name: conf + mountPath: /ptp/ + readOnly: true volumes: - name: scripts configMap: @@ -219,6 +287,7 @@ spec: hostPath: path: /sys/ type: Directory +{{ end }} tolerations: - key: "node-role.kubernetes.io/master" operator: "Exists" diff --git a/stx-ptp-notification-helm/stx-ptp-notification-helm/helm-charts/ptp-notification/values.yaml b/stx-ptp-notification-helm/stx-ptp-notification-helm/helm-charts/ptp-notification/values.yaml index d5e014f..4ba31b2 100644 --- a/stx-ptp-notification-helm/stx-ptp-notification-helm/helm-charts/ptp-notification/values.yaml +++ b/stx-ptp-notification-helm/stx-ptp-notification-helm/helm-charts/ptp-notification/values.yaml @@ -1,5 +1,5 @@ # -# Copyright (c) 2021 Wind River Systems, Inc. +# Copyright (c) 2021-2023 Wind River Systems, Inc. # # SPDX-License-Identifier: Apache-2.0 # @@ -66,6 +66,23 @@ location: pullPolicy: IfNotPresent ptptracking: + enabled: True + imagePullSecrets: default-registry-key + ptp4lSocket: /var/run/ptp4l-ptp4l-legacy + ptp4lServiceName: ptp4l-legacy + phc2sysServiceName: phc2sys-legacy + logging_level: INFO + image: + repository: starlingx/notificationservice-base + tag: master-debian-stable-20230205T070000Z.0 + pullPolicy: IfNotPresent + device: + simulated: false + holdover_seconds: 15 + poll_freq_seconds: 2 + +ptptrackingv2: + enabled: True imagePullSecrets: default-registry-key ptp4lSocket: /var/run/ptp4l-ptp4l-legacy ptp4lServiceName: True @@ -73,8 +90,8 @@ ptptracking: ts2phcServiceName: True log_level: INFO image: - repository: starlingx/notificationservice-base - tag: stx.8.0-v2.0.2 + repository: starlingx/notificationservice-base-v2 + tag: master-debian-stable-20230205T070000Z.0 pullPolicy: IfNotPresent control_timeout: 2 device: