Adding tracing config to helm charts for CSITs 49/138349/3
authorsaul.gill <saul.gill@est.tech>
Thu, 27 Jun 2024 16:22:12 +0000 (17:22 +0100)
committersaul.gill <saul.gill@est.tech>
Mon, 1 Jul 2024 13:40:23 +0000 (14:40 +0100)
Issue-ID: POLICY-5062
Change-Id: I99870cca1793385989a7c4b80049f7031558333e
Signed-off-by: saul.gill <saul.gill@est.tech>
44 files changed:
csit/run-k8s-csit.sh
helm/policy/Chart.yaml
helm/policy/components/policy-clamp-ac-a1pms-ppnt/resources/config/A1pmsParticipantParameters.yaml
helm/policy/components/policy-clamp-ac-a1pms-ppnt/resources/config/a1pms-participant.sh [new file with mode: 0644]
helm/policy/components/policy-clamp-ac-a1pms-ppnt/templates/_helpers.tpl [new file with mode: 0644]
helm/policy/components/policy-clamp-ac-a1pms-ppnt/templates/configmap.yaml
helm/policy/components/policy-clamp-ac-a1pms-ppnt/templates/deployment.yaml
helm/policy/components/policy-clamp-ac-a1pms-ppnt/values.yaml
helm/policy/components/policy-clamp-ac-http-ppnt/resources/config/HttpParticipantParameters.yaml
helm/policy/components/policy-clamp-ac-http-ppnt/resources/config/http-participant.sh [new file with mode: 0755]
helm/policy/components/policy-clamp-ac-http-ppnt/templates/_helpers.tpl [new file with mode: 0644]
helm/policy/components/policy-clamp-ac-http-ppnt/templates/configmap.yaml
helm/policy/components/policy-clamp-ac-http-ppnt/templates/deployment.yaml
helm/policy/components/policy-clamp-ac-http-ppnt/values.yaml
helm/policy/components/policy-clamp-ac-k8s-ppnt/resources/config/KubernetesParticipantParameters.yaml
helm/policy/components/policy-clamp-ac-k8s-ppnt/resources/config/kubernetes-participant.sh [new file with mode: 0755]
helm/policy/components/policy-clamp-ac-k8s-ppnt/templates/_helpers.tpl [new file with mode: 0644]
helm/policy/components/policy-clamp-ac-k8s-ppnt/templates/deployment.yaml
helm/policy/components/policy-clamp-ac-k8s-ppnt/values.yaml
helm/policy/components/policy-clamp-ac-kserve-ppnt/resources/config/KserveParticipantParameters.yaml
helm/policy/components/policy-clamp-ac-kserve-ppnt/resources/config/kserve-participant.sh [new file with mode: 0644]
helm/policy/components/policy-clamp-ac-kserve-ppnt/templates/_helpers.tpl [new file with mode: 0644]
helm/policy/components/policy-clamp-ac-kserve-ppnt/templates/configmap.yaml
helm/policy/components/policy-clamp-ac-kserve-ppnt/templates/deployment.yaml
helm/policy/components/policy-clamp-ac-kserve-ppnt/values.yaml
helm/policy/components/policy-clamp-ac-pf-ppnt/resources/config/PolicyParticipantParameters.yaml
helm/policy/components/policy-clamp-ac-pf-ppnt/resources/config/policy-participant.sh [new file with mode: 0755]
helm/policy/components/policy-clamp-ac-pf-ppnt/templates/_helpers.tpl [new file with mode: 0644]
helm/policy/components/policy-clamp-ac-pf-ppnt/templates/configmap.yaml
helm/policy/components/policy-clamp-ac-pf-ppnt/templates/deployment.yaml
helm/policy/components/policy-clamp-ac-pf-ppnt/values.yaml
helm/policy/components/policy-clamp-ac-sim-ppnt/resources/config/SimulatorParticipantParameters.yaml
helm/policy/components/policy-clamp-ac-sim-ppnt/resources/config/sim-participant.sh [new file with mode: 0755]
helm/policy/components/policy-clamp-ac-sim-ppnt/templates/_helpers.tpl [new file with mode: 0644]
helm/policy/components/policy-clamp-ac-sim-ppnt/templates/configmap.yaml
helm/policy/components/policy-clamp-ac-sim-ppnt/templates/deployment.yaml
helm/policy/components/policy-clamp-ac-sim-ppnt/values.yaml
helm/policy/components/policy-clamp-runtime-acm/resources/config/acRuntimeParameters.yaml
helm/policy/components/policy-clamp-runtime-acm/resources/config/acm-runtime.sh [new file with mode: 0755]
helm/policy/components/policy-clamp-runtime-acm/templates/_helpers.tpl [new file with mode: 0644]
helm/policy/components/policy-clamp-runtime-acm/templates/configmap.yaml
helm/policy/components/policy-clamp-runtime-acm/templates/deployment.yaml
helm/policy/components/policy-clamp-runtime-acm/values.yaml
helm/policy/values.yaml

index 75a42e7..4e25356 100755 (executable)
@@ -47,6 +47,7 @@ POLICY_K8S_PPNT_CONTAINER="policy-clamp-ac-k8s-ppnt"
 POLICY_HTTP_PPNT_CONTAINER="policy-clamp-ac-http-ppnt"
 POLICY_SIM_PPNT_CONTAINER="policy-clamp-ac-sim-ppnt"
 POLICY_PF_PPNT_CONTAINER="policy-clamp-ac-pf-ppnt"
+JAEGER_CONTAINER="jaeger"
 KAFKA_CONTAINER="kafka-deployment"
 ZK_CONTAINER="zookeeper-deployment"
 KAFKA_DIR=${WORKSPACE}/helm/cp-kafka
@@ -234,10 +235,12 @@ function set_project_config() {
 
     clamp | policy-clamp)
         export ROBOT_FILE=$POLICY_CLAMP_ROBOT
-        export READINESS_CONTAINERS=($POLICY_CLAMP_CONTAINER,$POLICY_APEX_CONTAINER,$POLICY_PF_PPNT_CONTAINER,$POLICY_K8S_PPNT_CONTAINER,$POLICY_HTTP_PPNT_CONTAINER,$POLICY_SIM_PPNT_CONTAINER)
+        export READINESS_CONTAINERS=($POLICY_CLAMP_CONTAINER,$POLICY_APEX_CONTAINER,$POLICY_PF_PPNT_CONTAINER,$POLICY_K8S_PPNT_CONTAINER,
+            $POLICY_HTTP_PPNT_CONTAINER,$POLICY_SIM_PPNT_CONTAINER,$JAEGER_CONTAINER)
         export SET_VALUES="--set $POLICY_CLAMP_CONTAINER.enabled=true --set $POLICY_APEX_CONTAINER.enabled=true
             --set $POLICY_PF_PPNT_CONTAINER.enabled=true --set $POLICY_K8S_PPNT_CONTAINER.enabled=true
-            --set $POLICY_HTTP_PPNT_CONTAINER.enabled=true --set $POLICY_SIM_PPNT_CONTAINER.enabled=true"
+            --set $POLICY_HTTP_PPNT_CONTAINER.enabled=true --set $POLICY_SIM_PPNT_CONTAINER.enabled=true
+            --set $JAEGER_CONTAINER.enabled=true"
         install_chartmuseum
         ;;
 
index 6947078..9eb3912 100755 (executable)
@@ -78,3 +78,8 @@ dependencies:
     version: ~11.x-0
     repository: 'file://components/policy-clamp-ac-a1pms-ppnt'
     condition: policy-clamp-ac-a1pms-ppnt.enabled
+  - name: jaeger-all-in-one
+    version: 0.1.12
+    repository: https://raw.githubusercontent.com/hansehe/jaeger-all-in-one/master/helm/charts
+    alias: jaeger
+    condition: jaeger.enabled
index f258948..14de491 100755 (executable)
@@ -16,6 +16,8 @@
 #  ============LICENSE_END=========================================================
 
 spring:
+  application:
+    name: {{ .Values.applicationName }}
   security:
     user:
       name: participantUser
@@ -53,6 +55,7 @@ participant:
             - "{{ .Values.global.kafkaServer }}:9092"
           topicCommInfrastructure: kafka
           fetchTimeout: 15000
+          allowTracing: {{ include "policy-clamp-ac-a1pms-ppnt.jaeger-enabled" . }}
           additionalProps:
             group.id: policy-clamp-ac-a1pms-ppnt
         - topic: ${participant.intermediaryParameters.topics.syncTopic}
@@ -60,17 +63,24 @@ participant:
             - "{{ .Values.global.kafkaServer }}:9092"
           topicCommInfrastructure: kafka
           fetchTimeout: 15000
+          allowTracing: {{ include "policy-clamp-ac-a1pms-ppnt.jaeger-enabled" . }}
       topicSinks:
         - topic: ${participant.intermediaryParameters.topics.operationTopic}
           servers:
             - "{{ .Values.global.kafkaServer }}:9092"
           topicCommInfrastructure: kafka
+          allowTracing: {{ include "policy-clamp-ac-a1pms-ppnt.jaeger-enabled" . }}
     participantSupportedElementTypes:
       -
         typeName: org.onap.policy.clamp.acm.A1PMSAutomationCompositionElement
         typeVersion: 1.0.1
 
 management:
+  tracing:
+    propagation:
+      produce: [{{ .Values.jaeger.producer.type }}]
+    sampling:
+      probability: {{ .Values.jaeger.sampling.probability }}
   endpoints:
     web:
       base-path: /
@@ -83,4 +93,13 @@ server:
   ssl:
     enabled: false
 
+tracing:
+  enabled: {{ .Values.jaeger.enabled }}
+  exporter:
+    endpoint: {{ .Values.jaeger.collector.host }}:{{ include "policy-clamp-ac-a1pms-ppnt.exporter-port" . }}
+    protocol: {{ .Values.jaeger.collector.protocol }}
+  sampler:
+    jaeger-remote:
+      endpoint: {{ .Values.jaeger.collector.host }}:{{ .Values.jaeger.collector.portJaegerGrpc }}
+
 
