From: FrancescoFioraEst Date: Mon, 26 Jan 2026 13:28:13 +0000 (+0000) Subject: Remove duplication of Spring config files in participant-Kubernetes X-Git-Url: https://gerrit.onap.org/r/gitweb?a=commitdiff_plain;h=a7c517e1267b019ce6596647653722db1d2041bd;p=policy%2Fdocker.git Remove duplication of Spring config files in participant-Kubernetes Issue-ID: POLICY-5533 Change-Id: I6fe1f7e7803fab3480c5798d6af0c0da822c7dc6 Signed-off-by: FrancescoFioraEst --- 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 deleted file mode 100644 index d90333cb..00000000 --- a/helm/policy/components/policy-clamp-ac-k8s-ppnt/resources/config/KubernetesParticipantParameters.yaml +++ /dev/null @@ -1,126 +0,0 @@ -# ============LICENSE_START======================================================= -# Copyright (C) 2022,2024-2025 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========================================================= - -spring: - application: - name: k8s-ppnt - autoconfigure: - exclude: > - org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration, - org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration, - org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration - security: - user: - name: ${RESTSERVER_USER} - password: ${RESTSERVER_PASSWORD} - -security: - enable-csrf: false - -participant: - localChartDirectory: /home/policy/local-charts - infoFileName: CHART_INFO.json - intermediaryParameters: - topics: - operationTopic: policy-acruntime-participant - syncTopic: acm-ppnt-sync - reportingTimeIntervalMs: 120000 - description: Participant Description - participantId: 101c62b3-8918-41b9-a747-d21eb79c6c02 - clampAutomationCompositionTopics: - topicSources: - - - topic: ${participant.intermediaryParameters.topics.operationTopic} - servers: - - "{{ .Values.global.kafkaServer }}:9092" - topicCommInfrastructure: kafka - fetchTimeout: 15000 - useHttps: false - allowTracing: {{ include "policy-clamp-ac-k8s-ppnt.jaeger-enabled" . }} - additionalProps: - group.id: policy-clamp-ac-k8s-ppnt - - - topic: ${participant.intermediaryParameters.topics.syncTopic} - servers: - - "{{ .Values.global.kafkaServer }}:9092" - topicCommInfrastructure: kafka - fetchTimeout: 15000 - useHttps: false - allowTracing: {{ include "policy-clamp-ac-k8s-ppnt.jaeger-enabled" . }} - topicSinks: - - - topic: ${participant.intermediaryParameters.topics.operationTopic} - servers: - - "{{ .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: / - exposure: - include: health, metrics, prometheus - -server: - # Configuration of the HTTP/REST server. The parameters are defined and handled by the springboot framework. - # See springboot documentation. - port: 8083 - servlet: - context-path: /onap/k8sparticipant - ssl: - enabled: false - - -logging: - # Configuration of logging - level: - ROOT: INFO - org.springframework: ERROR - org.springframework.data: ERROR - org.springframework.web.reactive.function.client.ExchangeFunctions: ERROR - org.onap.policy.clamp.controlloop.participant.kubernetes: INFO - - file: - name: /var/log/onap/policy/clamp/application.log - -chart: - api: - 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 deleted file mode 100755 index ce08684d..00000000 --- a/helm/policy/components/policy-clamp-ac-k8s-ppnt/resources/config/kubernetes-participant.sh +++ /dev/null @@ -1,60 +0,0 @@ -#!/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/resources/config/logback.xml b/helm/policy/components/policy-clamp-ac-k8s-ppnt/resources/config/logback.xml deleted file mode 100644 index 09e45832..00000000 --- a/helm/policy/components/policy-clamp-ac-k8s-ppnt/resources/config/logback.xml +++ /dev/null @@ -1,103 +0,0 @@ - - - - - - /var/log/onap/policy/k8s-participant/error.log - - /var/log/onap/policy/k8s-participant/error.%d{yyyy-MM-dd}.%i.log.zip - - 50MB - 30 - 10GB - - - WARN - - - [%d{yyyy-MM-dd'T'HH:mm:ss.SSS+00:00, UTC}|%level|%logger{0}|%thread] %msg%n - - - - - - - - - /var/log/onap/policy/k8s-participant/debug.log - - /var/log/onap/policy/k8s-participant/debug.%d{yyyy-MM-dd}.%i.log.zip - - 50MB - 30 - 10GB - - - [%d{yyyy-MM-dd'T'HH:mm:ss.SSS+00:00, UTC}|%level|%logger{0}|%thread] %msg%n - - - - - - - - - /var/log/onap/policy/k8s-participant/network.log - - /var/log/onap/policy/k8s-participant/network.%d{yyyy-MM-dd}.%i.log.zip - - 50MB - 30 - 10GB - - - [%d{yyyy-MM-dd'T'HH:mm:ss.SSS+00:00, UTC}|%t]%m%n - - - - - - - - - - [%d{yyyy-MM-dd'T'HH:mm:ss.SSS+00:00, UTC}|%level|%logger{0}|%thread] %msg%n - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/helm/policy/components/policy-clamp-ac-k8s-ppnt/templates/configmap.yaml b/helm/policy/components/policy-clamp-ac-k8s-ppnt/templates/configmap.yaml index 6df0b636..d991ec52 100644 --- a/helm/policy/components/policy-clamp-ac-k8s-ppnt/templates/configmap.yaml +++ b/helm/policy/components/policy-clamp-ac-k8s-ppnt/templates/configmap.yaml @@ -1,6 +1,6 @@ {{/* # ============LICENSE_START======================================================= -# Copyright (C) 2022 Nordix Foundation. All rights reserved. +# Copyright (C) 2022,2026 OpenInfra Foundation Europe. 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. @@ -27,10 +27,3 @@ metadata: app: {{ .Chart.Name }} chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} heritage: Helm -data: -{{ tpl (.Files.Glob "resources/config/*.{xml,yaml}").AsConfig . | indent 2 }} -{{- if .Values.repoList }} -{{ tpl (.Files.Glob "resources/config/KubernetesParticipantParameters.yaml").AsConfig . | indent 2 }} -{{ toYaml .Values.repoList | indent 4 }} -{{ tpl (.Files.Glob "resources/config/*.{json,xml,sh}").AsConfig . | indent 2 }} -{{- 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 e0f7a52e..85e1d27e 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-2024 Nordix Foundation. +# Copyright (C) 2022-2024,2026 OpenInfra Foundation Europe. 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. @@ -44,43 +44,45 @@ spec: name: {{ .Chart.Name }} spec: - initContainers: - - command: - - sh - args: - - -c - - "cd /config-input && for PFILE in `ls -1`; do envsubst <${PFILE} >/config/${PFILE}; done" - env: - - name: RESTSERVER_USER - valueFrom: - secretKeyRef: - name: {{ .Chart.Name }}-restserver-secret - key: login - - - name: RESTSERVER_PASSWORD - valueFrom: - secretKeyRef: - name: {{ .Chart.Name }}-restserver-secret - key: password - - - volumeMounts: - - mountPath: /config-input - name: ac-k8s-ppnt-config - - mountPath: /config - name: ac-k8s-ppnt-config-processed - image: docker.io/dibi/envsubst:1 - imagePullPolicy: {{ .Values.pullPolicy }} - name: {{ .Chart.Name }}-update-config containers: - name: {{ .Chart.Name }} image: {{ .Values.global.repository }}/{{ .Values.global.image.k8sparticipant }} imagePullPolicy: {{ .Values.global.pullPolicy }} - command: ["/opt/app/policy/clamp/bin/kubernetes-participant.sh"] - args: ["/opt/app/policy/clamp/etc/mounted/KubernetesParticipantParameters.yaml"] + env: + - name: HTTP_USER + valueFrom: + secretKeyRef: + name: {{ .Chart.Name }}-restserver-secret + key: login + - name: HTTP_PASSWORD + valueFrom: + secretKeyRef: + name: {{ .Chart.Name }}-restserver-secret + key: password + - name: SERVER_PORT + value: "8083" + - name: topicCommInfrastructure + value: kafka + - name: kafkaServer + value: "{{ .Values.global.kafkaServer }}:9092" + - name: HELM_REPOS + value: {{ .Values.repoList.helm.repos | quote }} + - name: HELM_PROTOCOLS + value: {{ .Values.repoList.helm.protocols }} {{- $jaegerEnabled := tpl "policy-clamp-ac-k8s-ppnt.jaeger-enabled" . | trimSuffix "\n" -}} {{- if $jaegerEnabled }} - env: + - name: allowTracing + value: "true" + - name: jaegerProducerType + value: {{ .Values.jaeger.producer.type | quote }} + - name: jaegerSamplingProbability + value: {{ .Values.jaeger.sampling.probability | quote }} + - name: tracingExporterEndpoint + value: {{ .Values.jaeger.collector.host }}:{{ include "policy-clamp-ac-k8s-ppnt.exporter-port" . }} + - name: tracingExporterProtocol + value: {{ .Values.jaeger.collector.protocol }} + - name: tracingSamplerEndpoint + value: "{{ .Values.jaeger.collector.host }}:{{ .Values.jaeger.collector.portJaegerGrpc }}" - name: OTEL_SERVICE_NAME value: {{ .Values.applicationName }} - name: OTEL_EXPORTER_OTLP_PROTOCOL @@ -89,10 +91,12 @@ spec: 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" .) }} + - name: OTEL_JAVA_GLOBAL_AUTOCONFIGURE_ENABLED + value: "true" {{- end }} ports: - containerPort: 8083 - name: http-api + name: k8s-api # disable liveness probe when breakpoints set in debugger # so K8s doesn't restart unresponsive container {{- if eq .Values.liveness.enabled true }} @@ -111,11 +115,6 @@ spec: - mountPath: /etc/localtime name: localtime 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 }} @@ -131,12 +130,5 @@ spec: - name: localtime hostPath: path: /etc/localtime - - name: ac-k8s-ppnt-config - configMap: - name: {{ .Chart.Name }}-configmap - defaultMode: 0755 - - name: ac-k8s-ppnt-config-processed - emptyDir: - medium: Memory imagePullSecrets: - name: default-docker-registry-key" 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 dfbda305..18f6c5ed 100644 --- a/helm/policy/components/policy-clamp-ac-k8s-ppnt/values.yaml +++ b/helm/policy/components/policy-clamp-ac-k8s-ppnt/values.yaml @@ -1,5 +1,5 @@ # ============LICENSE_START======================================================= -# Copyright (C) 2022,2024 Nordix Foundation. +# Copyright (C) 2022,2024,2026 OpenInfra Foundation Europe. 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. @@ -44,20 +44,20 @@ liveness: # necessary to disable liveness probe when setting breakpoints # in debugger so K8s doesn't restart unresponsive container enabled: true - port: http-api + port: k8s-api readiness: initialDelaySeconds: 50 periodSeconds: 10 failureThreshold: 10 - port: http-api + port: k8s-api service: type: NodePort name: policy-clamp-ac-k8s-ppnt useNodePortExt: true ports: - name: http-api + name: k8s-api port: 8083 nodePort: 30443 @@ -83,21 +83,8 @@ serviceAccount: # Update the config here for permitting repositories and protocols repoList: helm: - repos: - - - repoName: kong - address: https://charts.konghq.com - - - repoName: bitnami - address: https://charts.bitnami.com/bitnami - - - - repoName: policy-chartmuseum - address: http://policy-chartmuseum:8080 - - protocols: - - http - - https + repos: "[{'repoName':'kong','address':'https://charts.konghq.com'},{'repoName':'bitnami','address':'https://charts.bitnami.com/bitnami'},{'repoName':'policy-chartmuseum','address':'http://policy-chartmuseum:8080'}]" + protocols: "http,https" jaeger: service: @@ -106,7 +93,7 @@ jaeger: sampling: probability: "1.0" producer: - type: B3,W3C,B3_MULTI + type: "[B3,W3C,B3_MULTI]" collector: protocol: grpc host: "http://jaeger" @@ -114,4 +101,4 @@ jaeger: portOtlpHttp: 4318 portJaegerGrpc: 14250 -applicationName: k8s-ppnt \ No newline at end of file +applicationName: k8s-ppnt