diff options
73 files changed, 1587 insertions, 136 deletions
diff --git a/compose/config/nginx/nginx-acm.conf b/compose/config/nginx/nginx-acm.conf new file mode 100644 index 00000000..59d12109 --- /dev/null +++ b/compose/config/nginx/nginx-acm.conf @@ -0,0 +1,17 @@ +user nginx; + +events { + worker_connections 1000; +} + +http { + upstream runtime { + server policy-clamp-runtime-acm-replica:6969; + } + server { + listen 30007; + location / { + proxy_pass http://runtime; + } + } +} diff --git a/compose/config/pap/papParameters.yaml b/compose/config/pap/papParameters.yaml index 51aaec38..5b6c640e 100644 --- a/compose/config/pap/papParameters.yaml +++ b/compose/config/pap/papParameters.yaml @@ -27,7 +27,6 @@ server: pap: name: PapGroup - aaf: false topic: pdp-pap.name: policy-pdp-pap notification.name: policy-notification diff --git a/compose/docker-compose.acm.scale.yml b/compose/docker-compose.acm.scale.yml new file mode 100644 index 00000000..676ffa2d --- /dev/null +++ b/compose/docker-compose.acm.scale.yml @@ -0,0 +1,147 @@ +# +# ===========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. +# ============LICENSE_END===================================================== +# + +services: + policy-clamp-runtime-acm-replica: + image: ${CONTAINER_LOCATION}onap/policy-clamp-runtime-acm:${POLICY_CLAMP_VERSION} + hostname: policy-clamp-runtime-acm + depends_on: + - policy-db-migrator-clamp + - kafka + - jaeger + - policy-clamp-ac-http-ppnt-replica + - policy-clamp-ac-k8s-ppnt-replica + - policy-clamp-ac-pf-ppnt-replica + - policy-clamp-ac-sim-ppnt + - apex-pdp + expose: + - 6969 + deploy: + mode: replicated + replicas: ${REPLICAS} + environment: + OTEL_SERVICE_NAME: acm-r + OTEL_EXPORTER_OTLP_PROTOCOL: http/protobuf + OTEL_EXPORTER_OTLP_TRACES_PROTOCOL: http/protobuf + OTEL_EXPORTER_OTLP_ENDPOINT: http://jaeger:4318 + # Tracing can be configured for grpc or http - default is http + #OTEL_EXPORTER_OTLP_PROTOCOL: grpc + #OTEL_EXPORTER_OTLP_TRACES_PROTOCOL: grpc + #OTEL_EXPORTER_OTLP_ENDPOINT: http://jaeger:4317 + volumes: + - ./config/clamp/AcRuntimeParameters.yaml:/opt/app/policy/clamp/etc/AcRuntimeParameters.yaml + - ./config/clamp/logback.xml:/opt/app/policy/clamp/etc/logback.xml:ro + - ./config/clamp/acm-runtime.sh:/opt/app/policy/clamp/bin/acm-runtime.sh:rw + - ./wait_for_port.sh:/opt/app/policy/bin/wait_for_port.sh:ro + entrypoint: /opt/app/policy/bin/wait_for_port.sh + command: [ + '-c', './acm-runtime.sh', + 'mariadb', '3306', + 'kafka', '9092', + 'policy-clamp-ac-http-ppnt', '6969', + 'policy-clamp-ac-k8s-ppnt', '6969', + 'policy-clamp-ac-pf-ppnt', '6969', + 'policy-clamp-ac-sim-ppnt', '6969' + ] + policy-clamp-ac-http-ppnt-replica: + image: ${CONTAINER_LOCATION}onap/policy-clamp-ac-http-ppnt:${POLICY_CLAMP_PPNT_VERSION} + hostname: policy-clamp-ac-http-ppnt + depends_on: + - kafka + - jaeger + expose: + - 6969 + deploy: + mode: replicated + replicas: ${REPLICAS} + environment: + OTEL_SERVICE_NAME: http-ppnt + OTEL_EXPORTER_OTLP_PROTOCOL: http/protobuf + OTEL_EXPORTER_OTLP_TRACES_PROTOCOL: http/protobuf + OTEL_EXPORTER_OTLP_ENDPOINT: http://jaeger:4318 + volumes: + - ./config/clamp/HttpParticipantParameters.yaml:/opt/app/policy/clamp/etc/HttpParticipantParameters.yaml + - ./config/clamp/http-participant.sh:/opt/app/policy/clamp/bin/http-participant.sh:rw + - ./config/clamp/logback.xml:/opt/app/policy/clamp/etc/logback.xml:ro + - ./wait_for_port.sh:/opt/app/policy/bin/wait_for_port.sh:ro + entrypoint: /opt/app/policy/bin/wait_for_port.sh + command: [ + '-c', './http-participant.sh', + 'kafka', '9092' + ] + policy-clamp-ac-k8s-ppnt-replica: + image: ${CONTAINER_LOCATION}onap/policy-clamp-ac-k8s-ppnt:${POLICY_CLAMP_PPNT_VERSION} + hostname: policy-clamp-ac-k8s-ppnt + depends_on: + - kafka + - jaeger + environment: + OTEL_SERVICE_NAME: k8s-ppnt + OTEL_EXPORTER_OTLP_PROTOCOL: http/protobuf + OTEL_EXPORTER_OTLP_TRACES_PROTOCOL: http/protobuf + OTEL_EXPORTER_OTLP_ENDPOINT: http://jaeger:4318 + expose: + - 6969 + deploy: + mode: replicated + replicas: ${REPLICAS} + volumes: + - ./config/clamp/KubernetesParticipantParameters.yaml:/opt/app/policy/clamp/etc/KubernetesParticipantParameters.yaml + - ./config/clamp/kubernetes-participant.sh:/opt/app/policy/clamp/bin/kubernetes-participant.sh:rw + - ./config/clamp/logback.xml:/opt/app/policy/clamp/etc/logback.xml:ro + - ./wait_for_port.sh:/opt/app/policy/bin/wait_for_port.sh:ro + entrypoint: /opt/app/policy/bin/wait_for_port.sh + command: [ + '-c', './kubernetes-participant.sh', + 'kafka', '9092' + ] + policy-clamp-ac-pf-ppnt-replica: + image: ${CONTAINER_LOCATION}onap/policy-clamp-ac-pf-ppnt:${POLICY_CLAMP_PPNT_VERSION} + hostname: policy-clamp-ac-pf-ppnt + depends_on: + - kafka + - jaeger + expose: + - 6969 + deploy: + mode: replicated + replicas: ${REPLICAS} + environment: + OTEL_SERVICE_NAME: policy-ppnt + OTEL_EXPORTER_OTLP_PROTOCOL: http/protobuf + OTEL_EXPORTER_OTLP_TRACES_PROTOCOL: http/protobuf + OTEL_EXPORTER_OTLP_ENDPOINT: http://jaeger:4318 + volumes: + - ./config/clamp/PolicyParticipantParameters.yaml:/opt/app/policy/clamp/etc/PolicyParticipantParameters.yaml:ro + - ./config/clamp/policy-participant.sh:/opt/app/policy/clamp/bin/policy-participant.sh:rw + - ./config/clamp/logback.xml:/opt/app/policy/clamp/etc/logback.xml:ro + - ./wait_for_port.sh:/opt/app/policy/bin/wait_for_port.sh:ro + entrypoint: /opt/app/policy/bin/wait_for_port.sh + command: [ + '-c', './policy-participant.sh', + 'kafka', '9092' + ] + nginx: + image: ${CONTAINER_LOCATION}library/nginx:latest + volumes: + - ./config/nginx/nginx-acm.conf:/etc/nginx/nginx.conf:ro + depends_on: + - policy-clamp-runtime-acm-replica + ports: + - ${ACM_PORT}:${ACM_PORT} + diff --git a/compose/docker-compose.pdp.scale.yml b/compose/docker-compose.pdp.scale.yml index a10264a5..242cb3d8 100644 --- a/compose/docker-compose.pdp.scale.yml +++ b/compose/docker-compose.pdp.scale.yml @@ -50,25 +50,4 @@ services: - apexpdp ports: - ${APEX_PORT}:${APEX_PORT} - zookeeper: - image: confluentinc/cp-zookeeper:latest - environment: - ZOOKEEPER_CLIENT_PORT: 2181 - ZOOKEEPER_TICK_TIME: 2000 - ports: - - 2181:2181 - kafka: - image: confluentinc/cp-kafka:latest - container_name: kafka - depends_on: - - zookeeper - ports: - - 29092:29092 - - 9092:9092 - environment: - KAFKA_BROKER_ID: 1 - KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181 - KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka:9092,PLAINTEXT_HOST://localhost:29092 - KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT - KAFKA_INTER_BROKER_LISTENER_NAME: PLAINTEXT - KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1 + diff --git a/compose/docker-compose.yml b/compose/docker-compose.yml index d5a2cc78..49c63779 100644 --- a/compose/docker-compose.yml +++ b/compose/docker-compose.yml @@ -500,7 +500,7 @@ services: TEST_ENV: ${TEST_ENV} jaeger: - image: jaegertracing/all-in-one:latest + image: jaegertracing/all-in-one:1.58 container_name: jaeger ports: - 4318:4318 diff --git a/compose/start-acm-replica.sh b/compose/start-acm-replica.sh new file mode 100755 index 00000000..373261e6 --- /dev/null +++ b/compose/start-acm-replica.sh @@ -0,0 +1,40 @@ +#!/bin/bash +# +# ============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====================================================== + +if [ -z "${WORKSPACE}" ]; then + WORKSPACE=$(git rev-parse --show-toplevel) + export WORKSPACE +fi + +if [ -z "$ROBOT_LOG_DIR" ]; then + export ROBOT_LOG_DIR=/tmp/ +fi + +COMPOSE_FOLDER="${WORKSPACE}"/compose + +cd ${COMPOSE_FOLDER} + +echo "Configuring docker compose..." +source export-ports.sh > /dev/null 2>&1 +source get-versions.sh > /dev/null 2>&1 + +export REPLICAS=${1} +docker compose -f docker-compose.yml -f docker-compose.acm.scale.yml up -d nginx +cd ${WORKSPACE} diff --git a/compose/start-compose.sh b/compose/start-compose.sh index a5da09d8..a6ada298 100755 --- a/compose/start-compose.sh +++ b/compose/start-compose.sh @@ -72,6 +72,9 @@ if [ -z "$ROBOT_LOG_DIR" ]; then export ROBOT_LOG_DIR=/tmp/ fi +# always 'docker' if running docker compose +export TEST_ENV="docker" + if [ -n "$component" ]; then if [ "$component" == "logs" ]; then echo "Collecting logs..." diff --git a/compose/start-multiple-pdp.sh b/compose/start-multiple-pdp.sh index 30572875..b97760e7 100755 --- a/compose/start-multiple-pdp.sh +++ b/compose/start-multiple-pdp.sh @@ -24,6 +24,10 @@ if [ -z "${WORKSPACE}" ]; then fi COMPOSE_FOLDER="${WORKSPACE}"/compose +if [ -z "$ROBOT_LOG_DIR" ]; then + export ROBOT_LOG_DIR=/tmp/ +fi + cd ${COMPOSE_FOLDER} echo "Configuring docker compose..." @@ -31,6 +35,6 @@ source export-ports.sh > /dev/null 2>&1 source get-versions.sh > /dev/null 2>&1 export REPLICAS=${1} -docker-compose -f docker-compose.yml -f docker-compose.pdp.scale.yml up -d apexpdp nginx grafana +docker compose -f docker-compose.yml -f docker-compose.pdp.scale.yml up -d apexpdp nginx grafana -cd ${WORKSPACE}
\ No newline at end of file +cd ${WORKSPACE} diff --git a/compose/stop-compose.sh b/compose/stop-compose.sh index 013fbe1e..809c8f47 100755 --- a/compose/stop-compose.sh +++ b/compose/stop-compose.sh @@ -24,6 +24,9 @@ if [ -z "${WORKSPACE}" ]; then export WORKSPACE fi +# always 'docker' if running docker compose +export TEST_ENV="docker" + # docker compose fails when not running CSIT if [ -z "$ROBOT_LOG_DIR" ]; then export ROBOT_LOG_DIR=/tmp/ @@ -51,11 +54,10 @@ do echo "======== Logs from ${item} ========" >> docker_compose.log docker compose logs $item >> docker_compose.log echo "===================================" >> docker_compose.log + echo "" >> docker_compose.log fi done -cat docker_compose.log - echo "Tearing down containers..." docker compose down -v --remove-orphans diff --git a/csit/resources/tests/apex-pdp-test.robot b/csit/resources/tests/apex-pdp-test.robot index 42be4415..6e426851 100644 --- a/csit/resources/tests/apex-pdp-test.robot +++ b/csit/resources/tests/apex-pdp-test.robot @@ -20,7 +20,7 @@ ExecuteApexSampleDomainPolicy # [Tags] docker Set Test Variable ${policyName} onap.policies.native.apex.Sampledomain ${postjson}= Get File ${CURDIR}/data/${policyName}.json - CreatePolicy /policy/api/v1/policytypes/onap.policies.native.Apex/versions/1.0.0/policies 200 ${postjson} ${policyName} 1.0.0 + CreatePolicySuccessfully /policy/api/v1/policytypes/onap.policies.native.Apex/versions/1.0.0/policies ${postjson} ${policyName} 1.0.0 DeployPolicy Wait Until Keyword Succeeds 2 min 5 sec QueryPolicyStatus ${policyName} defaultGroup apex ${pdpName} onap.policies.native.Apex Wait Until Keyword Succeeds 4 min 5 sec RunEventOnApexEngine @@ -28,7 +28,7 @@ ExecuteApexSampleDomainPolicy ExecuteApexTestPnfPolicy Set Test Variable ${policyName} onap.policies.apex.pnf.Test ${postjson}= Get File ${CURDIR}/data/${policyName}.json - CreatePolicy /policy/api/v1/policytypes/onap.policies.native.Apex/versions/1.0.0/policies 200 ${postjson} ${policyName} 1.0.0 + CreatePolicySuccessfully /policy/api/v1/policytypes/onap.policies.native.Apex/versions/1.0.0/policies ${postjson} ${policyName} 1.0.0 DeployPolicy Wait Until Keyword Succeeds 2 min 5 sec QueryPolicyStatus ${policyName} defaultGroup apex ${pdpName} onap.policies.native.Apex GetKafkaTopic apex-cl-mgt @@ -37,7 +37,7 @@ ExecuteApexTestPnfPolicy #ExecuteApexTestVnfPolicy # Set Test Variable ${policyName} onap.policies.apex.vnf.Test # ${postjson}= Get File ${CURDIR}/data/${policyName}.json -# CreatePolicy /policy/api/v1/policytypes/onap.policies.native.Apex/versions/1.0.0/policies 200 ${postjson} ${policyName} 1.0.0 +# CreatePolicySuccessfully /policy/api/v1/policytypes/onap.policies.native.Apex/versions/1.0.0/policies ${postjson} ${policyName} 1.0.0 # DeployPolicy # Wait Until Keyword Succeeds 2 min 5 sec QueryPolicyStatus ${policyName} defaultGroup apex ${pdpName} onap.policies.native.Apex # GetTopic apex-cl-mgt @@ -46,9 +46,9 @@ ExecuteApexTestPnfPolicy ExecuteApexTestPnfPolicyWithMetadataSet Set Test Variable ${policyName} onap.policies.apex.pnf.metadataSet.Test ${postjson}= Get File ${CURDIR}/data/${policyName}.json - CreatePolicy /policy/api/v1/policytypes/onap.policies.native.Apex/versions/1.0.0/policies 200 ${postjson} ${policyName} 1.0.0 + CreatePolicySuccessfully /policy/api/v1/policytypes/onap.policies.native.Apex/versions/1.0.0/policies ${postjson} ${policyName} 1.0.0 ${postjson}= Get File ${CURDIR}/data/onap.pnf.metadataSet.Test.json - CreateNodeTemplate /policy/api/v1/nodetemplates 200 ${postjson} 1 + CreateNodeTemplate /policy/api/v1/nodetemplates 201 ${postjson} 1 DeployPolicy Wait Until Keyword Succeeds 2 min 5 sec QueryPolicyStatus ${policyName} defaultGroup apex ${pdpName} onap.policies.native.Apex GetKafkaTopic apex-cl-mgt2 diff --git a/csit/resources/tests/apex-slas-10.robot b/csit/resources/tests/apex-slas-10.robot index 53779774..e2338c60 100644 --- a/csit/resources/tests/apex-slas-10.robot +++ b/csit/resources/tests/apex-slas-10.robot @@ -20,9 +20,9 @@ ValidatePolicyExecutionAndEventRateLowComplexity [Documentation] Validate that a moderate complexity policity can be executed in less than 100ms and minimum 100 events triggered per second Set Test Variable ${policyName} onap.policies.apex.pnf.metadataSet.Test ${postjson}= Get File ${CURDIR}/data/${policyName}.json - CreatePolicy /policy/api/v1/policytypes/onap.policies.native.Apex/versions/1.0.0/policies 200 ${postjson} ${policyName} 1.0.0 + CreatePolicySuccessfully /policy/api/v1/policytypes/onap.policies.native.Apex/versions/1.0.0/policies ${postjson} ${policyName} 1.0.0 ${postjson}= Get File ${CURDIR}/data/onap.pnf.metadataSet.Test.json - CreateNodeTemplate /policy/api/v1/nodetemplates 200 ${postjson} 1 + CreateNodeTemplate /policy/api/v1/nodetemplates 201 ${postjson} 1 DeployPolicy Wait Until Keyword Succeeds 2 min 5 sec QueryPolicyStatus ${policyName} defaultGroup apex ${pdpName} onap.policies.native.Apex GetKafkaTopic apex-cl-mgt2 @@ -36,7 +36,7 @@ ValidatePolicyExecutionAndEventRateHighComplexity [Documentation] Validate that a high complexity policity can be executed in less than 5000ms and minimum 2 events triggered per second Set Test Variable ${policyName} onap.policies.native.apex.Sampledomain ${postjson}= Get File ${CURDIR}/data/${policyName}.json - CreatePolicy /policy/api/v1/policytypes/onap.policies.native.Apex/versions/1.0.0/policies 200 ${postjson} ${policyName} 1.0.0 + CreatePolicySuccessfully /policy/api/v1/policytypes/onap.policies.native.Apex/versions/1.0.0/policies ${postjson} ${policyName} 1.0.0 DeployPolicy Create Session apexSession http://${APEX_EVENTS_IP} max_retries=1 ${data}= Get Binary File ${CURDIR}/data/event.json @@ -52,7 +52,7 @@ ValidatePolicyExecutionAndEventRateModerateComplexity [Documentation] Validate that a low complexity policity can be executed in less than 1000ms and minimum 10 events triggered per second Set Test Variable ${policyName} onap.policies.apex.pnf.Test ${postjson}= Get File ${CURDIR}/data/${policyName}.json - CreatePolicy /policy/api/v1/policytypes/onap.policies.native.Apex/versions/1.0.0/policies 200 ${postjson} ${policyName} 1.0.0 + CreatePolicySuccessfully /policy/api/v1/policytypes/onap.policies.native.Apex/versions/1.0.0/policies ${postjson} ${policyName} 1.0.0 DeployPolicy Wait Until Keyword Succeeds 2 min 5 sec QueryPolicyStatus ${policyName} defaultGroup apex ${pdpName} onap.policies.native.Apex GetKafkaTopic apex-cl-mgt diff --git a/csit/resources/tests/apex-slas-3.robot b/csit/resources/tests/apex-slas-3.robot index 048e2e76..9322f177 100644 --- a/csit/resources/tests/apex-slas-3.robot +++ b/csit/resources/tests/apex-slas-3.robot @@ -20,7 +20,7 @@ ValidatePolicyExecutionAndEventRateLowComplexity [Documentation] Validate that a moderate complexity policity can be executed in less than 100ms and minimum 30 events triggered per second Set Test Variable ${policyName} onap.policies.apex.pnf.Test ${postjson}= Get File ${CURDIR}/data/${policyName}.json - CreatePolicy /policy/api/v1/policytypes/onap.policies.native.Apex/versions/1.0.0/policies 200 ${postjson} ${policyName} 1.0.0 + CreatePolicySuccessfully /policy/api/v1/policytypes/onap.policies.native.Apex/versions/1.0.0/policies ${postjson} ${policyName} 1.0.0 DeployPolicy Wait Until Keyword Succeeds 2 min 5 sec QueryPolicyStatus ${policyName} defaultGroup apex ${pdpName} onap.policies.native.Apex GetKafkaTopic apex-cl-mgt @@ -34,9 +34,9 @@ ValidatePolicyExecutionAndEventRateHighComplexity [Documentation] Validate that a high complexity policity can be executed in less than 5000ms and minimum 0.6 events triggered per second Set Test Variable ${policyName} onap.policies.apex.pnf.metadataSet.Test ${postjson}= Get File ${CURDIR}/data/${policyName}.json - CreatePolicy /policy/api/v1/policytypes/onap.policies.native.Apex/versions/1.0.0/policies 200 ${postjson} ${policyName} 1.0.0 + CreatePolicySuccessfully /policy/api/v1/policytypes/onap.policies.native.Apex/versions/1.0.0/policies ${postjson} ${policyName} 1.0.0 ${postjson}= Get File ${CURDIR}/data/onap.pnf.metadataSet.Test.json - CreateNodeTemplate /policy/api/v1/nodetemplates 200 ${postjson} 1 + CreateNodeTemplate /policy/api/v1/nodetemplates 201 ${postjson} 1 DeployPolicy Wait Until Keyword Succeeds 2 min 5 sec QueryPolicyStatus ${policyName} defaultGroup apex ${pdpName} onap.policies.native.Apex GetKafkaTopic apex-cl-mgt2 @@ -50,7 +50,7 @@ ValidatePolicyExecutionAndEventRateModerateComplexity [Documentation] Validate that a low complexity policity can be executed in less than 1000ms and minimum 3 events triggered per second Set Test Variable ${policyName} onap.policies.native.apex.Sampledomain ${postjson}= Get File ${CURDIR}/data/${policyName}.json - CreatePolicy /policy/api/v1/policytypes/onap.policies.native.Apex/versions/1.0.0/policies 200 ${postjson} ${policyName} 1.0.0 + CreatePolicySuccessfully /policy/api/v1/policytypes/onap.policies.native.Apex/versions/1.0.0/policies ${postjson} ${policyName} 1.0.0 DeployPolicy #Wait Until Keyword Succeeds 4 min 5 sec RunEventOnApexEngine Create Session apexSession http://${APEX_EVENTS_IP} max_retries=1 diff --git a/csit/resources/tests/apex-slas.robot b/csit/resources/tests/apex-slas.robot index 69b24521..08d50062 100644 --- a/csit/resources/tests/apex-slas.robot +++ b/csit/resources/tests/apex-slas.robot @@ -20,7 +20,7 @@ ValidatePolicyExecutionAndEventRateLowComplexity [Documentation] Validate that a moderate complexity policity can be executed in less than 100ms and minimum 10 events triggered per second Set Test Variable ${policyName} onap.policies.apex.pnf.Test ${postjson}= Get File ${CURDIR}/data/${policyName}.json - CreatePolicy /policy/api/v1/policytypes/onap.policies.native.Apex/versions/1.0.0/policies 200 ${postjson} ${policyName} 1.0.0 + CreatePolicySuccessfully /policy/api/v1/policytypes/onap.policies.native.Apex/versions/1.0.0/policies ${postjson} ${policyName} 1.0.0 DeployPolicy Wait Until Keyword Succeeds 2 min 5 sec QueryPolicyStatus ${policyName} defaultGroup apex ${pdpName} onap.policies.native.Apex GetKafkaTopic apex-cl-mgt @@ -34,7 +34,7 @@ ValidatePolicyExecutionAndEventRateModerateComplexity [Documentation] Validate that a low complexity policity can be executed in less than 1000ms and minimum 1 events triggered per second Set Test Variable ${policyName} onap.policies.native.apex.Sampledomain ${postjson}= Get File ${CURDIR}/data/${policyName}.json - CreatePolicy /policy/api/v1/policytypes/onap.policies.native.Apex/versions/1.0.0/policies 200 ${postjson} ${policyName} 1.0.0 + CreatePolicySuccessfully /policy/api/v1/policytypes/onap.policies.native.Apex/versions/1.0.0/policies ${postjson} ${policyName} 1.0.0 DeployPolicy ${eventStartTime}= Get Current Date Wait Until Keyword Succeeds 4 min 5 sec RunEventOnApexEngine @@ -45,9 +45,9 @@ ValidatePolicyExecutionAndEventRateHighComplexity [Documentation] Validate that a high complexity policity can be executed in less than 5000ms and minimum 0.2 events triggered per second Set Test Variable ${policyName} onap.policies.apex.pnf.metadataSet.Test ${postjson}= Get File ${CURDIR}/data/${policyName}.json - CreatePolicy /policy/api/v1/policytypes/onap.policies.native.Apex/versions/1.0.0/policies 200 ${postjson} ${policyName} 1.0.0 + CreatePolicySuccessfully /policy/api/v1/policytypes/onap.policies.native.Apex/versions/1.0.0/policies ${postjson} ${policyName} 1.0.0 ${postjson}= Get File ${CURDIR}/data/onap.pnf.metadataSet.Test.json - CreateNodeTemplate /policy/api/v1/nodetemplates 200 ${postjson} 1 + CreateNodeTemplate /policy/api/v1/nodetemplates 201 ${postjson} 1 DeployPolicy Wait Until Keyword Succeeds 2 min 5 sec QueryPolicyStatus ${policyName} defaultGroup apex ${pdpName} onap.policies.native.Apex GetKafkaTopic apex-cl-mgt2 diff --git a/csit/resources/tests/api-test.robot b/csit/resources/tests/api-test.robot index bce58231..9c8a5f0b 100644 --- a/csit/resources/tests/api-test.robot +++ b/csit/resources/tests/api-test.robot @@ -28,7 +28,7 @@ CreateTCAPolicyTypeV2 CreateTCAPolicyTypeV3 [Documentation] Create a policy type named 'onap.policies.monitoring.tcagen2' and version '3.0.0' - CreatePolicyType /policy/api/v1/policytypes 200 onap.policy.monitoring.tcagen2.v3.json onap.policies.monitoring.tcagen2 3.0.0 + CreatePolicyType /policy/api/v1/policytypes 201 onap.policy.monitoring.tcagen2.v3.json onap.policies.monitoring.tcagen2 3.0.0 RetrieveMonitoringPolicyTypes [Documentation] Retrieve all monitoring related policy types @@ -37,7 +37,7 @@ RetrieveMonitoringPolicyTypes CreateNewMonitoringPolicyV1 [Documentation] Create a policy named 'onap.restart.tca' and version '1.0.0' using specific api ${postjson}= Get file ${DATA}/vCPE.policy.monitoring.input.tosca.json - CreatePolicy /policy/api/v1/policytypes/onap.policies.monitoring.tcagen2/versions/1.0.0/policies 200 ${postjson} onap.restart.tca 1.0.0 + CreatePolicySuccessfully /policy/api/v1/policytypes/onap.policies.monitoring.tcagen2/versions/1.0.0/policies ${postjson} onap.restart.tca 1.0.0 CreateNewMonitoringPolicyV1Again [Documentation] Create an existing policy with modification and keeping the same version should result in error. @@ -47,12 +47,12 @@ CreateNewMonitoringPolicyV1Again CreateNewMonitoringPolicyV2 [Documentation] Create a policy named 'onap.restart.tca' and version '2.0.0' using generic api ${postjson}= Get file ${DATA}/vCPE.policy.monitoring.input.tosca.v2.json - CreatePolicy /policy/api/v1/policies 200 ${postjson} onap.restart.tca 2.0.0 + CreatePolicySuccessfully /policy/api/v1/policies ${postjson} onap.restart.tca 2.0.0 CreateNodeTemplates [Documentation] Create node templates in database using specific api ${postjson}= Get file ${NODETEMPLATES}/nodetemplates.metadatasets.input.tosca.json - CreateNodeTemplate /policy/api/v1/nodetemplates 200 ${postjson} 3 + CreateNodeTemplate /policy/api/v1/nodetemplates 201 ${postjson} 3 RetrievePoliciesOfType [Documentation] Retrieve all policies belonging to a specific Policy Type @@ -113,8 +113,8 @@ Metrics Should Contain ${resp.text} http_server_requests_seconds_count{error="none",exception="none",method="GET",outcome="SUCCESS",status="200",uri="/policies",} 1.0 Should Contain ${resp.text} http_server_requests_seconds_count{error="none",exception="none",method="GET",outcome="SUCCESS",status="200",uri="/policies/{policyId}/versions/{policyVersion}",} 1.0 Should Contain ${resp.text} http_server_requests_seconds_count{error="none",exception="none",method="GET",outcome="SUCCESS",status="200",uri="/policytypes/{policyTypeId}/versions/{policyTypeVersion}/policies",} 1.0 - Should Contain ${resp.text} http_server_requests_seconds_count{error="none",exception="none",method="POST",outcome="SUCCESS",status="200",uri="/policytypes/{policyTypeId}/versions/{policyTypeVersion}/policies",} 1.0 - Should Contain ${resp.text} http_server_requests_seconds_count{error="none",exception="none",method="POST",outcome="SUCCESS",status="200",uri="/policytypes",} 1.0 + Should Contain ${resp.text} http_server_requests_seconds_count{error="none",exception="none",method="POST",outcome="SUCCESS",status="201",uri="/policytypes/{policyTypeId}/versions/{policyTypeVersion}/policies",} 1.0 + Should Contain ${resp.text} http_server_requests_seconds_count{error="none",exception="none",method="POST",outcome="SUCCESS",status="201",uri="/policytypes",} 1.0 Should Contain ${resp.text} http_server_requests_seconds_count{error="none",exception="none",method="DELETE",outcome="SUCCESS",status="200",uri="/policies/{policyId}/versions/{policyVersion}",} 1.0 Should Contain ${resp.text} http_server_requests_seconds_count{error="none",exception="none",method="DELETE",outcome="SUCCESS",status="200",uri="/policytypes/{policyTypeId}/versions/{versionId}",} 3.0 Should Contain ${resp.text} http_server_requests_seconds_count{error="none",exception="none",method="DELETE",outcome="SUCCESS",status="200",uri="/policytypes/{policyTypeId}/versions/{policyTypeVersion}/policies/{policyId}/versions/{policyVersion}",} 1.0 diff --git a/csit/resources/tests/common-library.robot b/csit/resources/tests/common-library.robot index a585bc97..30fd32a2 100644 --- a/csit/resources/tests/common-library.robot +++ b/csit/resources/tests/common-library.robot @@ -50,15 +50,21 @@ CreatePolicy [Documentation] Create the specific policy ${policyadmin}= PolicyAdminAuth ${resp}= PerformPostRequest ${POLICY_API_IP} ${url} ${expectedstatus} ${postjson} null ${policyadmin} - Run Keyword If ${expectedstatus}==200 Dictionary Should Contain Key ${resp.json()['topology_template']['policies'][0]} ${policyname} - Run Keyword If ${expectedstatus}==200 Should Be Equal As Strings ${resp.json()['topology_template']['policies'][0]['${policyname}']['version']} ${policyversion} + +CreatePolicySuccessfully + [Arguments] ${url} ${postjson} ${policyname} ${policyversion} + [Documentation] Create the specific policy + ${policyadmin}= PolicyAdminAuth + ${resp}= PerformPostRequest ${POLICY_API_IP} ${url} 201 ${postjson} null ${policyadmin} + Dictionary Should Contain Key ${resp.json()['topology_template']['policies'][0]} ${policyname} + Should Be Equal As Strings ${resp.json()['topology_template']['policies'][0]['${policyname}']['version']} ${policyversion} CreateNodeTemplate [Arguments] ${url} ${expectedstatus} ${postjson} ${nodeTemplateListLength} [Documentation] Create the node templates ${policyadmin}= PolicyAdminAuth ${resp}= PerformPostRequest ${POLICY_API_IP} ${url} ${expectedstatus} ${postjson} \ ${policyadmin} - Run Keyword If ${expectedstatus}==200 Length Should Be ${resp.json()['topology_template']['node_templates']} ${nodeTemplateListLength} + Run Keyword If ${expectedstatus}==201 Length Should Be ${resp.json()['topology_template']['node_templates']} ${nodeTemplateListLength} QueryPdpGroups diff --git a/csit/resources/tests/drools-applications-test.robot b/csit/resources/tests/drools-applications-test.robot index edbc1df6..e7b2105f 100644 --- a/csit/resources/tests/drools-applications-test.robot +++ b/csit/resources/tests/drools-applications-test.robot @@ -34,41 +34,41 @@ MakeTopics CreateVcpeXacmlPolicy [Documentation] Create VCPE Policy for Xacml - PerformPostRequest /policy/api/v1/policies null ${POLICY_API_IP} vCPE.policy.monitoring.input.tosca.yaml ${DATA} yaml 200 + CreatePolicy vCPE.policy.monitoring.input.tosca.yaml yaml CreateVcpeDroolsPolicy [Documentation] Create VCPE Policy for Drools - PerformPostRequest /policy/api/v1/policies null ${POLICY_API_IP} vCPE.policy.operational.input.tosca.yaml ${DATA} yaml 200 + CreatePolicy vCPE.policy.operational.input.tosca.yaml yaml CreateVdnsXacmlPolicy [Documentation] Create VDNS Policy for Xacml - PerformPostRequest /policy/api/v1/policies null ${POLICY_API_IP} vDNS.policy.monitoring.input.tosca.yaml ${DATA} yaml 200 + CreatePolicy vDNS.policy.monitoring.input.tosca.yaml yaml CreateVdnsDroolsPolicy [Documentation] Create VDNS Policy for Drools - PerformPostRequest /policy/api/v1/policies null ${POLICY_API_IP} vDNS.policy.operational.input.tosca.json ${DATA} json 200 + CreatePolicy vDNS.policy.operational.input.tosca.json json CreateVfwXacmlPolicy [Documentation] Create VFW Policy for Xacml - PerformPostRequest /policy/api/v1/policies null ${POLICY_API_IP} vFirewall.policy.monitoring.input.tosca.yaml ${DATA} yaml 200 + CreatePolicy vFirewall.policy.monitoring.input.tosca.yaml yaml CreateVfwDroolsPolicy [Documentation] Create VFW Policy for Drools - PerformPostRequest /policy/api/v1/policies null ${POLICY_API_IP} vFirewall.policy.operational.input.tosca.json ${DATA} json 200 + CreatePolicy vFirewall.policy.operational.input.tosca.json json DeployXacmlPolicies [Documentation] Deploys the Policies to Xacml - PerformPostRequest /policy/pap/v1/pdps/deployments/batch null ${POLICY_PAP_IP} deploy.xacml.policies.json ${CURDIR}/data json 202 + DeployPolicy deploy.xacml.policies.json Sleep 5s ${result}= CheckKafkaTopic policy-notification onap.vfirewall.tca Should Contain ${result} deployed-policies Should Contain ${result} onap.scaleout.tca Should Contain ${result} onap.restart.tca -# Uncomment the drools policy deployment once the drools pdp code is fixed +## Uncomment the drools policy deployment once the drools pdp code is fixed #DeployDroolsPolicies # [Documentation] Deploys the Policies to Drools -# PerformPostRequest /policy/pap/v1/pdps/deployments/batch null ${POLICY_PAP_IP} deploy.drools.policies.json ${CURDIR}/data json 202 +# DeployPolicy deploy.drools.policies.json # Sleep 5s # ${result}= CheckKafkaTopic policy-notification operational.modifyconfig # Should Contain ${result} deployed-policies @@ -158,13 +158,13 @@ PeformGetRequest RETURN ${resp} PerformPostRequest - [Arguments] ${url} ${params} ${domain} ${jsonfile} ${filepath} ${contenttype} ${expectedstatus} + [Arguments] ${url} ${domain} ${file} ${folder} ${contenttype} ${expectedstatus} ${auth}= Create List policyadmin zb!XztG34 - ${postjson}= Get file ${filepath}/${jsonfile} + ${body}= Get file ${folder}/${file} Log Creating session http://${domain} ${session}= Create Session policy http://${domain} auth=${auth} ${headers}= Create Dictionary Accept=application/${contenttype} Content-Type=application/${contenttype} - ${resp}= POST On Session policy ${url} params=${params} data=${postjson} headers=${headers} expected_status=${expectedstatus} + ${resp}= POST On Session policy ${url} data=${body} headers=${headers} expected_status=${expectedstatus} Log Received response from policy ${resp.text} RETURN ${resp} @@ -174,3 +174,11 @@ OnSet ${resp}= Run Process ${CURDIR}/kafka_producer.py unauthenticated.dcae_cl_output ${data} ${KAFKA_IP} Log Response from kafka ${resp.stdout} RETURN ${resp.stdout} + +CreatePolicy + [Arguments] ${policyFile} ${contenttype} + PerformPostRequest /policy/api/v1/policies ${POLICY_API_IP} ${policyFile} ${DATA} ${contenttype} 201 + +DeployPolicy + [Arguments] ${policyName} + PerformPostRequest /policy/pap/v1/pdps/deployments/batch ${POLICY_PAP_IP} ${policyName} ${CURDIR}/data json 202 diff --git a/csit/resources/tests/pap-test.robot b/csit/resources/tests/pap-test.robot index 13bf16ed..58a6a049 100644 --- a/csit/resources/tests/pap-test.robot +++ b/csit/resources/tests/pap-test.robot @@ -19,17 +19,17 @@ CheckUndeploymentStatus LoadPolicy [Documentation] Create a policy named 'onap.restart.tca' and version '1.0.0' using specific api ${postjson}= Get file ${DATA}/vCPE.policy.monitoring.input.tosca.json - CreatePolicy /policy/api/v1/policytypes/onap.policies.monitoring.tcagen2/versions/1.0.0/policies 200 ${postjson} onap.restart.tca 1.0.0 + CreatePolicy /policy/api/v1/policytypes/onap.policies.monitoring.tcagen2/versions/1.0.0/policies 201 ${postjson} onap.restart.tca 1.0.0 LoadPolicyWithMetadataSet [Documentation] Create a policy named 'operational.apex.decisionMaker' and version '1.0.0' using specific api ${postjson}= Get file ${CURDIR}/data/apex.policy.decisionmaker.input.tosca.json - CreatePolicy /policy/api/v1/policytypes/onap.policies.native.Apex/versions/1.0.0/policies 200 ${postjson} operational.apex.decisionMaker 1.0.0 + CreatePolicySuccessfully /policy/api/v1/policytypes/onap.policies.native.Apex/versions/1.0.0/policies ${postjson} operational.apex.decisionMaker 1.0.0 LoadNodeTemplates [Documentation] Create node templates in database using specific api ${postjson}= Get file ${NODETEMPLATES}/nodetemplates.metadatasets.input.tosca.json - CreateNodeTemplate /policy/api/v1/nodetemplates 200 ${postjson} 3 + CreateNodeTemplate /policy/api/v1/nodetemplates 201 ${postjson} 3 Healthcheck [Documentation] Verify policy pap health check diff --git a/csit/resources/tests/xacml-pdp-test.robot b/csit/resources/tests/xacml-pdp-test.robot index cddecab9..9d6227c3 100644 --- a/csit/resources/tests/xacml-pdp-test.robot +++ b/csit/resources/tests/xacml-pdp-test.robot @@ -37,12 +37,12 @@ ExecuteXacmlPolicy CreateMonitorPolicy [Documentation] Create a Monitoring policy ${postjson}= Get file ${DATA}/vCPE.policy.monitoring.input.tosca.json - CreatePolicy /policy/api/v1/policytypes/onap.policies.monitoring.tcagen2/versions/1.0.0/policies 200 ${postjson} onap.restart.tca 1.0.0 + CreatePolicy /policy/api/v1/policytypes/onap.policies.monitoring.tcagen2/versions/1.0.0/policies 201 ${postjson} onap.restart.tca 1.0.0 CreateOptimizationPolicy [Documentation] Create an Optimization policy ${postjson}= Get file ${DATA}/vCPE.policies.optimization.input.tosca.json - CreatePolicy /policy/api/v1/policytypes/onap.policies.optimization.resource.AffinityPolicy/versions/1.0.0/policies 200 ${postjson} OSDF_CASABLANCA.Affinity_Default 1.0.0 + CreatePolicy /policy/api/v1/policytypes/onap.policies.optimization.resource.AffinityPolicy/versions/1.0.0/policies 201 ${postjson} OSDF_CASABLANCA.Affinity_Default 1.0.0 GetDefaultDecision [Documentation] Get Default Decision with no policies in Xacml PDP diff --git a/csit/run-k8s-csit.sh b/csit/run-k8s-csit.sh index 75a42e78..7a5fe03c 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 @@ -68,7 +69,7 @@ function spin_microk8s_cluster() { if [ "$exitcode" -ne 0 ]; then echo "Microk8s cluster not available, Spinning up the cluster.." - sudo snap install microk8s --classic --channel=1.26/stable + sudo snap install microk8s --classic --channel=1.30/stable if [ "${?}" -ne 0 ]; then echo "Failed to install kubernetes cluster. Aborting.." @@ -76,8 +77,8 @@ function spin_microk8s_cluster() { fi echo "Microk8s cluster installed successfully" sudo usermod -a -G microk8s $USER - echo "Enabling DNS and helm3 plugins" - sudo microk8s.enable dns helm3 hostpath-storage + echo "Enabling DNS and Storage plugins" + sudo microk8s.enable dns hostpath-storage echo "Creating configuration file for Microk8s" sudo mkdir -p $HOME/.kube sudo chown -R $USER:$USER $HOME/.kube @@ -95,8 +96,8 @@ function spin_microk8s_cluster() { exitcode="${?}" if [ "$exitcode" -ne 0 ]; then - echo "Kubectl not available, Spinning up the cluster.." - sudo snap install kubectl --classic --channel=1.26/stable + echo "Kubectl not available, Installing.." + sudo snap install kubectl --classic --channel=1.30/stable if [ "${?}" -ne 0 ]; then echo "Failed to install Kubectl. Aborting.." @@ -109,6 +110,26 @@ function spin_microk8s_cluster() { echo "----------------------------------------" return 0 fi + + echo "Verify if helm is running.." + helm version + exitcode="${?}" + + if [ "$exitcode" -ne 0 ]; then + echo "Helm not available, Installing.." + sudo snap install helm --classic --channel=3.7 + + if [ "${?}" -ne 0 ]; then + echo "Failed to install Helm client. Aborting.." + return 1 + fi + echo "Helm installation completed" + echo "----------------------------------------" + else + echo "Helm is already running" + echo "----------------------------------------" + return 0 + fi } function install_kafka() { @@ -120,17 +141,17 @@ function install_kafka() { function uninstall_policy() { echo "Removing the policy helm deployment" - sudo microk8s helm uninstall csit-policy - sudo microk8s helm uninstall prometheus - sudo microk8s helm uninstall csit-robot + sudo helm uninstall csit-policy + sudo helm uninstall prometheus + sudo helm uninstall csit-robot sudo kubectl delete deploy $ZK_CONTAINER $KAFKA_CONTAINER rm -rf ${WORKSPACE}/helm/policy/Chart.lock if [ "$PROJECT" == "clamp" ] || [ "$PROJECT" == "policy-clamp" ]; then - sudo microk8s helm uninstall policy-chartmuseum - sudo microk8s helm repo remove chartmuseum-git policy-chartmuseum + sudo helm uninstall policy-chartmuseum + sudo helm repo remove chartmuseum-git policy-chartmuseum fi sudo rm -rf /dockerdata-nfs/mariadb-galera/ - sudo microk8s kubectl delete pvc --all + sudo kubectl delete pvc --all echo "Policy deployment deleted" echo "Clean up docker" docker image prune -f @@ -139,6 +160,8 @@ function uninstall_policy() { function teardown_cluster() { echo "Removing k8s cluster and k8s configuration file" sudo snap remove microk8s;rm -rf $HOME/.kube/config + sudo snap remove helm; + sudo snap remove kubectl; echo "MicroK8s Cluster removed" } @@ -172,14 +195,14 @@ function start_csit() { while [[ ${POD_READY_STATUS} != "1/1" ]]; do echo "Waiting for chartmuseum pod to come up..." sleep 5 - POD_READY_STATUS=$(sudo microk8s kubectl get pods | grep -e "policy-chartmuseum" | awk '{print $2}') + POD_READY_STATUS=$(sudo kubectl get pods | grep -e "policy-chartmuseum" | awk '{print $2}') done push_acelement_chart fi echo "Installing Robot framework pod for running CSIT" cd ${WORKSPACE}/helm mkdir -p ${ROBOT_LOG_DIR} - sudo microk8s helm install csit-robot robot --set robot="$ROBOT_FILE" --set "readiness={${READINESS_CONTAINERS[*]}}" --set robotLogDir=$ROBOT_LOG_DIR + sudo helm install csit-robot robot --set robot="$ROBOT_FILE" --set "readiness={${READINESS_CONTAINERS[*]}}" --set robotLogDir=$ROBOT_LOG_DIR print_robot_log fi } @@ -189,17 +212,17 @@ function print_robot_log() { while [[ ${count_pods} -eq 0 ]]; do echo "Waiting for pods to come up..." sleep 5 - count_pods=$(sudo microk8s kubectl get pods --output name | wc -l) + count_pods=$(sudo kubectl get pods --output name | wc -l) done - robotpod=$(sudo microk8s kubectl get po | grep policy-csit) + robotpod=$(sudo kubectl get po | grep policy-csit) podName=$(echo "$robotpod" | awk '{print $1}') echo "The robot tests will begin once the policy components {${READINESS_CONTAINERS[*]}} are up and running..." - sudo microk8s kubectl wait --for=jsonpath='{.status.phase}'=Running --timeout=18m pod/"$podName" + sudo kubectl wait --for=jsonpath='{.status.phase}'=Running --timeout=18m pod/"$podName" echo "Policy deployment status:" - sudo microk8s kubectl get po - sudo microk8s kubectl get all -A + sudo kubectl get po + sudo kubectl get all -A echo "Robot Test logs:" - sudo microk8s kubectl logs -f "$podName" + sudo kubectl logs -f "$podName" } function clone_models() { @@ -234,10 +257,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 ;; @@ -293,29 +318,30 @@ function set_project_config() { } function install_chartmuseum () { + echo "---------------------------------------------" echo "Installing Chartmuseum helm repository..." - sudo microk8s helm repo add chartmuseum-git https://chartmuseum.github.io/charts - sudo microk8s helm repo update - sudo microk8s helm install policy-chartmuseum chartmuseum-git/chartmuseum --set env.open.DISABLE_API=false --set service.type=NodePort --set service.nodePort=30208 - sudo microk8s helm plugin install https://github.com/chartmuseum/helm-push + sudo helm repo add chartmuseum-git https://chartmuseum.github.io/charts + sudo helm repo update + sudo helm install policy-chartmuseum chartmuseum-git/chartmuseum --set env.open.DISABLE_API=false --set service.type=NodePort --set service.nodePort=30208 + sudo helm plugin install https://github.com/chartmuseum/helm-push echo "---------------------------------------------" } function push_acelement_chart() { echo "Pushing acelement chart to the chartmuseum repo..." - sudo microk8s helm repo add policy-chartmuseum http://localhost:30208 + sudo helm repo add policy-chartmuseum http://localhost:30208 # download clamp repo git clone -b "${GERRIT_BRANCH}" --single-branch https://github.com/onap/policy-clamp.git "${WORKSPACE}"/csit/resources/tests/clamp ACELEMENT_CHART=${WORKSPACE}/csit/resources/tests/clamp/examples/src/main/resources/clamp/acm/acelement-helm/acelement - sudo microk8s helm cm-push $ACELEMENT_CHART policy-chartmuseum - sudo microk8s helm repo update + sudo helm cm-push $ACELEMENT_CHART policy-chartmuseum + sudo helm repo update rm -rf ${WORKSPACE}/csit/resources/tests/clamp/ echo "-------------------------------------------" } function get_pod_name() { - pods=$(microk8s kubectl get pods --no-headers -o custom-columns=':metadata.name' | grep $1) + pods=$(kubectl get pods --no-headers -o custom-columns=':metadata.name' | grep $1) read -rd '' -a pod_array <<< "$pods" echo "${pod_array[@]}" } @@ -402,10 +428,10 @@ if [ $OPERATION == "install" ]; then ${WORKSPACE}/compose/loaddockerimage.sh fi cd ${WORKSPACE}/helm || exit - sudo microk8s helm dependency build policy - sudo microk8s helm install csit-policy policy ${SET_VALUES} - sudo microk8s helm install prometheus prometheus - wait_for_pods_running default 480 ${READINESS_CONTAINERS[@]} + sudo helm dependency build policy + sudo helm install csit-policy policy ${SET_VALUES} + sudo helm install prometheus prometheus + wait_for_pods_running default 600 ${READINESS_CONTAINERS[@]} echo "Policy chart installation completed" echo "-------------------------------------------" fi diff --git a/csit/run-project-csit.sh b/csit/run-project-csit.sh index 678bfe2a..aa19b257 100755 --- a/csit/run-project-csit.sh +++ b/csit/run-project-csit.sh @@ -42,12 +42,19 @@ function docker_stats(){ function setup_clamp() { export ROBOT_FILES="policy-clamp-test.robot" - export TEST_ENV="docker" source "${WORKSPACE}"/compose/start-compose.sh policy-clamp-runtime-acm sleep 30 bash "${SCRIPTS}"/wait_for_rest.sh localhost "${ACM_PORT}" } +function setup_clamp_replica() { + export ROBOT_FILES="policy-clamp-test.robot" + export TEST_ENV="docker" + source "${WORKSPACE}"/compose/start-acm-replica.sh 2 + sleep 30 + bash "${SCRIPTS}"/wait_for_rest.sh localhost "${ACM_PORT}" +} + function setup_api() { export ROBOT_FILES="api-test.robot api-slas.robot" source "${WORKSPACE}"/compose/start-compose.sh api --grafana @@ -173,6 +180,10 @@ function set_project_config() { setup_clamp ;; + clamp-replica | policy-clamp-replica) + setup_clamp_replica + ;; + api | policy-api) setup_api ;; @@ -190,11 +201,11 @@ function set_project_config() { ;; apex-pdp-medium | policy-apex-pdp-medium) - setup_apex + setup_apex_medium ;; apex-pdp-large | policy-apex-pdp-large) - setup_apex + setup_apex_large ;; xacml-pdp | policy-xacml-pdp) 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. ################################################################# diff --git a/policy-db-migrator/pom.xml b/policy-db-migrator/pom.xml index c068eb33..776a1c71 100644 --- a/policy-db-migrator/pom.xml +++ b/policy-db-migrator/pom.xml @@ -24,7 +24,7 @@ <parent> <groupId>org.onap.policy.docker</groupId> <artifactId>docker</artifactId> - <version>4.0.0-SNAPSHOT</version> + <version>4.0.1-SNAPSHOT</version> </parent> <artifactId>policy-db-migrator</artifactId> diff --git a/policy-db-migrator/src/main/docker/Dockerfile b/policy-db-migrator/src/main/docker/Dockerfile index 06b7beae..8f632c87 100644 --- a/policy-db-migrator/src/main/docker/Dockerfile +++ b/policy-db-migrator/src/main/docker/Dockerfile @@ -19,7 +19,7 @@ # SPDX-License-Identifier: Apache-2.0 # ============LICENSE_END========================================================= #------------------------------------------------------------------------------- -FROM onap/policy-jre-alpine:3.1.4-SNAPSHOT +FROM onap/policy-jre-alpine:4.0.1-SNAPSHOT LABEL maintainer="Policy Team" LABEL org.opencontainers.image.title="Policy db-migrator" diff --git a/policy-jdk/alpine/pom.xml b/policy-jdk/alpine/pom.xml index ca310255..a6e47af0 100644 --- a/policy-jdk/alpine/pom.xml +++ b/policy-jdk/alpine/pom.xml @@ -27,7 +27,7 @@ <parent> <groupId>org.onap.policy.docker</groupId> <artifactId>policy-jdk</artifactId> - <version>4.0.0-SNAPSHOT</version> + <version>4.0.1-SNAPSHOT</version> </parent> <packaging>pom</packaging> diff --git a/policy-jdk/pom.xml b/policy-jdk/pom.xml index 410ec374..dced9b41 100644 --- a/policy-jdk/pom.xml +++ b/policy-jdk/pom.xml @@ -24,7 +24,7 @@ <parent> <groupId>org.onap.policy.docker</groupId> <artifactId>docker</artifactId> - <version>4.0.0-SNAPSHOT</version> + <version>4.0.1-SNAPSHOT</version> </parent> <artifactId>policy-jdk</artifactId> diff --git a/policy-jre/alpine/pom.xml b/policy-jre/alpine/pom.xml index 9d60d4b0..a1fb46d7 100644 --- a/policy-jre/alpine/pom.xml +++ b/policy-jre/alpine/pom.xml @@ -27,7 +27,7 @@ <parent> <groupId>org.onap.policy.docker</groupId> <artifactId>policy-jre</artifactId> - <version>4.0.0-SNAPSHOT</version> + <version>4.0.1-SNAPSHOT</version> </parent> <packaging>pom</packaging> diff --git a/policy-jre/pom.xml b/policy-jre/pom.xml index eeaff490..57f39c29 100644 --- a/policy-jre/pom.xml +++ b/policy-jre/pom.xml @@ -24,7 +24,7 @@ <parent> <groupId>org.onap.policy.docker</groupId> <artifactId>docker</artifactId> - <version>4.0.0-SNAPSHOT</version> + <version>4.0.1-SNAPSHOT</version> </parent> <artifactId>policy-jre</artifactId> diff --git a/policy-regression-tests/pom.xml b/policy-regression-tests/pom.xml index d0dcdade..ffc5176b 100644 --- a/policy-regression-tests/pom.xml +++ b/policy-regression-tests/pom.xml @@ -7,7 +7,7 @@ <parent> <groupId>org.onap.policy.docker</groupId> <artifactId>docker</artifactId> - <version>4.0.0-SNAPSHOT</version> + <version>4.0.1-SNAPSHOT</version> </parent> <groupId>org.onap.policy.regression</groupId> @@ -25,13 +25,13 @@ <parent> <groupId>org.onap.policy.parent</groupId> <artifactId>integration</artifactId> - <version>5.0.0-SNAPSHOT</version> + <version>5.0.1-SNAPSHOT</version> <relativePath /> </parent> <groupId>org.onap.policy.docker</groupId> <artifactId>docker</artifactId> - <version>4.0.0-SNAPSHOT</version> + <version>4.0.1-SNAPSHOT</version> <packaging>pom</packaging> <name>policy-docker</name> diff --git a/releases/4.0.0-container.yaml b/releases/4.0.0-container.yaml new file mode 100644 index 00000000..bab7d393 --- /dev/null +++ b/releases/4.0.0-container.yaml @@ -0,0 +1,12 @@ +distribution_type: 'container' +container_release_tag: '4.0.0' +project: 'policy-docker' +log_dir: 'policy-docker-maven-docker-stage-master/1047' +ref: 8e03046e2b07df88c2356c86116111d8fb22dc6a +containers: + - name: 'policy-jre-alpine' + version: '4.0.0-20240712T0754' + - name: 'policy-jdk-alpine' + version: '4.0.0-20240712T0754' + - name: 'policy-db-migrator' + version: '4.0.0-20240712T0754' diff --git a/version.properties b/version.properties index 19e0714b..bac52448 100644 --- a/version.properties +++ b/version.properties @@ -4,7 +4,7 @@ major=4 minor=0 -patch=0 +patch=1 base_version=${major}.${minor}.${patch} |