diff --git a/helm/policy/components/policy-clamp-ac-a1pms-ppnt/resources/config/a1pms-participant.sh b/helm/policy/components/policy-clamp-ac-a1pms-ppnt/resources/config/a1pms-participant.sh
new file mode 100644 (file)
index 0000000..88ff3b8
--- /dev/null
@@ -0,0 +1,60 @@
+#!/usr/bin/env sh
+#
+# ============LICENSE_START=======================================================
+#  Copyright (C) 2024 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.
+#
+# SPDX-License-Identifier: Apache-2.0
+# ============LICENSE_END=========================================================
+#
+
+KEYSTORE="${KEYSTORE:-$POLICY_HOME/etc/ssl/policy-keystore}"
+TRUSTSTORE="${TRUSTSTORE:-$POLICY_HOME/etc/ssl/policy-truststore}"
+KEYSTORE_PASSWD="${KEYSTORE_PASSWD:-Pol1cy_0nap}"
+TRUSTSTORE_PASSWD="${TRUSTSTORE_PASSWD:-Pol1cy_0nap}"
+
+if [ "$#" -eq 1 ]; then
+    CONFIG_FILE=$1
+fi
+
+if [ -z "$CONFIG_FILE" ]; then
+    CONFIG_FILE="${POLICY_HOME}/etc/A1pmsParticipantParameters.yaml"
+fi
+
+echo "Policy clamp A1 Pms participant config file: $CONFIG_FILE"
+
+if [ -f "${POLICY_HOME}/etc/mounted/policy-truststore" ]; then
+    echo "overriding policy-truststore"
+    cp -f "${POLICY_HOME}"/etc/mounted/policy-truststore "${TRUSTSTORE}"
+fi
+
+if [ -f "${POLICY_HOME}/etc/mounted/policy-keystore" ]; then
+    echo "overriding policy-keystore"
+    cp -f "${POLICY_HOME}"/etc/mounted/policy-keystore "${KEYSTORE}"
+fi
+
+if [ -f "${POLICY_HOME}/etc/mounted/logback.xml" ]; then
+    echo "overriding logback xml file"
+    cp -f "${POLICY_HOME}"/etc/mounted/logback.xml "${POLICY_HOME}"/etc/
+fi
+
+$JAVA_HOME/bin/java \
+    -Dlogging.config="${POLICY_HOME}/etc/logback.xml" \
+    -Dserver.ssl.keyStore="${KEYSTORE}" \
+    -Dserver.ssl.keyStorePassword="${KEYSTORE_PASSWD}" \
+    -Djavax.net.ssl.trustStore="${TRUSTSTORE}" \
+    -Djavax.net.ssl.trustStorePassword="${TRUSTSTORE_PASSWD}" \
+    -Dotel.java.global-autoconfigure.enabled=true \
+    -jar /app/app.jar \
+    --spring.config.location="${CONFIG_FILE}"
diff --git a/helm/policy/components/policy-clamp-ac-a1pms-ppnt/templates/_helpers.tpl b/helm/policy/components/policy-clamp-ac-a1pms-ppnt/templates/_helpers.tpl
new file mode 100644 (file)
index 0000000..8f05017
--- /dev/null
@@ -0,0 +1,58 @@
+{{/*
+#
+# ============LICENSE_START=======================================================
+#  Copyright (C) 2024 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.
+#
+# SPDX-License-Identifier: Apache-2.0
+# ============LICENSE_END=========================================================
+#
+*/}}
+
+{{/*
+This helper defines which exporter port must be used depending on protocol
+*/}}
+{{- define "policy-clamp-ac-a1pms-ppnt.exporter-port" }}
+  {{- $jaegerExporterPort := .Values.jaeger.collector.portOtlpGrpc -}}
+    {{- if .Values.jaeger.collector.protocol -}}
+      {{- if eq .Values.jaeger.collector.protocol "http" -}}
+        {{- $jaegerExporterPort = .Values.jaeger.collector.portOtlpHttp -}}
+      {{- end -}}
+    {{- end -}}
+  {{- $jaegerExporterPort -}}
+{{- end -}}
+
+{{/*
+This helper defines whether Jaeger is enabled or not.
+*/}}
+{{- define "policy-clamp-ac-a1pms-ppnt.jaeger-enabled" }}
+  {{- $jaegerEnabled := "false" -}}
+  {{- if .Values.jaeger -}}
+    {{- if .Values.jaeger.enabled -}}
+        {{- $jaegerEnabled = .Values.jaeger.enabled -}}
+    {{- end -}}
+  {{- end -}}
+  {{- $jaegerEnabled -}}
+{{- end -}}
+
+{{/*
+This helper defines whether jaeger is using http or grpc protocol
+*/}}
+{{- define "policy-clamp-ac-a1pms-ppnt.jaeger-protocol" }}
+  {{- $protocol := "grpc" -}}
+  {{- if eq .Values.jaeger.collector.protocol "http" -}}
+      {{- $protocol = "http/protobuf" -}}
+  {{- end -}}
+  {{- $protocol -}}
+{{- end -}}
\ No newline at end of file
index 619906a..f8bd6c1 100755 (executable)
@@ -1,6 +1,6 @@
 {{/*
 #  ============LICENSE_START=======================================================
-#   Copyright (C) 2023 Nordix Foundation. All rights reserved.
+#   Copyright (C) 2023-2024 Nordix Foundation. All rights reserved.
 #  ================================================================================
 #  Licensed under the Apache License, Version 2.0 (the "License");
 #  you may not use this file except in compliance with the License.
@@ -28,4 +28,4 @@ metadata:
     chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
     heritage: Helm
 data:
-{{ tpl (.Files.Glob "resources/config/*.{xml,yaml}").AsConfig . | indent 2 }}
\ No newline at end of file
+{{ tpl (.Files.Glob "resources/config/*.{xml,yaml,sh}").AsConfig . | indent 2 }}
\ No newline at end of file
index e68d655..bec288f 100755 (executable)
@@ -1,6 +1,6 @@
 {{/*
 #  ============LICENSE_START=======================================================
-#   Copyright (C) 2023 Nordix Foundation.
+#   Copyright (C) 2023-2024 Nordix Foundation.
 #  ================================================================================
 #  Licensed under the Apache License, Version 2.0 (the "License");
 #  you may not use this file except in compliance with the License.
@@ -77,6 +77,18 @@ spec:
           imagePullPolicy: {{ .Values.global.pullPolicy }}
           command: ["/opt/app/policy/clamp/bin/a1pms-participant.sh"]
           args: ["/opt/app/policy/clamp/etc/mounted/A1pmsParticipantParameters.yaml"]
+          {{- $jaegerEnabled := tpl "policy-clamp-ac-a1pms-ppnt.jaeger-enabled" . | trimSuffix "\n" -}}
+          {{- if $jaegerEnabled }}
+          env:
+            - name: OTEL_SERVICE_NAME
+              value: {{ .Values.applicationName }}
+            - name: OTEL_EXPORTER_OTLP_PROTOCOL
+              value: {{ include "policy-clamp-ac-a1pms-ppnt.jaeger-protocol" . }}
+            - name: OTEL_EXPORTER_OTLP_TRACES_PROTOCOL
+              value: {{ include "policy-clamp-ac-a1pms-ppnt.jaeger-protocol" . }}
+            - name: OTEL_EXPORTER_OTLP_ENDPOINT
+              value: {{ printf "%s:%s" (.Values.jaeger.collector.host) (include "policy-clamp-ac-a1pms-ppnt.exporter-port" .) }}
+          {{- end }}
           ports:
             - containerPort: 8086
               name: a1pms-api
@@ -100,6 +112,9 @@ spec:
             readOnly: true
           - mountPath: /opt/app/policy/clamp/etc/mounted
             name: ac-a1pms-ppnt-config-processed
+          - mountPath: /opt/app/policy/clamp/bin/a1pms-participant.sh
+            name: ac-a1pms-ppnt-config
+            subPath: a1pms-participant.sh
           resources:
 {{ toYaml .Values.resources.small | indent 12 }}
         {{- if .Values.nodeSelector }}
index b700dd0..556fe6c 100755 (executable)
@@ -78,3 +78,20 @@ serviceAccount:
   nameOverride: policy-clamp-ac-a1pms-ppnt
   roles:
     - create
+
+jaeger:
+  service:
+    name: jaeger
+  enabled: true
+  sampling:
+    probability: "1.0"
+  producer:
+    type: B3,W3C,B3_MULTI
+  collector:
+    protocol: grpc
+    host: "http://jaeger"
+    portOtlpGrpc: 4317
+    portOtlpHttp: 4318
+    portJaegerGrpc: 14250
+
+applicationName: a1pms-ppnt
index 9bb0d0e..160144a 100644 (file)
@@ -17,6 +17,8 @@
 #  ============LICENSE_END=========================================================
 
 spring:
+  application:
+    name: {{ .Values.applicationName }}
   autoconfigure:
     exclude: >
       org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration,
@@ -46,6 +48,7 @@ participant:
           topicCommInfrastructure: kafka
           fetchTimeout: 15000
           useHttps: false
+          allowTracing: {{ include "policy-clamp-ac-http-ppnt.jaeger-enabled" . }}
           additionalProps:
             group.id: policy-clamp-ac-http-ppnt
         - topic: ${participant.intermediaryParameters.topics.syncTopic}
@@ -54,18 +57,25 @@ participant:
           topicCommInfrastructure: kafka
           fetchTimeout: 15000
           useHttps: false
+          allowTracing: {{ include "policy-clamp-ac-http-ppnt.jaeger-enabled" . }}
       topicSinks:
         - topic: ${participant.intermediaryParameters.topics.operationTopic}
           servers:
             - "{{ .Values.global.kafkaServer }}:9092"
           topicCommInfrastructure: kafka
           useHttps: false
+          allowTracing: {{ include "policy-clamp-ac-http-ppnt.jaeger-enabled" . }}
     participantSupportedElementTypes:
       -
         typeName: org.onap.policy.clamp.acm.HttpAutomationCompositionElement
         typeVersion: 1.0.0
 
 management:
+  tracing:
+    propagation:
+      produce: [{{ .Values.jaeger.producer.type }}]
+    sampling:
+      probability: {{ .Values.jaeger.sampling.probability }}
   endpoints:
     web:
       base-path: /
@@ -78,3 +88,12 @@ server:
   ssl:
     enabled: false
 
+
+tracing:
+  enabled: {{ .Values.jaeger.enabled }}
+  exporter:
+    endpoint: {{ .Values.jaeger.collector.host }}:{{ include "policy-clamp-ac-http-ppnt.exporter-port" . }}
+    protocol: {{ .Values.jaeger.collector.protocol }}
+  sampler:
+    jaeger-remote:
+      endpoint: {{ .Values.jaeger.collector.host }}:{{ .Values.jaeger.collector.portJaegerGrpc }}
\ No newline at end of file
diff --git a/helm/policy/components/policy-clamp-ac-http-ppnt/resources/config/http-participant.sh b/helm/policy/components/policy-clamp-ac-http-ppnt/resources/config/http-participant.sh
new file mode 100755 (executable)
index 0000000..e35fb86
--- /dev/null
@@ -0,0 +1,60 @@
+#!/usr/bin/env sh
+#
+# ============LICENSE_START=======================================================
+#  Copyright (C) 2024 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.
+#
+# SPDX-License-Identifier: Apache-2.0
+# ============LICENSE_END=========================================================
+#
+
+KEYSTORE="${KEYSTORE:-$POLICY_HOME/etc/ssl/policy-keystore}"
+TRUSTSTORE="${TRUSTSTORE:-$POLICY_HOME/etc/ssl/policy-truststore}"
+KEYSTORE_PASSWD="${KEYSTORE_PASSWD:-Pol1cy_0nap}"
+TRUSTSTORE_PASSWD="${TRUSTSTORE_PASSWD:-Pol1cy_0nap}"
+
+if [ "$#" -eq 1 ]; then
+    CONFIG_FILE=$1
+fi
+
+if [ -z "$CONFIG_FILE" ]; then
+    CONFIG_FILE="${POLICY_HOME}/etc/HttpParticipantParameters.yaml"
+fi
+
+echo "Policy clamp HTTP participant config file: $CONFIG_FILE"
+
+if [ -f "${POLICY_HOME}/etc/mounted/policy-truststore" ]; then
+    echo "overriding policy-truststore"
+    cp -f "${POLICY_HOME}"/etc/mounted/policy-truststore "${TRUSTSTORE}"
+fi
+
+if [ -f "${POLICY_HOME}/etc/mounted/policy-keystore" ]; then
+    echo "overriding policy-keystore"
+    cp -f "${POLICY_HOME}"/etc/mounted/policy-keystore "${KEYSTORE}"
+fi
+
+if [ -f "${POLICY_HOME}/etc/mounted/logback.xml" ]; then
+    echo "overriding logback xml file"
+    cp -f "${POLICY_HOME}"/etc/mounted/logback.xml "${POLICY_HOME}"/etc/
+fi
+
+$JAVA_HOME/bin/java \
+    -Dlogging.config="${POLICY_HOME}/etc/logback.xml" \
+    -Dserver.ssl.keyStore="${KEYSTORE}" \
+    -Dserver.ssl.keyStorePassword="${KEYSTORE_PASSWD}" \
+    -Djavax.net.ssl.trustStore="${TRUSTSTORE}" \
+    -Djavax.net.ssl.trustStorePassword="${TRUSTSTORE_PASSWD}" \
+    -Dotel.java.global-autoconfigure.enabled=true \
+    -jar /app/app.jar \
+    --spring.config.location="${CONFIG_FILE}"
diff --git a/helm/policy/components/policy-clamp-ac-http-ppnt/templates/_helpers.tpl b/helm/policy/components/policy-clamp-ac-http-ppnt/templates/_helpers.tpl
new file mode 100644 (file)
index 0000000..7aed996
--- /dev/null
@@ -0,0 +1,58 @@
+{{/*
+#
+# ============LICENSE_START=======================================================
+#  Copyright (C) 2024 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.
+#
+# SPDX-License-Identifier: Apache-2.0
+# ============LICENSE_END=========================================================
+#
+*/}}
+
+{{/*
+This helper defines which exporter port must be used depending on protocol
+*/}}
+{{- define "policy-clamp-ac-http-ppnt.exporter-port" }}
+  {{- $jaegerExporterPort := .Values.jaeger.collector.portOtlpGrpc -}}
+    {{- if .Values.jaeger.collector.protocol -}}
+      {{- if eq .Values.jaeger.collector.protocol "http" -}}
+        {{- $jaegerExporterPort = .Values.jaeger.collector.portOtlpHttp -}}
+      {{- end -}}
+    {{- end -}}
+  {{- $jaegerExporterPort -}}
+{{- end -}}
+
+{{/*
+This helper defines whether Jaeger is enabled or not.
+*/}}
+{{- define "policy-clamp-ac-http-ppnt.jaeger-enabled" }}
+  {{- $jaegerEnabled := "false" -}}
+  {{- if .Values.jaeger -}}
+    {{- if .Values.jaeger.enabled -}}
+        {{- $jaegerEnabled = .Values.jaeger.enabled -}}
+    {{- end -}}
+  {{- end -}}
+  {{- $jaegerEnabled -}}
+{{- end -}}
+
+{{/*
+This helper defines whether jaeger is using http or grpc protocol
+*/}}
+{{- define "policy-clamp-ac-http-ppnt.jaeger-protocol" }}
+  {{- $protocol := "grpc" -}}
+  {{- if eq .Values.jaeger.collector.protocol "http" -}}
+      {{- $protocol = "http/protobuf" -}}
+  {{- end -}}
+  {{- $protocol -}}
+{{- end -}}
\ No newline at end of file
index 0b755aa..380833c 100644 (file)
@@ -1,6 +1,6 @@
 {{/*
 #  ============LICENSE_START=======================================================
-#   Copyright (C) 2023 Nordix Foundation. All rights reserved.
+#   Copyright (C) 2023-2024 Nordix Foundation. All rights reserved.
 #  ================================================================================
 #  Licensed under the Apache License, Version 2.0 (the "License");
 #  you may not use this file except in compliance with the License.
@@ -29,4 +29,4 @@ metadata:
     release: release
     heritage: Helm
 data:
-{{ tpl (.Files.Glob "resources/config/*.{xml,yaml}").AsConfig . | indent 2 }}
+{{ tpl (.Files.Glob "resources/config/*.{xml,yaml,sh}").AsConfig . | indent 2 }}
index ecdaa03..1cb3e9e 100644 (file)
@@ -1,6 +1,6 @@
 {{/*
 #  ============LICENSE_START=======================================================
-#   Copyright (C) 2023 Nordix Foundation.
+#   Copyright (C) 2023-2024 Nordix Foundation.
 #  ================================================================================
 #  Licensed under the Apache License, Version 2.0 (the "License");
 #  you may not use this file except in compliance with the License.
@@ -75,6 +75,18 @@ spec:
           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
           command: ["/opt/app/policy/clamp/bin/http-participant.sh"]
           args: ["/opt/app/policy/clamp/etc/mounted/HttpParticipantParameters.yaml"]
+          {{- $jaegerEnabled := tpl "policy-clamp-ac-http-ppnt.jaeger-enabled" . | trimSuffix "\n" -}}
+          {{- if $jaegerEnabled }}
+          env:
+            - name: OTEL_SERVICE_NAME
+              value: {{ .Values.applicationName }}
+            - name: OTEL_EXPORTER_OTLP_PROTOCOL
+              value: {{ include "policy-clamp-ac-http-ppnt.jaeger-protocol" . }}
+            - name: OTEL_EXPORTER_OTLP_TRACES_PROTOCOL
+              value: {{ include "policy-clamp-ac-http-ppnt.jaeger-protocol" . }}
+            - name: OTEL_EXPORTER_OTLP_ENDPOINT
+              value: {{ printf "%s:%s" (.Values.jaeger.collector.host) (include "policy-clamp-ac-http-ppnt.exporter-port" .) }}
+          {{- end }}
           ports:
             - containerPort: 8084
               name: http-api
@@ -98,6 +110,9 @@ spec:
             readOnly: true
           - mountPath: /opt/app/policy/clamp/etc/mounted
             name: ac-http-ppnt-config-processed
+          - mountPath: /opt/app/policy/clamp/bin/http-participant.sh
+            name: ac-http-ppnt-config
+            subPath: http-participant.sh
           resources:
 {{ toYaml .Values.resources.small | indent 12 }}
         {{- if .Values.nodeSelector }}
index a4f05ea..82686b5 100644 (file)
@@ -88,3 +88,20 @@ serviceAccount:
   roles:
     - read
 
+
+jaeger:
+  service:
+    name: jaeger
+  enabled: true
+  sampling:
+    probability: "1.0"
+  producer:
+    type: B3,W3C,B3_MULTI
+  collector:
+    protocol: grpc
+    host: "http://jaeger"
+    portOtlpGrpc: 4317
+    portOtlpHttp: 4318
+    portJaegerGrpc: 14250
+
+applicationName: http-ppnt
\ No newline at end of file
index bd52654..4eedc0d 100644 (file)
@@ -17,6 +17,8 @@
 #  ============LICENSE_END=========================================================
 
 spring:
+  application:
+    name: k8s-ppnt
   autoconfigure:
     exclude: >
       org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration,
@@ -49,6 +51,7 @@ participant:
           topicCommInfrastructure: kafka
           fetchTimeout: 15000
           useHttps: false
+          allowTracing: {{ include "policy-clamp-ac-k8s-ppnt.jaeger-enabled" . }}
           additionalProps:
             group.id: policy-clamp-ac-k8s-ppnt
         -
@@ -58,6 +61,7 @@ participant:
           topicCommInfrastructure: kafka
           fetchTimeout: 15000
           useHttps: false
+          allowTracing: {{ include "policy-clamp-ac-k8s-ppnt.jaeger-enabled" . }}
       topicSinks:
         -
           topic: ${participant.intermediaryParameters.topics.operationTopic}
@@ -65,12 +69,18 @@ participant:
             - "{{ .Values.global.kafkaServer }}:9092"
           topicCommInfrastructure: kafka
           useHttps: false
+          allowTracing: {{ include "policy-clamp-ac-k8s-ppnt.jaeger-enabled" . }}
     participantSupportedElementTypes:
       -
         typeName: org.onap.policy.clamp.acm.K8SMicroserviceAutomationCompositionElement
         typeVersion: 1.0.0
 
 management:
+  tracing:
+    propagation:
+      produce: [{{ .Values.jaeger.producer.type }}]
+    sampling:
+      probability: {{ .Values.jaeger.sampling.probability }}
   endpoints:
     web:
       base-path: /
@@ -104,3 +114,13 @@ chart:
     enabled: false
 
 # Permitted list of helm repositories. Values are updated from values.yaml
+
+
+tracing:
+  enabled: {{ .Values.jaeger.enabled }}
+  exporter:
+    endpoint: {{ .Values.jaeger.collector.host }}:{{ include "policy-clamp-ac-k8s-ppnt.exporter-port" . }}
+    protocol: {{ .Values.jaeger.collector.protocol }}
+  sampler:
+    jaeger-remote:
+      endpoint: {{ .Values.jaeger.collector.host }}:{{ .Values.jaeger.collector.portJaegerGrpc }}
\ No newline at end of file
diff --git a/helm/policy/components/policy-clamp-ac-k8s-ppnt/resources/config/kubernetes-participant.sh b/helm/policy/components/policy-clamp-ac-k8s-ppnt/resources/config/kubernetes-participant.sh
new file mode 100755 (executable)
index 0000000..ce08684
--- /dev/null
@@ -0,0 +1,60 @@
+#!/usr/bin/env sh
+#
+# ============LICENSE_START=======================================================
+#  Copyright (C) 2024 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.
+#
+# SPDX-License-Identifier: Apache-2.0
+# ============LICENSE_END=========================================================
+#
+
+KEYSTORE="${KEYSTORE:-$POLICY_HOME/etc/ssl/policy-keystore}"
+TRUSTSTORE="${TRUSTSTORE:-$POLICY_HOME/etc/ssl/policy-truststore}"
+KEYSTORE_PASSWD="${KEYSTORE_PASSWD:-Pol1cy_0nap}"
+TRUSTSTORE_PASSWD="${TRUSTSTORE_PASSWD:-Pol1cy_0nap}"
+
+if [ "$#" -eq 1 ]; then
+    CONFIG_FILE=$1
+fi
+
+if [ -z "$CONFIG_FILE" ]; then
+    CONFIG_FILE="${POLICY_HOME}/etc/KubernetesParticipantParameters.yaml"
+fi
+
+echo "Policy clamp Kubernetes participant config file: $CONFIG_FILE"
+
+if [ -f "${POLICY_HOME}/etc/mounted/policy-truststore" ]; then
+    echo "overriding policy-truststore"
+    cp -f "${POLICY_HOME}"/etc/mounted/policy-truststore "${TRUSTSTORE}"
+fi
+
+if [ -f "${POLICY_HOME}/etc/mounted/policy-keystore" ]; then
+    echo "overriding policy-keystore"
+    cp -f "${POLICY_HOME}"/etc/mounted/policy-keystore "${KEYSTORE}"
+fi
+
+if [ -f "${POLICY_HOME}/etc/mounted/logback.xml" ]; then
+    echo "overriding logback xml file"
+    cp -f "${POLICY_HOME}"/etc/mounted/logback.xml "${POLICY_HOME}"/etc/
+fi
+
+$JAVA_HOME/bin/java \
+    -Dlogging.config="${POLICY_HOME}/etc/logback.xml" \
+    -Dserver.ssl.keyStore="${KEYSTORE}" \
+    -Dserver.ssl.keyStorePassword="${KEYSTORE_PASSWD}" \
+    -Djavax.net.ssl.trustStore="${TRUSTSTORE}" \
+    -Djavax.net.ssl.trustStorePassword="${TRUSTSTORE_PASSWD}" \
+    -Dotel.java.global-autoconfigure.enabled=true \
+    -jar /app/app.jar \
+    --spring.config.location="${CONFIG_FILE}"
diff --git a/helm/policy/components/policy-clamp-ac-k8s-ppnt/templates/_helpers.tpl b/helm/policy/components/policy-clamp-ac-k8s-ppnt/templates/_helpers.tpl
new file mode 100644 (file)
index 0000000..83b494f
--- /dev/null
@@ -0,0 +1,58 @@
+{{/*
+#
+# ============LICENSE_START=======================================================
+#  Copyright (C) 2024 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.
+#
+# SPDX-License-Identifier: Apache-2.0
+# ============LICENSE_END=========================================================
+#
+*/}}
+
+{{/*
+This helper defines which exporter port must be used depending on protocol
+*/}}
+{{- define "policy-clamp-ac-k8s-ppnt.exporter-port" }}
+  {{- $jaegerExporterPort := .Values.jaeger.collector.portOtlpGrpc -}}
+    {{- if .Values.jaeger.collector.protocol -}}
+      {{- if eq .Values.jaeger.collector.protocol "http" -}}
+        {{- $jaegerExporterPort = .Values.jaeger.collector.portOtlpHttp -}}
+      {{- end -}}
+    {{- end -}}
+  {{- $jaegerExporterPort -}}
+{{- end -}}
+
+{{/*
+This helper defines whether Jaeger is enabled or not.
+*/}}
+{{- define "policy-clamp-ac-k8s-ppnt.jaeger-enabled" }}
+  {{- $jaegerEnabled := "false" -}}
+  {{- if .Values.jaeger -}}
+    {{- if .Values.jaeger.enabled -}}
+        {{- $jaegerEnabled = .Values.jaeger.enabled -}}
+    {{- end -}}
+  {{- end -}}
+  {{- $jaegerEnabled -}}
+{{- end -}}
+
+{{/*
+This helper defines whether jaeger is using http or grpc protocol
+*/}}
+{{- define "policy-clamp-ac-k8s-ppnt.jaeger-protocol" }}
+  {{- $protocol := "grpc" -}}
+  {{- if eq .Values.jaeger.collector.protocol "http" -}}
+      {{- $protocol = "http/protobuf" -}}
+  {{- end -}}
+  {{- $protocol -}}
+{{- end -}}
\ No newline at end of file
index fa90535..e0f7a52 100644 (file)
@@ -1,6 +1,6 @@
 {{/*
 #  ============LICENSE_START=======================================================
-#   Copyright (C) 2022 Nordix Foundation.
+#   Copyright (C) 2022-2024 Nordix Foundation.
 #  ================================================================================
 #  Licensed under the Apache License, Version 2.0 (the "License");
 #  you may not use this file except in compliance with the License.
@@ -78,6 +78,18 @@ spec:
           imagePullPolicy: {{ .Values.global.pullPolicy }}
           command: ["/opt/app/policy/clamp/bin/kubernetes-participant.sh"]
           args: ["/opt/app/policy/clamp/etc/mounted/KubernetesParticipantParameters.yaml"]
+          {{- $jaegerEnabled := tpl "policy-clamp-ac-k8s-ppnt.jaeger-enabled" . | trimSuffix "\n" -}}
+          {{- if $jaegerEnabled }}
+          env:
+            - name: OTEL_SERVICE_NAME
+              value: {{ .Values.applicationName }}
+            - name: OTEL_EXPORTER_OTLP_PROTOCOL
+              value: {{ include "policy-clamp-ac-k8s-ppnt.jaeger-protocol" . }}
+            - name: OTEL_EXPORTER_OTLP_TRACES_PROTOCOL
+              value: {{ include "policy-clamp-ac-k8s-ppnt.jaeger-protocol" . }}
+            - name: OTEL_EXPORTER_OTLP_ENDPOINT
+              value: {{ printf "%s:%s" (.Values.jaeger.collector.host) (include "policy-clamp-ac-k8s-ppnt.exporter-port" .) }}
+          {{- end }}
           ports:
             - containerPort: 8083
               name: http-api
@@ -101,6 +113,9 @@ spec:
             readOnly: true
           - mountPath: /opt/app/policy/clamp/etc/mounted
             name: ac-k8s-ppnt-config-processed
+          - mountPath: /opt/app/policy/clamp/bin/kubernetes-participant.sh
+            name: ac-k8s-ppnt-config
+            subPath: kubernetes-participant.sh
           resources:
 {{ toYaml .Values.resources.small | indent 12 }}
         {{- if .Values.nodeSelector }}
index 934b1bb..dfbda30 100644 (file)
@@ -98,3 +98,20 @@ repoList:
     protocols:
       - http
       - https
+
+jaeger:
+  service:
+    name: jaeger
+  enabled: true
+  sampling:
+    probability: "1.0"
+  producer:
+    type: B3,W3C,B3_MULTI
+  collector:
+    protocol: grpc
+    host: "http://jaeger"
+    portOtlpGrpc: 4317
+    portOtlpHttp: 4318
+    portJaegerGrpc: 14250
+
+applicationName: k8s-ppnt
\ No newline at end of file
index 6e854c9..3b71737 100755 (executable)
@@ -16,6 +16,8 @@
 #  ============LICENSE_END=========================================================
 
 spring:
+  application:
+    name: kserve-ppnt
   cloud:
     kubernetes:
       enabled: false
@@ -52,18 +54,21 @@ participant:
             - "{{ .Values.global.kafkaServer }}:9092"
           topicCommInfrastructure: kafka
           fetchTimeout: 15000
+          allowTracing: {{ include "policy-clamp-ac-kserve-ppnt.jaeger-enabled" . }}
           additionalProps:
             group.id: policy-clamp-ac-kserve-ppnt
         - topic: ${participant.intermediaryParameters.topics.syncTopic}
           servers:
             - "{{ .Values.global.kafkaServer }}:9092"
           topicCommInfrastructure: kafka
+          allowTracing: {{ include "policy-clamp-ac-kserve-ppnt.jaeger-enabled" . }}
           fetchTimeout: 15000
       topicSinks:
         - topic: ${participant.intermediaryParameters.topics.operationTopic}
           servers:
             - "{{ .Values.global.kafkaServer }}:9092"
           topicCommInfrastructure: kafka
+          allowTracing: {{ include "policy-clamp-ac-kserve-ppnt.jaeger-enabled" . }}
     participantSupportedElementTypes:
       -
         typeName: org.onap.policy.clamp.acm.KserveAutomationCompositionElement
@@ -76,6 +81,11 @@ customresourcedefinition:
   grace-period: 10
 
 management:
+  tracing:
+    propagation:
+      produce: [{{ .Values.jaeger.producer.type }}]
+    sampling:
+      probability: {{ .Values.jaeger.sampling.probability }}
   endpoints:
     web:
       base-path: /
@@ -89,3 +99,11 @@ server:
     enabled: false
 
 
+tracing:
+  enabled: {{ .Values.jaeger.enabled }}
+  exporter:
+    endpoint: {{ .Values.jaeger.collector.host }}:{{ include "policy-clamp-ac-kserve-ppnt.exporter-port" . }}
+    protocol: {{ .Values.jaeger.collector.protocol }}
+  sampler:
+    jaeger-remote:
+      endpoint: {{ .Values.jaeger.collector.host }}:{{ .Values.jaeger.collector.portJaegerGrpc }}
diff --git a/helm/policy/components/policy-clamp-ac-kserve-ppnt/resources/config/kserve-participant.sh b/helm/policy/components/policy-clamp-ac-kserve-ppnt/resources/config/kserve-participant.sh
new file mode 100644 (file)
index 0000000..7da0b0f
--- /dev/null
@@ -0,0 +1,60 @@
+#!/usr/bin/env sh
+#
+# ============LICENSE_START=======================================================
+#  Copyright (C) 2024 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.
+#
+# SPDX-License-Identifier: Apache-2.0
+# ============LICENSE_END=========================================================
+#
+
+KEYSTORE="${KEYSTORE:-$POLICY_HOME/etc/ssl/policy-keystore}"
+TRUSTSTORE="${TRUSTSTORE:-$POLICY_HOME/etc/ssl/policy-truststore}"
+KEYSTORE_PASSWD="${KEYSTORE_PASSWD:-Pol1cy_0nap}"
+TRUSTSTORE_PASSWD="${TRUSTSTORE_PASSWD:-Pol1cy_0nap}"
+
+if [ "$#" -eq 1 ]; then
+    CONFIG_FILE=$1
+fi
+
+if [ -z "$CONFIG_FILE" ]; then
+    CONFIG_FILE="${POLICY_HOME}/etc/KserveParticipantParameters.yaml"
+fi
+
+echo "Policy clamp Kserve participant config file: $CONFIG_FILE"
+
+if [ -f "${POLICY_HOME}/etc/mounted/policy-truststore" ]; then
+    echo "overriding policy-truststore"
+    cp -f "${POLICY_HOME}"/etc/mounted/policy-truststore "${TRUSTSTORE}"
+fi
+
+if [ -f "${POLICY_HOME}/etc/mounted/policy-keystore" ]; then
+    echo "overriding policy-keystore"
+    cp -f "${POLICY_HOME}"/etc/mounted/policy-keystore "${KEYSTORE}"
+fi
+
+if [ -f "${POLICY_HOME}/etc/mounted/logback.xml" ]; then
+    echo "overriding logback xml file"
+    cp -f "${POLICY_HOME}"/etc/mounted/logback.xml "${POLICY_HOME}"/etc/
+fi
+
+$JAVA_HOME/bin/java \
+    -Dlogging.config="${POLICY_HOME}/etc/logback.xml" \
+    -Dserver.ssl.keyStore="${KEYSTORE}" \
+    -Dserver.ssl.keyStorePassword="${KEYSTORE_PASSWD}" \
+    -Djavax.net.ssl.trustStore="${TRUSTSTORE}" \
+    -Djavax.net.ssl.trustStorePassword="${TRUSTSTORE_PASSWD}" \
+    -Dotel.java.global-autoconfigure.enabled=true \
+    -jar /app/app.jar \
+    --spring.config.location="${CONFIG_FILE}"
diff --git a/helm/policy/components/policy-clamp-ac-kserve-ppnt/templates/_helpers.tpl b/helm/policy/components/policy-clamp-ac-kserve-ppnt/templates/_helpers.tpl
new file mode 100644 (file)
index 0000000..a288287
--- /dev/null
@@ -0,0 +1,58 @@
+{{/*
+#
+# ============LICENSE_START=======================================================
+#  Copyright (C) 2024 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.
+#
+# SPDX-License-Identifier: Apache-2.0
+# ============LICENSE_END=========================================================
+#
+*/}}
+
+{{/*
+This helper defines which exporter port must be used depending on protocol
+*/}}
+{{- define "policy-clamp-ac-kserve-ppnt.exporter-port" }}
+  {{- $jaegerExporterPort := .Values.jaeger.collector.portOtlpGrpc -}}
+    {{- if .Values.jaeger.collector.protocol -}}
+      {{- if eq .Values.jaeger.collector.protocol "http" -}}
+        {{- $jaegerExporterPort = .Values.jaeger.collector.portOtlpHttp -}}
+      {{- end -}}
+    {{- end -}}
+  {{- $jaegerExporterPort -}}
+{{- end -}}
+
+{{/*
+This helper defines whether Jaeger is enabled or not.
+*/}}
+{{- define "policy-clamp-ac-kserve-ppnt.jaeger-enabled" }}
+  {{- $jaegerEnabled := "false" -}}
+  {{- if .Values.jaeger -}}
+    {{- if .Values.jaeger.enabled -}}
+        {{- $jaegerEnabled = .Values.jaeger.enabled -}}
+    {{- end -}}
+  {{- end -}}
+  {{- $jaegerEnabled -}}
+{{- end -}}
+
+{{/*
+This helper defines whether jaeger is using http or grpc protocol
+*/}}
+{{- define "policy-clamp-ac-kserve-ppnt.jaeger-protocol" }}
+  {{- $protocol := "grpc" -}}
+  {{- if eq .Values.jaeger.collector.protocol "http" -}}
+      {{- $protocol = "http/protobuf" -}}
+  {{- end -}}
+  {{- $protocol -}}
+{{- end -}}
\ No newline at end of file
index 619906a..f8bd6c1 100755 (executable)
@@ -1,6 +1,6 @@
 {{/*
 #  ============LICENSE_START=======================================================
-#   Copyright (C) 2023 Nordix Foundation. All rights reserved.
+#   Copyright (C) 2023-2024 Nordix Foundation. All rights reserved.
 #  ================================================================================
 #  Licensed under the Apache License, Version 2.0 (the "License");
 #  you may not use this file except in compliance with the License.
@@ -28,4 +28,4 @@ metadata:
     chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
     heritage: Helm
 data:
-{{ tpl (.Files.Glob "resources/config/*.{xml,yaml}").AsConfig . | indent 2 }}
\ No newline at end of file
+{{ tpl (.Files.Glob "resources/config/*.{xml,yaml,sh}").AsConfig . | indent 2 }}
\ No newline at end of file
index 60d5032..f8f5328 100755 (executable)
@@ -1,6 +1,6 @@
 {{/*
 #  ============LICENSE_START=======================================================
-#   Copyright (C) 2023 Nordix Foundation.
+#   Copyright (C) 2023-2024 Nordix Foundation.
 #  ================================================================================
 #  Licensed under the Apache License, Version 2.0 (the "License");
 #  you may not use this file except in compliance with the License.
@@ -77,6 +77,18 @@ spec:
           imagePullPolicy: {{ .Values.global.pullPolicy }}
           command: ["/opt/app/policy/clamp/bin/kserve-participant.sh"]
           args: ["/opt/app/policy/clamp/etc/mounted/KserveParticipantParameters.yaml"]
+          {{- $jaegerEnabled := tpl "policy-clamp-ac-kserve-ppnt.jaeger-enabled" . | trimSuffix "\n" -}}
+          {{- if $jaegerEnabled }}
+          env:
+            - name: OTEL_SERVICE_NAME
+              value: {{ .Values.applicationName }}
+            - name: OTEL_EXPORTER_OTLP_PROTOCOL
+              value: {{ include "policy-clamp-ac-kserve-ppnt.jaeger-protocol" . }}
+            - name: OTEL_EXPORTER_OTLP_TRACES_PROTOCOL
+              value: {{ include "policy-clamp-ac-kserve-ppnt.jaeger-protocol" . }}
+            - name: OTEL_EXPORTER_OTLP_ENDPOINT
+              value: {{ printf "%s:%s" (.Values.jaeger.collector.host) (include "policy-clamp-ac-kserve-ppnt.exporter-port" .) }}
+          {{- end }}
           ports:
             - containerPort: 8087
               name: kserve-api
@@ -100,6 +112,9 @@ spec:
             readOnly: true
           - mountPath: /opt/app/policy/clamp/etc/mounted
             name: ac-kserve-ppnt-config-processed
+          - mountPath: /opt/app/policy/clamp/bin/kserve-participant.sh
+            name: ac-kserve-ppnt-config
+            subPath: kserve-participant.sh
           resources:
 {{ toYaml .Values.resources.small | indent 12 }}
         {{- if .Values.nodeSelector }}
index 444c5bf..0f354ed 100755 (executable)
@@ -78,3 +78,20 @@ serviceAccount:
   nameOverride: policy-clamp-ac-kserve-ppnt
   roles:
     - create
+
+jaeger:
+  service:
+    name: jaeger
+  enabled: true
+  sampling:
+    probability: "1.0"
+  producer:
+    type: B3,W3C,B3_MULTI
+  collector:
+    protocol: grpc
+    host: "http://jaeger"
+    portOtlpGrpc: 4317
+    portOtlpHttp: 4318
+    portJaegerGrpc: 14250
+
+applicationName: kserve-ppnt
\ No newline at end of file
index f7308e6..5753fe8 100644 (file)
@@ -17,6 +17,8 @@
 #  ============LICENSE_END=========================================================
 
 spring:
+  application:
+    name: pf-ppnt
   autoconfigure:
     exclude: >
       org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration,
@@ -65,6 +67,7 @@ participant:
           topicCommInfrastructure: kafka
           fetchTimeout: 15000
           useHttps: false
+          allowTracing: {{ include "policy-clamp-ac-pf-ppnt.jaeger-enabled" . }}
           additionalProps:
             group.id: policy-clamp-ac-pf-ppnt
         -
@@ -74,6 +77,7 @@ participant:
           topicCommInfrastructure: kafka
           fetchTimeout: 15000
           useHttps: false
+          allowTracing: {{ include "policy-clamp-ac-pf-ppnt.jaeger-enabled" . }}
       topicSinks:
         -
           topic: ${participant.intermediaryParameters.topics.operationTopic}
@@ -81,12 +85,18 @@ participant:
             - "{{ .Values.global.kafkaServer }}:9092"
           topicCommInfrastructure: kafka
           useHttps: false
+          allowTracing: {{ include "policy-clamp-ac-pf-ppnt.jaeger-enabled" . }}
     participantSupportedElementTypes:
       -
         typeName: org.onap.policy.clamp.acm.PolicyAutomationCompositionElement
         typeVersion: 1.0.0
 
 management:
+  tracing:
+    propagation:
+      produce: [{{ .Values.jaeger.producer.type }}]
+    sampling:
+      probability: {{ .Values.jaeger.sampling.probability }}
   endpoints:
     web:
       base-path: /
@@ -99,3 +109,12 @@ server:
     context-path: /onap/policyparticipant
   ssl:
     enabled: false
+
+tracing:
+  enabled: {{ .Values.jaeger.enabled }}
+  exporter:
+    endpoint: {{ .Values.jaeger.collector.host }}:{{ include "policy-clamp-ac-pf-ppnt.exporter-port" . }}
+    protocol: {{ .Values.jaeger.collector.protocol }}
+  sampler:
+    jaeger-remote:
+      endpoint: {{ .Values.jaeger.collector.host }}:{{ .Values.jaeger.collector.portJaegerGrpc }}
\ No newline at end of file
diff --git a/helm/policy/components/policy-clamp-ac-pf-ppnt/resources/config/policy-participant.sh b/helm/policy/components/policy-clamp-ac-pf-ppnt/resources/config/policy-participant.sh
new file mode 100755 (executable)
index 0000000..f36c2b3
--- /dev/null
@@ -0,0 +1,60 @@
+#!/usr/bin/env sh
+#
+# ============LICENSE_START=======================================================
+#  Copyright (C) 2024 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.
+#
+# SPDX-License-Identifier: Apache-2.0
+# ============LICENSE_END=========================================================
+#
+
+KEYSTORE="${KEYSTORE:-$POLICY_HOME/etc/ssl/policy-keystore}"
+TRUSTSTORE="${TRUSTSTORE:-$POLICY_HOME/etc/ssl/policy-truststore}"
+KEYSTORE_PASSWD="${KEYSTORE_PASSWD:-Pol1cy_0nap}"
+TRUSTSTORE_PASSWD="${TRUSTSTORE_PASSWD:-Pol1cy_0nap}"
+
+if [ "$#" -eq 1 ]; then
+    CONFIG_FILE=$1
+fi
+
+if [ -z "$CONFIG_FILE" ]; then
+    CONFIG_FILE="${POLICY_HOME}/etc/PolicyParticipantParameters.yaml"
+fi
+
+echo "Policy clamp policy participant config file: $CONFIG_FILE"
+
+if [ -f "${POLICY_HOME}/etc/mounted/policy-truststore" ]; then
+    echo "overriding policy-truststore"
+    cp -f "${POLICY_HOME}"/etc/mounted/policy-truststore "${TRUSTSTORE}"
+fi
+
+if [ -f "${POLICY_HOME}/etc/mounted/policy-keystore" ]; then
+    echo "overriding policy-keystore"
+    cp -f "${POLICY_HOME}"/etc/mounted/policy-keystore "${KEYSTORE}"
+fi
+
+if [ -f "${POLICY_HOME}/etc/mounted/logback.xml" ]; then
+    echo "overriding logback xml file"
+    cp -f "${POLICY_HOME}"/etc/mounted/logback.xml "${POLICY_HOME}"/etc/
+fi
+
+$JAVA_HOME/bin/java \
+    -Dlogging.config="${POLICY_HOME}/etc/logback.xml" \
+    -Dserver.ssl.keyStore="${KEYSTORE}" \
+    -Dserver.ssl.keyStorePassword="${KEYSTORE_PASSWD}" \
+    -Djavax.net.ssl.trustStore="${TRUSTSTORE}" \
+    -Djavax.net.ssl.trustStorePassword="${TRUSTSTORE_PASSWD}" \
+    -Dotel.java.global-autoconfigure.enabled=true \
+    -jar /app/app.jar \
+    --spring.config.location="${CONFIG_FILE}"
diff --git a/helm/policy/components/policy-clamp-ac-pf-ppnt/templates/_helpers.tpl b/helm/policy/components/policy-clamp-ac-pf-ppnt/templates/_helpers.tpl
new file mode 100644 (file)
index 0000000..a5f3a1f
--- /dev/null
@@ -0,0 +1,58 @@
+{{/*
+#
+# ============LICENSE_START=======================================================
+#  Copyright (C) 2024 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.
+#
+# SPDX-License-Identifier: Apache-2.0
+# ============LICENSE_END=========================================================
+#
+*/}}
+
+{{/*
+This helper defines which exporter port must be used depending on protocol
+*/}}
+{{- define "policy-clamp-ac-pf-ppnt.exporter-port" }}
+  {{- $jaegerExporterPort := .Values.jaeger.collector.portOtlpGrpc -}}
+    {{- if .Values.jaeger.collector.protocol -}}
+      {{- if eq .Values.jaeger.collector.protocol "http" -}}
+        {{- $jaegerExporterPort = .Values.jaeger.collector.portOtlpHttp -}}
+      {{- end -}}
+    {{- end -}}
+  {{- $jaegerExporterPort -}}
+{{- end -}}
+
+{{/*
+This helper defines whether Jaeger is enabled or not.
+*/}}
+{{- define "policy-clamp-ac-pf-ppnt.jaeger-enabled" }}
+  {{- $jaegerEnabled := "false" -}}
+  {{- if .Values.jaeger -}}
+    {{- if .Values.jaeger.enabled -}}
+        {{- $jaegerEnabled = .Values.jaeger.enabled -}}
+    {{- end -}}
+  {{- end -}}
+  {{- $jaegerEnabled -}}
+{{- end -}}
+
+{{/*
+This helper defines whether jaeger is using http or grpc protocol
+*/}}
+{{- define "policy-clamp-ac-pf-ppnt.jaeger-protocol" }}
+  {{- $protocol := "grpc" -}}
+  {{- if eq .Values.jaeger.collector.protocol "http" -}}
+      {{- $protocol = "http/protobuf" -}}
+  {{- end -}}
+  {{- $protocol -}}
+{{- end -}}
\ No newline at end of file
index 1319768..2faeffc 100644 (file)
@@ -1,6 +1,6 @@
 {{/*
 #  ============LICENSE_START=======================================================
-#   Copyright (C) 2023 Nordix Foundation. All rights reserved.
+#   Copyright (C) 2023-2024 Nordix Foundation. All rights reserved.
 #  ================================================================================
 #  Licensed under the Apache License, Version 2.0 (the "License");
 #  you may not use this file except in compliance with the License.
@@ -29,4 +29,4 @@ metadata:
     release: RELEASE
     heritage: Helm
 data:
-{{ tpl (.Files.Glob "resources/config/*.{xml,yaml}").AsConfig . | indent 2 }}
+{{ tpl (.Files.Glob "resources/config/*.{xml,yaml,sh}").AsConfig . | indent 2 }}
index bcb3dae..7e921cb 100644 (file)
@@ -1,6 +1,6 @@
 {{/*
 #  ============LICENSE_START=======================================================
-#   Copyright (C) 2023 Nordix Foundation.
+#   Copyright (C) 2023-2024 Nordix Foundation.
 #  ================================================================================
 #  Licensed under the Apache License, Version 2.0 (the "License");
 #  you may not use this file except in compliance with the License.
@@ -95,6 +95,18 @@ spec:
           imagePullPolicy: {{ .Values.global.pullPolicy }}
           command: ["/opt/app/policy/clamp/bin/policy-participant.sh"]
           args: ["/opt/app/policy/clamp/etc/mounted/PolicyParticipantParameters.yaml"]
+          {{- $jaegerEnabled := tpl "policy-clamp-ac-pf-ppnt.jaeger-enabled" . | trimSuffix "\n" -}}
+          {{- if $jaegerEnabled }}
+          env:
+            - name: OTEL_SERVICE_NAME
+              value: {{ .Values.applicationName }}
+            - name: OTEL_EXPORTER_OTLP_PROTOCOL
+              value: {{ include "policy-clamp-ac-pf-ppnt.jaeger-protocol" . }}
+            - name: OTEL_EXPORTER_OTLP_TRACES_PROTOCOL
+              value: {{ include "policy-clamp-ac-pf-ppnt.jaeger-protocol" . }}
+            - name: OTEL_EXPORTER_OTLP_ENDPOINT
+              value: {{ printf "%s:%s" (.Values.jaeger.collector.host) (include "policy-clamp-ac-pf-ppnt.exporter-port" .) }}
+          {{- end }}
           ports:
             - containerPort: 6969
               name: http-api
@@ -118,6 +130,9 @@ spec:
             readOnly: true
           - mountPath: /opt/app/policy/clamp/etc/mounted
             name: ac-pf-ppnt-config-processed
+          - mountPath: /opt/app/policy/clamp/bin/policy-participant.sh
+            name: ac-pf-ppnt-config
+            subPath: policy-participant.sh
           resources:
 {{ toYaml .Values.resources.small | indent 12 }}
         {{- if .Values.nodeSelector }}
index af38e9c..314fc23 100644 (file)
@@ -94,3 +94,19 @@ serviceAccount:
   roles:
     - read
 
+jaeger:
+  service:
+    name: jaeger
+  enabled: true
+  sampling:
+    probability: "1.0"
+  producer:
+    type: B3,W3C,B3_MULTI
+  collector:
+    protocol: grpc
+    host: "http://jaeger"
+    portOtlpGrpc: 4317
+    portOtlpHttp: 4318
+    portJaegerGrpc: 14250
+
+applicationName: policy-ppnt
index 7f17820..f8932ec 100644 (file)
@@ -17,6 +17,8 @@
 #  ============LICENSE_END=========================================================
 
 spring:
+  application:
+    name: sim-ppnt
   autoconfigure:
     exclude:
       - org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration
@@ -47,6 +49,7 @@ participant:
           topicCommInfrastructure: kafka
           fetchTimeout: 15000
           useHttps: false
+          allowTracing: {{ include "policy-clamp-ac-sim-ppnt.jaeger-enabled" . }}
           additionalProps:
             group.id: policy-clamp-ac-sim-ppnt
         - topic: ${participant.intermediaryParameters.topics.syncTopic}
@@ -55,18 +58,25 @@ participant:
           topicCommInfrastructure: kafka
           fetchTimeout: 15000
           useHttps: false
+          allowTracing: {{ include "policy-clamp-ac-sim-ppnt.jaeger-enabled" . }}
       topicSinks:
         - topic: ${participant.intermediaryParameters.topics.operationTopic}
           servers:
             - "{{ .Values.global.kafkaServer }}:9092"
           topicCommInfrastructure: kafka
           useHttps: false
+          allowTracing: {{ include "policy-clamp-ac-sim-ppnt.jaeger-enabled" . }}
     participantSupportedElementTypes:
       -
         typeName: org.onap.policy.clamp.acm.SimAutomationCompositionElement
         typeVersion: 1.0.0
 
 management:
+  tracing:
+    propagation:
+      produce: [{{ .Values.jaeger.producer.type }}]
+    sampling:
+      probability: {{ .Values.jaeger.sampling.probability }}
   endpoints:
     web:
       base-path: /
@@ -78,3 +88,12 @@ server:
     context-path: /onap/policy/simparticipant
   ssl:
     enabled: false
+
+tracing:
+  enabled: {{ .Values.jaeger.enabled }}
+  exporter:
+    endpoint: {{ .Values.jaeger.collector.host }}:{{ include "policy-clamp-ac-sim-ppnt.exporter-port" . }}
+    protocol: {{ .Values.jaeger.collector.protocol }}
+  sampler:
+    jaeger-remote:
+      endpoint: {{ .Values.jaeger.collector.host }}:{{ .Values.jaeger.collector.portJaegerGrpc }}
\ No newline at end of file
diff --git a/helm/policy/components/policy-clamp-ac-sim-ppnt/resources/config/sim-participant.sh b/helm/policy/components/policy-clamp-ac-sim-ppnt/resources/config/sim-participant.sh
new file mode 100755 (executable)
index 0000000..556f4ef
--- /dev/null
@@ -0,0 +1,60 @@
+#!/usr/bin/env sh
+#
+# ============LICENSE_START=======================================================
+#  Copyright (C) 2024 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.
+#
+# SPDX-License-Identifier: Apache-2.0
+# ============LICENSE_END=========================================================
+#
+
+KEYSTORE="${KEYSTORE:-$POLICY_HOME/etc/ssl/policy-keystore}"
+TRUSTSTORE="${TRUSTSTORE:-$POLICY_HOME/etc/ssl/policy-truststore}"
+KEYSTORE_PASSWD="${KEYSTORE_PASSWD:-Pol1cy_0nap}"
+TRUSTSTORE_PASSWD="${TRUSTSTORE_PASSWD:-Pol1cy_0nap}"
+
+if [ "$#" -eq 1 ]; then
+    CONFIG_FILE=$1
+fi
+
+if [ -z "$CONFIG_FILE" ]; then
+    CONFIG_FILE="${POLICY_HOME}/etc/SimulatorParticipantParameters.yaml"
+fi
+
+echo "Policy clamp Simulator participant config file: $CONFIG_FILE"
+
+if [ -f "${POLICY_HOME}/etc/mounted/policy-truststore" ]; then
+    echo "overriding policy-truststore"
+    cp -f "${POLICY_HOME}"/etc/mounted/policy-truststore "${TRUSTSTORE}"
+fi
+
+if [ -f "${POLICY_HOME}/etc/mounted/policy-keystore" ]; then
+    echo "overriding policy-keystore"
+    cp -f "${POLICY_HOME}"/etc/mounted/policy-keystore "${KEYSTORE}"
+fi
+
+if [ -f "${POLICY_HOME}/etc/mounted/logback.xml" ]; then
+    echo "overriding logback xml file"
+    cp -f "${POLICY_HOME}"/etc/mounted/logback.xml "${POLICY_HOME}"/etc/
+fi
+
+$JAVA_HOME/bin/java \
+    -Dlogging.config="${POLICY_HOME}/etc/logback.xml" \
+    -Dserver.ssl.keyStore="${KEYSTORE}" \
+    -Dserver.ssl.keyStorePassword="${KEYSTORE_PASSWD}" \
+    -Djavax.net.ssl.trustStore="${TRUSTSTORE}" \
+    -Djavax.net.ssl.trustStorePassword="${TRUSTSTORE_PASSWD}" \
+    -Dotel.java.global-autoconfigure.enabled=true \
+    -jar /app/app.jar \
+    --spring.config.location="${CONFIG_FILE}"
diff --git a/helm/policy/components/policy-clamp-ac-sim-ppnt/templates/_helpers.tpl b/helm/policy/components/policy-clamp-ac-sim-ppnt/templates/_helpers.tpl
new file mode 100644 (file)
index 0000000..5f19df8
--- /dev/null
@@ -0,0 +1,58 @@
+{{/*
+#
+# ============LICENSE_START=======================================================
+#  Copyright (C) 2024 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.
+#
+# SPDX-License-Identifier: Apache-2.0
+# ============LICENSE_END=========================================================
+#
+*/}}
+
+{{/*
+This helper defines which exporter port must be used depending on protocol
+*/}}
+{{- define "policy-clamp-ac-sim-ppnt.exporter-port" }}
+  {{- $jaegerExporterPort := .Values.jaeger.collector.portOtlpGrpc -}}
+    {{- if .Values.jaeger.collector.protocol -}}
+      {{- if eq .Values.jaeger.collector.protocol "http" -}}
+        {{- $jaegerExporterPort = .Values.jaeger.collector.portOtlpHttp -}}
+      {{- end -}}
+    {{- end -}}
+  {{- $jaegerExporterPort -}}
+{{- end -}}
+
+{{/*
+This helper defines whether Jaeger is enabled or not.
+*/}}
+{{- define "policy-clamp-ac-sim-ppnt.jaeger-enabled" }}
+  {{- $jaegerEnabled := "false" -}}
+  {{- if .Values.jaeger -}}
+    {{- if .Values.jaeger.enabled -}}
+        {{- $jaegerEnabled = .Values.jaeger.enabled -}}
+    {{- end -}}
+  {{- end -}}
+  {{- $jaegerEnabled -}}
+{{- end -}}
+
+{{/*
+This helper defines whether jaeger is using http or grpc protocol
+*/}}
+{{- define "policy-clamp-ac-sim-ppnt.jaeger-protocol" }}
+  {{- $protocol := "grpc" -}}
+  {{- if eq .Values.jaeger.collector.protocol "http" -}}
+      {{- $protocol = "http/protobuf" -}}
+  {{- end -}}
+  {{- $protocol -}}
+{{- end -}}
\ No newline at end of file
index 34fe404..6557821 100644 (file)
@@ -29,4 +29,4 @@ metadata:
     release: release
     heritage: Helm
 data:
