Tara Nath Subedi 19841dd96f 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 <tara.subedi@windriver.com>
Change-Id: Id98c2ae68a1adb5b17f1a336ac609cd57fe3a026
2025-01-28 13:41:48 -05:00

371 lines
14 KiB
YAML

#
# Copyright (c) 2021-2025 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
---
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: {{ include "notification.fullname" . }}
namespace: {{ .Values.global.namespace }}
labels:
release: {{ .Release.Name }}
app: {{ include "notification.name" . }}
chart: {{ .Chart.Name }}
spec:
selector:
matchLabels:
app: {{ include "notification.name" . }}
release: {{ .Release.Name }}
template:
metadata:
namespace: {{ .Values.global.namespace }}
labels:
app: {{ include "notification.name" . }}
release: {{ .Release.Name }}
app.starlingx.io/component: {{ ternary "application" "platform" .Values.labels.isApplication}}
annotations: {
configchecksum: {{ toYaml .Values.labels | sha256sum | trunc 63 }},
checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum | trunc 63}}
}
spec:
imagePullSecrets:
- name: {{ .Values.ptptracking.imagePullSecrets}}
{{ if .Values.ptptracking.device.simulated }}
{{ else }}
{{- if .Values.notification.affinity }}
affinity:
{{ toYaml .Values.notification.affinity | indent 8 }}
{{- end }}
{{ end }}
containers:
- name: {{ .Chart.Name }}-rabbitmq
image: "{{ .Values.notification.image.repository }}:{{ .Values.notification.image.tag }}"
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: RABBITMQ_DEFAULT_USER
value: "{{ .Values.notification.endpoint.user }}"
- name: RABBITMQ_DEFAULT_PASS
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 }}
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: REGISTRATION_HOST
value: "{{ .Values.registration.endpoint.host }}"
- name: REGISTRATION_USER
value: "{{ .Values.registration.endpoint.user }}"
- name: REGISTRATION_PASS
value: "{{ .Values.registration.endpoint.pass }}"
- name: REGISTRATION_PORT
value: "{{ .Values.registration.endpoint.port }}"
- name: NOTIFICATIONSERVICE_USER
value: "{{ .Values.notification.endpoint.user }}"
- name: NOTIFICATIONSERVICE_PASS
value: "{{ .Values.notification.endpoint.pass }}"
- name: NOTIFICATIONSERVICE_PORT
value: "{{ .Values.notification.endpoint.port }}"
- name: LOCATION_SERVICE_HOST
valueFrom:
fieldRef:
fieldPath: status.podIP
- name: LOCATION_SERVICE_PORT
value: "{{ .Values.location.endpoint.port }}"
- name: LOGGING_LEVEL
value: "{{ .Values.location.log_level }}"
command: ["python3", "/opt/locationservice/locationservice_start.py"]
{{- if .Values.location.endpoint.liveness }}
livenessProbe:
failureThreshold: {{ .Values.location.endpoint.livenessFailureThreshold}}
httpGet:
path: /health
port: {{ .Values.location.endpoint.port }}
scheme: HTTP
initialDelaySeconds: {{ .Values.location.endpoint.livenessDelaySeconds }}
periodSeconds: {{ .Values.location.endpoint.livenessPeriodSeconds }}
successThreshold: 1
timeoutSeconds: {{ .Values.location.endpoint.livenessTimeoutSeconds }}
{{ end }}
volumeMounts:
- name: scripts
mountPath: /mnt
{{- 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:
- name: THIS_NODE_NAME
valueFrom:
fieldRef:
fieldPath: spec.nodeName
- name: THIS_POD_IP
valueFrom:
fieldRef:
fieldPath: status.podIP
- name: PYTHONPATH
value: /opt/ptptrackingfunction
- name: THIS_NAMESPACE
value: {{ .Values.global.namespace }}
- name: PTP_DEVICE_SIMULATED
value: "{{ .Values.ptptrackingv2.device.simulated }}"
- name: PTP_HOLDOVER_SECONDS
value: "{{ .Values.ptptrackingv2.device.holdover_seconds }}"
- name: OS_CLOCK_HOLDOVER_SECONDS
value: "{{ .Values.ptptrackingv2.osclock.holdover_seconds }}"
- name: OVERALL_HOLDOVER_SECONDS
value: "{{ .Values.ptptrackingv2.overall.holdover_seconds }}"
- name: NOTIFICATIONSERVICE_USER
value: "{{ .Values.notification.endpoint.user }}"
- name: NOTIFICATIONSERVICE_PASS
value: "{{ .Values.notification.endpoint.pass }}"
- name: NOTIFICATIONSERVICE_PORT
value: "{{ .Values.notification.endpoint.port }}"
- name: REGISTRATION_USER
value: "{{ .Values.registration.endpoint.user }}"
- name: REGISTRATION_PASS
value: "{{ .Values.registration.endpoint.pass }}"
- name: REGISTRATION_PORT
value: "{{ .Values.registration.endpoint.port }}"
- name: REGISTRATION_HOST
value: "registration.{{.Values.global.namespace}}.svc.cluster.local"
- name: HEALTH_API_HOST
valueFrom:
fieldRef:
fieldPath: status.podIP
- name: HEALTH_API_PORT
value: "{{ .Values.ptptrackingv2.endpoint.port }}"
- name: PTP4L_SERVICE_NAME
value: "{{ .Values.ptptrackingv2.ptp4lServiceName }}"
- name: PTP4L_CLOCK_CLASS_LOCKED_LIST
value: "{{ .Values.ptptrackingv2.ptp4lClockClassLockedList }}"
- name: PTP4L_UTC_OFFSET
value: "{{ .Values.ptptrackingv2.ptp4lUtcOffset }}"
- name: PHC2SYS_SERVICE_NAME
value: "{{ .Values.ptptrackingv2.phc2sysServiceName }}"
- name: PHC2SYS_TOLERANCE_THRESHOLD
value: "{{ .Values.ptptrackingv2.phc2sysToleranceThreshold }}"
- name: TS2PHC_SERVICE_NAME
value: "{{ .Values.ptptrackingv2.ts2phcServiceName }}"
- name: LOGGING_LEVEL
value: "{{ .Values.ptptrackingv2.log_level }}"
- name: CONTROL_TIMEOUT
value: "{{ .Values.ptptrackingv2.control_timeout }}"
- name: NOTIFICATION_FORMAT
value: "{{ .Values.ptptrackingv2.notification_format }}"
command: ["python3", "/mnt/ptptracking_start_v2.py"]
{{- if .Values.ptptrackingv2.endpoint.liveness }}
livenessProbe:
failureThreshold: {{ .Values.ptptrackingv2.endpoint.livenessFailureThreshold }}
httpGet:
path: /health
port: {{ .Values.ptptrackingv2.endpoint.port }}
scheme: HTTP
initialDelaySeconds: {{ .Values.ptptrackingv2.endpoint.livenessDelaySeconds }}
periodSeconds: {{ .Values.ptptrackingv2.endpoint.livenessPeriodSeconds }}
successThreshold: 1
timeoutSeconds: {{ .Values.ptptrackingv2.endpoint.livenessTimeoutSeconds }}
{{ end }}
securityContext:
privileged: true
capabilities:
add:
- CAP_SYS_ADMIN
volumeMounts:
- name: scripts
mountPath: /mnt
{{ if .Values.ptptrackingv2.device.simulated }}
{{ else }}
- name: ptpdir
mountPath: /var/run/
readOnly: false
- name: pmc
mountPath: /usr/sbin/pmc
readOnly: false
- name: phcctl
mountPath: /usr/sbin/phc_ctl
readOnly: false
{{ end }}
- name: conf
mountPath: /ptp/
readOnly: true
- name: logs
mountPath: /logs/
readOnly: true
- name: ice
mountPath: /ice/
readOnly: true
- name: proc
mountPath: /host/proc/
- 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: "{{ .Values.notification.endpoint.user }}"
- name: NOTIFICATIONSERVICE_PASS
value: "{{ .Values.notification.endpoint.pass }}"
- name: NOTIFICATIONSERVICE_PORT
value: "{{ .Values.notification.endpoint.port }}"
- name: REGISTRATION_USER
value: "{{ .Values.registration.endpoint.user }}"
- name: REGISTRATION_PASS
value: "{{ .Values.registration.endpoint.pass }}"
- name: REGISTRATION_PORT
value: "{{ .Values.registration.endpoint.port }}"
- name: REGISTRATION_HOST
value: "registration.{{.Values.global.namespace}}.svc.cluster.local"
- name: HEALTH_API_HOST
valueFrom:
fieldRef:
fieldPath: status.podIP
- name: HEALTH_API_PORT
value: "{{ .Values.ptptracking.endpoint.port }}"
- name: PTP4L_SERVICE_NAME
value: "{{ .Values.ptptracking.ptp4lServiceName }}"
- name: PTP4L_CLOCK_CLASS_LOCKED_LIST
value: "{{ .Values.ptptracking.ptp4lClockClassLockedList }}"
- name: PHC2SYS_SERVICE_NAME
value: "{{ .Values.ptptracking.phc2sysServiceName }}"
- name: PHC2SYS_COM_SOCKET
value: "{{ .Values.ptptracking.phc2sysComSocket }}"
- name: PYTHONPATH
value: "/opt/ptptrackingfunction"
- name: LOGGING_LEVEL
value: "{{ .Values.ptptracking.logging_level }}"
command: ["python3", "/mnt/ptptracking_start.py"]
{{- if .Values.ptptracking.endpoint.liveness }}
livenessProbe:
failureThreshold: {{ .Values.ptptracking.endpoint.livenessFailureThreshold }}
httpGet:
path: /health
port: {{ .Values.ptptracking.endpoint.port }}
scheme: HTTP
initialDelaySeconds: {{ .Values.ptptracking.endpoint.livenessDelaySeconds }}
periodSeconds: {{ .Values.ptptracking.endpoint.livenessPeriodSeconds }}
successThreshold: 1
timeoutSeconds: {{ .Values.ptptracking.endpoint.livenessTimeoutSeconds }}
{{ end }}
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
{{ end }}
volumes:
- name: scripts
configMap:
name: {{ .Chart.Name }}-scripts-configmap
- name: ptpdir
hostPath:
path: /var/run/
type: Directory
{{ if .Values.ptptracking.device.simulated }}
{{ else }}
- name: varrun
hostPath:
path: {{ .Values.ptptracking.ptp4lSocket }}
type: Socket
{{ end }}
- name: pmc
hostPath:
path: /usr/sbin/pmc
type: File
- name: phcctl
hostPath:
path: /usr/sbin/phc_ctl
type: File
- name: conf
hostPath:
path: /etc/
type: Directory
- name: logs
hostPath:
path: /var/log/
type: Directory
- name: ice
hostPath:
path: /sys/kernel/debug/
type: Directory
- name: proc
hostPath:
path: /proc
type: Directory
- name: hostsys
hostPath:
path: /sys/
type: Directory
tolerations:
- key: "node-role.kubernetes.io/master"
operator: "Exists"
effect: "NoSchedule"
- key: "node-role.kubernetes.io/control-plane"
operator: "Exists"
effect: "NoSchedule"