diff options
44 files changed, 1221 insertions, 21 deletions
diff --git a/csit/run-k8s-csit.sh b/csit/run-k8s-csit.sh index 75a42e78..4e25356c 100755 --- a/csit/run-k8s-csit.sh +++ b/csit/run-k8s-csit.sh @@ -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 ;; diff --git a/helm/policy/Chart.yaml b/helm/policy/Chart.yaml index 6947078b..9eb39120 100755 --- a/helm/policy/Chart.yaml +++ b/helm/policy/Chart.yaml @@ -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 diff --git a/helm/policy/components/policy-clamp-ac-a1pms-ppnt/resources/config/A1pmsParticipantParameters.yaml b/helm/policy/components/policy-clamp-ac-a1pms-ppnt/resources/config/A1pmsParticipantParameters.yaml index f2589482..14de491c 100755 --- a/helm/policy/components/policy-clamp-ac-a1pms-ppnt/resources/config/A1pmsParticipantParameters.yaml +++ b/helm/policy/components/policy-clamp-ac-a1pms-ppnt/resources/config/A1pmsParticipantParameters.yaml @@ -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 index 00000000..88ff3b88 --- /dev/null +++ b/helm/policy/components/policy-clamp-ac-a1pms-ppnt/resources/config/a1pms-participant.sh @@ -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 index 00000000..8f05017b --- /dev/null +++ b/helm/policy/components/policy-clamp-ac-a1pms-ppnt/templates/_helpers.tpl @@ -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 diff --git a/helm/policy/components/policy-clamp-ac-a1pms-ppnt/templates/configmap.yaml b/helm/policy/components/policy-clamp-ac-a1pms-ppnt/templates/configmap.yaml index 619906af..f8bd6c18 100755 --- a/helm/policy/components/policy-clamp-ac-a1pms-ppnt/templates/configmap.yaml +++ b/helm/policy/components/policy-clamp-ac-a1pms-ppnt/templates/configmap.yaml @@ -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 diff --git a/helm/policy/components/policy-clamp-ac-a1pms-ppnt/templates/deployment.yaml b/helm/policy/components/policy-clamp-ac-a1pms-ppnt/templates/deployment.yaml index e68d6550..bec288f5 100755 --- a/helm/policy/components/policy-clamp-ac-a1pms-ppnt/templates/deployment.yaml +++ b/helm/policy/components/policy-clamp-ac-a1pms-ppnt/templates/deployment.yaml @@ -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 }} diff --git a/helm/policy/components/policy-clamp-ac-a1pms-ppnt/values.yaml b/helm/policy/components/policy-clamp-ac-a1pms-ppnt/values.yaml index b700dd0a..556fe6c0 100755 --- a/helm/policy/components/policy-clamp-ac-a1pms-ppnt/values.yaml +++ b/helm/policy/components/policy-clamp-ac-a1pms-ppnt/values.yaml @@ -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 diff --git a/helm/policy/components/policy-clamp-ac-http-ppnt/resources/config/HttpParticipantParameters.yaml b/helm/policy/components/policy-clamp-ac-http-ppnt/resources/config/HttpParticipantParameters.yaml index 9bb0d0e2..160144a3 100644 --- a/helm/policy/components/policy-clamp-ac-http-ppnt/resources/config/HttpParticipantParameters.yaml +++ b/helm/policy/components/policy-clamp-ac-http-ppnt/resources/config/HttpParticipantParameters.yaml @@ -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 index 00000000..e35fb868 --- /dev/null +++ b/helm/policy/components/policy-clamp-ac-http-ppnt/resources/config/http-participant.sh @@ -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 index 00000000..7aed996d --- /dev/null +++ b/helm/policy/components/policy-clamp-ac-http-ppnt/templates/_helpers.tpl @@ -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 diff --git a/helm/policy/components/policy-clamp-ac-http-ppnt/templates/configmap.yaml b/helm/policy/components/policy-clamp-ac-http-ppnt/templates/configmap.yaml index 0b755aaf..380833ca 100644 --- a/helm/policy/components/policy-clamp-ac-http-ppnt/templates/configmap.yaml +++ b/helm/policy/components/policy-clamp-ac-http-ppnt/templates/configmap.yaml @@ -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 }} diff --git a/helm/policy/components/policy-clamp-ac-http-ppnt/templates/deployment.yaml b/helm/policy/components/policy-clamp-ac-http-ppnt/templates/deployment.yaml index ecdaa030..1cb3e9e3 100644 --- a/helm/policy/components/policy-clamp-ac-http-ppnt/templates/deployment.yaml +++ b/helm/policy/components/policy-clamp-ac-http-ppnt/templates/deployment.yaml @@ -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 }} diff --git a/helm/policy/components/policy-clamp-ac-http-ppnt/values.yaml b/helm/policy/components/policy-clamp-ac-http-ppnt/values.yaml index a4f05ea7..82686b55 100644 --- a/helm/policy/components/policy-clamp-ac-http-ppnt/values.yaml +++ b/helm/policy/components/policy-clamp-ac-http-ppnt/values.yaml @@ -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 diff --git a/helm/policy/components/policy-clamp-ac-k8s-ppnt/resources/config/KubernetesParticipantParameters.yaml b/helm/policy/components/policy-clamp-ac-k8s-ppnt/resources/config/KubernetesParticipantParameters.yaml index bd526540..4eedc0da 100644 --- a/helm/policy/components/policy-clamp-ac-k8s-ppnt/resources/config/KubernetesParticipantParameters.yaml +++ b/helm/policy/components/policy-clamp-ac-k8s-ppnt/resources/config/KubernetesParticipantParameters.yaml @@ -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 index 00000000..ce08684d --- /dev/null +++ b/helm/policy/components/policy-clamp-ac-k8s-ppnt/resources/config/kubernetes-participant.sh @@ -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 index 00000000..83b494f6 --- /dev/null +++ b/helm/policy/components/policy-clamp-ac-k8s-ppnt/templates/_helpers.tpl @@ -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 diff --git a/helm/policy/components/policy-clamp-ac-k8s-ppnt/templates/deployment.yaml b/helm/policy/components/policy-clamp-ac-k8s-ppnt/templates/deployment.yaml index fa90535f..e0f7a52e 100644 --- a/helm/policy/components/policy-clamp-ac-k8s-ppnt/templates/deployment.yaml +++ b/helm/policy/components/policy-clamp-ac-k8s-ppnt/templates/deployment.yaml @@ -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 }} diff --git a/helm/policy/components/policy-clamp-ac-k8s-ppnt/values.yaml b/helm/policy/components/policy-clamp-ac-k8s-ppnt/values.yaml index 934b1bb5..dfbda305 100644 --- a/helm/policy/components/policy-clamp-ac-k8s-ppnt/values.yaml +++ b/helm/policy/components/policy-clamp-ac-k8s-ppnt/values.yaml @@ -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 diff --git a/helm/policy/components/policy-clamp-ac-kserve-ppnt/resources/config/KserveParticipantParameters.yaml b/helm/policy/components/policy-clamp-ac-kserve-ppnt/resources/config/KserveParticipantParameters.yaml index 6e854c9a..3b71737f 100755 --- a/helm/policy/components/policy-clamp-ac-kserve-ppnt/resources/config/KserveParticipantParameters.yaml +++ b/helm/policy/components/policy-clamp-ac-kserve-ppnt/resources/config/KserveParticipantParameters.yaml @@ -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 index 00000000..7da0b0f6 --- /dev/null +++ b/helm/policy/components/policy-clamp-ac-kserve-ppnt/resources/config/kserve-participant.sh @@ -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 index 00000000..a2882871 --- /dev/null +++ b/helm/policy/components/policy-clamp-ac-kserve-ppnt/templates/_helpers.tpl @@ -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 diff --git a/helm/policy/components/policy-clamp-ac-kserve-ppnt/templates/configmap.yaml b/helm/policy/components/policy-clamp-ac-kserve-ppnt/templates/configmap.yaml index 619906af..f8bd6c18 100755 --- a/helm/policy/components/policy-clamp-ac-kserve-ppnt/templates/configmap.yaml +++ b/helm/policy/components/policy-clamp-ac-kserve-ppnt/templates/configmap.yaml @@ -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 diff --git a/helm/policy/components/policy-clamp-ac-kserve-ppnt/templates/deployment.yaml b/helm/policy/components/policy-clamp-ac-kserve-ppnt/templates/deployment.yaml index 60d50322..f8f53287 100755 --- a/helm/policy/components/policy-clamp-ac-kserve-ppnt/templates/deployment.yaml +++ b/helm/policy/components/policy-clamp-ac-kserve-ppnt/templates/deployment.yaml @@ -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 }} diff --git a/helm/policy/components/policy-clamp-ac-kserve-ppnt/values.yaml b/helm/policy/components/policy-clamp-ac-kserve-ppnt/values.yaml index 444c5bf2..0f354edf 100755 --- a/helm/policy/components/policy-clamp-ac-kserve-ppnt/values.yaml +++ b/helm/policy/components/policy-clamp-ac-kserve-ppnt/values.yaml @@ -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 diff --git a/helm/policy/components/policy-clamp-ac-pf-ppnt/resources/config/PolicyParticipantParameters.yaml b/helm/policy/components/policy-clamp-ac-pf-ppnt/resources/config/PolicyParticipantParameters.yaml index f7308e61..5753fe83 100644 --- a/helm/policy/components/policy-clamp-ac-pf-ppnt/resources/config/PolicyParticipantParameters.yaml +++ b/helm/policy/components/policy-clamp-ac-pf-ppnt/resources/config/PolicyParticipantParameters.yaml @@ -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 index 00000000..f36c2b37 --- /dev/null +++ b/helm/policy/components/policy-clamp-ac-pf-ppnt/resources/config/policy-participant.sh @@ -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 index 00000000..a5f3a1f1 --- /dev/null +++ b/helm/policy/components/policy-clamp-ac-pf-ppnt/templates/_helpers.tpl @@ -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 diff --git a/helm/policy/components/policy-clamp-ac-pf-ppnt/templates/configmap.yaml b/helm/policy/components/policy-clamp-ac-pf-ppnt/templates/configmap.yaml index 1319768a..2faeffcc 100644 --- a/helm/policy/components/policy-clamp-ac-pf-ppnt/templates/configmap.yaml +++ b/helm/policy/components/policy-clamp-ac-pf-ppnt/templates/configmap.yaml @@ -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 }} diff --git a/helm/policy/components/policy-clamp-ac-pf-ppnt/templates/deployment.yaml b/helm/policy/components/policy-clamp-ac-pf-ppnt/templates/deployment.yaml index bcb3dae5..7e921cbd 100644 --- a/helm/policy/components/policy-clamp-ac-pf-ppnt/templates/deployment.yaml +++ b/helm/policy/components/policy-clamp-ac-pf-ppnt/templates/deployment.yaml @@ -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 }} diff --git a/helm/policy/components/policy-clamp-ac-pf-ppnt/values.yaml b/helm/policy/components/policy-clamp-ac-pf-ppnt/values.yaml index af38e9c4..314fc237 100644 --- a/helm/policy/components/policy-clamp-ac-pf-ppnt/values.yaml +++ b/helm/policy/components/policy-clamp-ac-pf-ppnt/values.yaml @@ -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 diff --git a/helm/policy/components/policy-clamp-ac-sim-ppnt/resources/config/SimulatorParticipantParameters.yaml b/helm/policy/components/policy-clamp-ac-sim-ppnt/resources/config/SimulatorParticipantParameters.yaml index 7f178207..f8932ecb 100644 --- a/helm/policy/components/policy-clamp-ac-sim-ppnt/resources/config/SimulatorParticipantParameters.yaml +++ b/helm/policy/components/policy-clamp-ac-sim-ppnt/resources/config/SimulatorParticipantParameters.yaml @@ -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 index 00000000..556f4ef8 --- /dev/null +++ b/helm/policy/components/policy-clamp-ac-sim-ppnt/resources/config/sim-participant.sh @@ -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 index 00000000..5f19df88 --- /dev/null +++ b/helm/policy/components/policy-clamp-ac-sim-ppnt/templates/_helpers.tpl @@ -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 diff --git a/helm/policy/components/policy-clamp-ac-sim-ppnt/templates/configmap.yaml b/helm/policy/components/policy-clamp-ac-sim-ppnt/templates/configmap.yaml index 34fe4046..65578217 100644 --- a/helm/policy/components/policy-clamp-ac-sim-ppnt/templates/configmap.yaml +++ b/helm/policy/components/policy-clamp-ac-sim-ppnt/templates/configmap.yaml @@ -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 }} diff --git a/helm/policy/components/policy-clamp-ac-sim-ppnt/templates/deployment.yaml b/helm/policy/components/policy-clamp-ac-sim-ppnt/templates/deployment.yaml index 65260edd..446f000b 100644 --- a/helm/policy/components/policy-clamp-ac-sim-ppnt/templates/deployment.yaml +++ b/helm/policy/components/policy-clamp-ac-sim-ppnt/templates/deployment.yaml @@ -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 }} diff --git a/helm/policy/components/policy-clamp-ac-sim-ppnt/values.yaml b/helm/policy/components/policy-clamp-ac-sim-ppnt/values.yaml index 45fccdd0..95fe91c7 100644 --- a/helm/policy/components/policy-clamp-ac-sim-ppnt/values.yaml +++ b/helm/policy/components/policy-clamp-ac-sim-ppnt/values.yaml @@ -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 + diff --git a/helm/policy/components/policy-clamp-runtime-acm/resources/config/acRuntimeParameters.yaml b/helm/policy/components/policy-clamp-runtime-acm/resources/config/acRuntimeParameters.yaml index c33cf6ba..ec0f900b 100755 --- a/helm/policy/components/policy-clamp-runtime-acm/resources/config/acRuntimeParameters.yaml +++ b/helm/policy/components/policy-clamp-runtime-acm/resources/config/acRuntimeParameters.yaml @@ -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 index 00000000..695c08fc --- /dev/null +++ b/helm/policy/components/policy-clamp-runtime-acm/resources/config/acm-runtime.sh @@ -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 index 00000000..9e02361d --- /dev/null +++ b/helm/policy/components/policy-clamp-runtime-acm/templates/_helpers.tpl @@ -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 diff --git a/helm/policy/components/policy-clamp-runtime-acm/templates/configmap.yaml b/helm/policy/components/policy-clamp-runtime-acm/templates/configmap.yaml index 309dc45e..43f6e270 100644 --- a/helm/policy/components/policy-clamp-runtime-acm/templates/configmap.yaml +++ b/helm/policy/components/policy-clamp-runtime-acm/templates/configmap.yaml @@ -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 }} diff --git a/helm/policy/components/policy-clamp-runtime-acm/templates/deployment.yaml b/helm/policy/components/policy-clamp-runtime-acm/templates/deployment.yaml index b1253a42..9175c433 100644 --- a/helm/policy/components/policy-clamp-runtime-acm/templates/deployment.yaml +++ b/helm/policy/components/policy-clamp-runtime-acm/templates/deployment.yaml @@ -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 }} diff --git a/helm/policy/components/policy-clamp-runtime-acm/values.yaml b/helm/policy/components/policy-clamp-runtime-acm/values.yaml index c4473822..82487e69 100644 --- a/helm/policy/components/policy-clamp-runtime-acm/values.yaml +++ b/helm/policy/components/policy-clamp-runtime-acm/values.yaml @@ -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 diff --git a/helm/policy/values.yaml b/helm/policy/values.yaml index 9e5347d5..fabc016b 100755 --- a/helm/policy/values.yaml +++ b/helm/policy/values.yaml @@ -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. ################################################################# |