-{{ tpl (.Files.Glob "resources/config/*.{xml,yaml}").AsConfig . | indent 2 }}
+{{ tpl (.Files.Glob "resources/config/*.{xml,yaml,sh}").AsConfig . | indent 2 }}
index 65260ed..446f000 100644 (file)
@@ -75,6 +75,18 @@ spec:
           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
           command: ["/opt/app/policy/clamp/bin/sim-participant.sh"]
           args: ["/opt/app/policy/clamp/etc/mounted/SimulatorParticipantParameters.yaml"]
+          {{- $jaegerEnabled := tpl "policy-clamp-ac-sim-ppnt.jaeger-enabled" . | trimSuffix "\n" -}}
+          {{- if $jaegerEnabled }}
+          env:
+            - name: OTEL_SERVICE_NAME
+              value: {{ .Values.applicationName }}
+            - name: OTEL_EXPORTER_OTLP_PROTOCOL
+              value: {{ include "policy-clamp-ac-sim-ppnt.jaeger-protocol" . }}
+            - name: OTEL_EXPORTER_OTLP_TRACES_PROTOCOL
+              value: {{ include "policy-clamp-ac-sim-ppnt.jaeger-protocol" . }}
+            - name: OTEL_EXPORTER_OTLP_ENDPOINT
+              value: {{ printf "%s:%s" (.Values.jaeger.collector.host) (include "policy-clamp-ac-sim-ppnt.exporter-port" .) }}
+          {{- end }}
           ports:
             - containerPort: 6969
               name: http-api
@@ -98,6 +110,9 @@ spec:
             readOnly: true
           - mountPath: /opt/app/policy/clamp/etc/mounted
             name: ac-sim-ppnt-config-processed
+          - mountPath: /opt/app/policy/clamp/bin/sim-participant.sh
+            name: ac-sim-ppnt-config
+            subPath: sim-participant.sh
           resources:
 {{ toYaml .Values.resources.small | indent 12 }}
         {{- if .Values.nodeSelector }}
index 45fccdd..95fe91c 100644 (file)
@@ -87,3 +87,20 @@ serviceAccount:
   roles:
     - read
 
+jaeger:
+  service:
+    name: jaeger
+  enabled: true
+  sampling:
+    probability: "1.0"
+  producer:
+    type: B3,W3C,B3_MULTI
+  collector:
+    protocol: grpc
+    host: "http://jaeger"
+    portOtlpGrpc: 4317
+    portOtlpHttp: 4318
+    portJaegerGrpc: 14250
+
+applicationName: sim-ppnt
+
index c33cf6b..ec0f900 100755 (executable)
@@ -17,6 +17,8 @@
 #  ============LICENSE_END=========================================================
 
 spring:
+  application:
+    name: {{ .Values.applicationName }}
   security:
     user:
       name: ${RUNTIME_USER}
@@ -77,6 +79,7 @@ runtime:
         topicCommInfrastructure: kafka
         useHttps: false
         fetchTimeout: 15000
+        allowTracing: {{ include "policy-clamp-runtime-acm.jaeger-enabled" . }}
         additionalProps:
             group.id: policy-clamp-runtime-acm
     topicSinks:
@@ -86,11 +89,13 @@ runtime:
           - {{ .Values.global.kafkaServer }}:9092
         topicCommInfrastructure: kafka
         useHttps: false
+        allowTracing: {{ include "policy-clamp-runtime-acm.jaeger-enabled" . }}
       -
         topic: ${runtime.topics.syncTopic}
         servers:
           - {{ .Values.global.kafkaServer }}:9092
         topicCommInfrastructure: kafka
+        allowTracing: {{ include "policy-clamp-runtime-acm.jaeger-enabled" . }}
         useHttps: false
   acmParameters:
     toscaElementName: {{ .Values.customNaming.toscaElementName }}
@@ -99,8 +104,22 @@ runtime:
 
 
 management:
+  tracing:
+    propagation:
+      produce: [{{ .Values.jaeger.producer.type }}]
+    sampling:
+      probability: {{ .Values.jaeger.sampling.probability }}
   endpoints:
     web:
       base-path: /
       exposure:
         include: health, metrics, prometheus
+
+tracing:
+  enabled: {{ .Values.jaeger.enabled }}
+  exporter:
+    endpoint: {{ .Values.jaeger.collector.host }}:{{ include "policy-clamp-runtime-acm.exporter-port" . }}
+    protocol: {{ .Values.jaeger.collector.protocol }}
+  sampler:
+    jaeger-remote:
+      endpoint: {{ .Values.jaeger.collector.host }}:{{ .Values.jaeger.collector.portJaegerGrpc }}
\ No newline at end of file
diff --git a/helm/policy/components/policy-clamp-runtime-acm/resources/config/acm-runtime.sh b/helm/policy/components/policy-clamp-runtime-acm/resources/config/acm-runtime.sh
new file mode 100755 (executable)
index 0000000..695c08f
--- /dev/null
@@ -0,0 +1,66 @@
+#!/usr/bin/env sh
+#
+# ============LICENSE_START=======================================================
+#  Copyright (C) 2024 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.
+#
+# SPDX-License-Identifier: Apache-2.0
+# ============LICENSE_END=========================================================
+#
+
+KEYSTORE="${KEYSTORE:-$POLICY_HOME/etc/ssl/policy-keystore}"
+TRUSTSTORE="${TRUSTSTORE:-$POLICY_HOME/etc/ssl/policy-truststore}"
+KEYSTORE_PASSWD="${KEYSTORE_PASSWD:-Pol1cy_0nap}"
+TRUSTSTORE_PASSWD="${TRUSTSTORE_PASSWD:-Pol1cy_0nap}"
+
+if [ "$#" -eq 1 ]; then
+    CONFIG_FILE=$1
+fi
+
+if [ -z "$CONFIG_FILE" ]; then
+    CONFIG_FILE="${POLICY_HOME}/etc/AcRuntimeParameters.yaml"
+fi
+
+echo "Policy clamp runtime acm config file: $CONFIG_FILE"
+
+if [ -f "${POLICY_HOME}/etc/mounted/policy-truststore" ]; then
+    echo "overriding policy-truststore"
+    cp -f "${POLICY_HOME}"/etc/mounted/policy-truststore "${TRUSTSTORE}"
+fi
+
+if [ -f "${POLICY_HOME}/etc/mounted/policy-keystore" ]; then
+    echo "overriding policy-keystore"
+    cp -f "${POLICY_HOME}"/etc/mounted/policy-keystore "${KEYSTORE}"
+fi
+
+if [ -f "${POLICY_HOME}/etc/mounted/logback.xml" ]; then
+    echo "overriding logback xml file"
+    cp -f "${POLICY_HOME}"/etc/mounted/logback.xml "${POLICY_HOME}"/etc/
+fi
+
+$JAVA_HOME/bin/java \
+    -Dlogging.config="${POLICY_HOME}/etc/logback.xml" \
+    -Dserver.ssl.keyStore="${KEYSTORE}" \
+    -Dserver.ssl.keyStorePassword="${KEYSTORE_PASSWD}" \
+    -Djavax.net.ssl.trustStore="${TRUSTSTORE}" \
+    -Djavax.net.ssl.trustStorePassword="${TRUSTSTORE_PASSWD}" \
+    -Dcom.sun.management.jmxremote.rmi.port=9090 \
+    -Dcom.sun.management.jmxremote=true \
+    -Dcom.sun.management.jmxremote.port=9090 \
+    -Dcom.sun.management.jmxremote.ssl=false \
+    -Dcom.sun.management.jmxremote.authenticate=false \
+    -Dcom.sun.management.jmxremote.local.only=false \
+    -Dotel.java.global-autoconfigure.enabled=true \
+    -jar /app/app.jar \
+    --spring.config.location="${CONFIG_FILE}"
diff --git a/helm/policy/components/policy-clamp-runtime-acm/templates/_helpers.tpl b/helm/policy/components/policy-clamp-runtime-acm/templates/_helpers.tpl
new file mode 100644 (file)
index 0000000..9e02361
--- /dev/null
@@ -0,0 +1,58 @@
+{{/*
+#
+# ============LICENSE_START=======================================================
+#  Copyright (C) 2024 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.
+#
+# SPDX-License-Identifier: Apache-2.0
+# ============LICENSE_END=========================================================
+#
+*/}}
+
+{{/*
+This helper defines which exporter port must be used depending on protocol
+*/}}
+{{- define "policy-clamp-runtime-acm.exporter-port" }}
+  {{- $jaegerExporterPort := .Values.jaeger.collector.portOtlpGrpc -}}
+    {{- if .Values.jaeger.collector.protocol -}}
+      {{- if eq .Values.jaeger.collector.protocol "http" -}}
+        {{- $jaegerExporterPort = .Values.jaeger.collector.portOtlpHttp -}}
+      {{- end -}}
+    {{- end -}}
+  {{- $jaegerExporterPort -}}
+{{- end -}}
+
+{{/*
+This helper defines whether Jaeger is enabled or not.
+*/}}
+{{- define "policy-clamp-runtime-acm.jaeger-enabled" }}
+  {{- $jaegerEnabled := "false" -}}
+  {{- if .Values.jaeger -}}
+    {{- if .Values.jaeger.enabled -}}
+        {{- $jaegerEnabled = .Values.jaeger.enabled -}}
+    {{- end -}}
+  {{- end -}}
+  {{- $jaegerEnabled -}}
+{{- end -}}
+
+{{/*
+This helper defines whether jaeger is using http or grpc protocol
+*/}}
+{{- define "policy-clamp-runtime-acm.jaeger-protocol" }}
+  {{- $protocol := "grpc" -}}
+  {{- if eq .Values.jaeger.collector.protocol "http" -}}
+      {{- $protocol = "http/protobuf" -}}
+  {{- end -}}
+  {{- $protocol -}}
+{{- end -}}
\ No newline at end of file
index 309dc45..43f6e27 100644 (file)
@@ -1,6 +1,6 @@
 {{/*
 #  ============LICENSE_START=======================================================
-#   Copyright (C) 2022 Nordix Foundation. All rights reserved.
+#   Copyright (C) 2022-2024 Nordix Foundation. All rights reserved.
 #  ================================================================================
 #  Licensed under the Apache License, Version 2.0 (the "License");
 #  you may not use this file except in compliance with the License.
@@ -34,4 +34,4 @@ binaryData:
 {{- end }}
 {{- end }}
 data:
-{{ tpl (.Files.Glob "resources/config/*.{json,xml,yaml}").AsConfig . | indent 2 }}
+{{ tpl (.Files.Glob "resources/config/*.{json,xml,yaml,sh}").AsConfig . | indent 2 }}
index b1253a4..9175c43 100644 (file)
@@ -1,6 +1,6 @@
 {{/*
 #  ============LICENSE_START=======================================================
-#   Copyright (C) 2022 Nordix Foundation.
+#   Copyright (C) 2022-2024 Nordix Foundation.
 #  ================================================================================
 #  Licensed under the Apache License, Version 2.0 (the "License");
 #  you may not use this file except in compliance with the License.
@@ -96,6 +96,18 @@ spec:
           imagePullPolicy: {{ .Values.global.pullPolicy }}
           command: ["/opt/app/policy/clamp/bin/acm-runtime.sh"]
           args: ["/opt/app/policy/clamp/etc/mounted/acRuntimeParameters.yaml"]
+          {{- $jaegerEnabled := tpl "policy-clamp-ac-a1pms-ppnt.jaeger-enabled" . | trimSuffix "\n" -}}
+          {{- if $jaegerEnabled }}
+          env:
+            - name: OTEL_SERVICE_NAME
+              value: {{ .Values.applicationName }}
+            - name: OTEL_EXPORTER_OTLP_PROTOCOL
+              value: {{ include "policy-clamp-runtime-acm.jaeger-protocol" . }}
+            - name: OTEL_EXPORTER_OTLP_TRACES_PROTOCOL
+              value: {{ include "policy-clamp-runtime-acm.jaeger-protocol" . }}
+            - name: OTEL_EXPORTER_OTLP_ENDPOINT
+              value: {{ printf "%s:%s" (.Values.jaeger.collector.host) (include "policy-clamp-runtime-acm.exporter-port" .) }}
+          {{- end }}
           ports:
             - containerPort: {{ .Values.service.ports.port }}
               name: http-api
@@ -119,6 +131,9 @@ spec:
             readOnly: true
           - mountPath: /opt/app/policy/clamp/etc/mounted
             name: ac-runtime-config-processed
+          - mountPath: /opt/app/policy/clamp/bin/acm-runtime.sh
+            name: ac-runtime-config
+            subPath: acm-runtime.sh
           resources:
 {{ toYaml .Values.resources.small | indent 12 }}
         {{- if .Values.nodeSelector }}
index c447382..82487e6 100644 (file)
@@ -93,3 +93,21 @@ serviceAccount:
 customNaming:
   toscaElementName: org.onap.policy.clamp.acm.AutomationCompositionElement
   toscaCompositionName: org.onap.policy.clamp.acm.AutomationComposition
+
+
+jaeger:
+  service:
+    name: jaeger
+  enabled: true
+  sampling:
+    probability: "1.0"
+  producer:
+    type: B3,W3C,B3_MULTI
+  collector:
+    protocol: grpc
+    host: "http://jaeger"
+    portOtlpGrpc: 4317
+    portOtlpHttp: 4318
+    portJaegerGrpc: 14250
+
+applicationName: acm-r
\ No newline at end of file
index 9e5347d..fabc016 100755 (executable)
@@ -62,7 +62,7 @@ policy-pap:
 policy-clamp-ac-k8s-ppnt:
   enabled: false
 policy-clamp-runtime-acm:
-  enabled: false
+  enabled: true
 policy-apex-pdp:
   enabled: false
 policy-clamp-ac-pf-ppnt:
@@ -81,7 +81,10 @@ policy-clamp-ac-kserve-ppnt:
   enabled: false
 policy-clamp-ac-a1pms-ppnt:
   enabled: false
-
+jaeger:
+  enabled: false
+  fullnameOverride: jaeger
+  enableHttpOpenTelemetryCollector: true
 #################################################################
 # DB configuration defaults.
 #################################################################