From: Jorge Hernandez Date: Tue, 26 Mar 2019 00:13:39 +0000 (-0500) Subject: replace pdpd image with control loop one X-Git-Tag: 4.0.0-ONAP~291 X-Git-Url: https://gerrit.onap.org/r/gitweb?p=oom.git;a=commitdiff_plain;h=aa5ba981074b96244790d92ecc13726bace647ce replace pdpd image with control loop one removes installation pieces from component initialization. cleans some misconfiguration. modified license headers Change-Id: I8c8558c8e8fa9c2b79d30a84cebd15d662a2af8b Issue-ID: POLICY-1613 Signed-off-by: Jorge Hernandez --- diff --git a/kubernetes/policy/charts/drools/resources/config/drools/settings.xml b/kubernetes/policy/charts/drools/resources/config/drools/settings.xml deleted file mode 100755 index 2057e94f24..0000000000 --- a/kubernetes/policy/charts/drools/resources/config/drools/settings.xml +++ /dev/null @@ -1,95 +0,0 @@ - - - - - - - - - policy-profile - - true - - - - - policy-nexus-snapshots - http://{{.Values.global.nexus.nameOverride}}:{{.Values.config.nexusPort}}/nexus/content/repositories/snapshots/ - - false - always - - - true - always - - - - - policy-nexus-releases - http://{{.Values.global.nexus.nameOverride}}:{{.Values.config.nexusPort}}/nexus/content/repositories/releases/ - - true - always - - - false - always - - - - - - - - - policy-profile - - - - - policy-nexus-snapshots - admin - admin123 - - - policy-nexus-releases - admin - admin123 - - - - diff --git a/kubernetes/policy/charts/drools/resources/config/log/drools/logback.xml b/kubernetes/policy/charts/drools/resources/config/log/drools/logback.xml deleted file mode 100644 index 4b058f1e4b..0000000000 --- a/kubernetes/policy/charts/drools/resources/config/log/drools/logback.xml +++ /dev/null @@ -1,103 +0,0 @@ - - - - - - - - - - - - - - - - ${logDir}/${errorLog}.log - - ${logDir}/${errorLog}.%i.log.zip - 1 - 5 - - - WARN - - - 15MB - - - ${errorPattern} - - - - - - - - - ${logDir}/${debugLog}.log - - ${logDir}/${debugLog}.%i.log.zip - 1 - 9 - - - 20MB - - - ${debugPattern} - - - - - - - - - ${logDir}/${networkLog}.log - - ${logDir}/${networkLog}.%i.log.zip - 1 - 9 - - - 15MB - - - ${networkPattern} - - - - - - - - - - - - - - - - - - - - - diff --git a/kubernetes/policy/charts/drools/resources/config/opt/policy/config/drools/apps-install.sh b/kubernetes/policy/charts/drools/resources/config/opt/policy/config/drools/apps-install.sh deleted file mode 100644 index 9fa52123e9..0000000000 --- a/kubernetes/policy/charts/drools/resources/config/opt/policy/config/drools/apps-install.sh +++ /dev/null @@ -1,125 +0,0 @@ -#!/bin/bash -# -# ============LICENSE_START======================================================= -# ONAP -# ================================================================================ -# Copyright (C) 2018 AT&T Intellectual Property. All rights reserved. -# Modifications Copyright © 2018 Amdocs, Bell Canada -# ================================================================================ -# 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========================================================= -# - -# ################################# -# Usage -# ################################# - -function usage { - echo - echo "Usage: $(basename $0) " - echo "Example: $(basename $0) controlloop 1.2.0 /opt/policy/config/drools" - echo -} - -# ################################# -# snapshot url computation -# ################################# - -function url_snapshot { - if [[ $DEBUG == y ]]; then - echo "-- ${FUNCNAME[0]} --" - set -x - fi - - APP_URL="${APP_URL}/snapshots/org/onap/policy/drools-applications/${APP_NAME}/packages/apps-${APP_NAME}/${APP_VERSION}" - - local APP_METADATA_URL="${APP_URL}/maven-metadata.xml" - local APP_SNAPSHOT_VERSION=$(curl --silent "${APP_METADATA_URL}" | grep -Po "(?<=).*(?=)" | sort -V | tail -1) - - if [[ -z ${APP_SNAPSHOT_VERSION} ]]; then - echo "ERROR: cannot compute SNAPSHOT version" - usage - exit 1 - fi - - APP_URL="${APP_URL}/apps-${APP_NAME}-${APP_SNAPSHOT_VERSION}.zip" -} - -# ################################# -# release url computation -# ################################# - -function url_release { - if [[ $DEBUG == y ]]; then - echo "-- ${FUNCNAME[0]} --" - set -x - fi - - APP_URL="${APP_URL}/releases/org/onap/policy/drools-applications/${APP_NAME}/packages/apps-${APP_NAME}/${APP_VERSION}/apps-${APP_NAME}-${APP_VERSION}.zip" -} - -# ################################# -# Main -# ################################# - -if [[ $DEBUG == y ]]; then - set -x -fi - -APP_NAME=$1 -if [[ -z ${APP_NAME} ]]; then - echo "ERROR: no APPLICATION NAME provided (ie. controlloop)" - usage - exit 1 -fi - -APP_VERSION=$2 -if [[ -z ${APP_VERSION} ]]; then - echo "ERROR: no APPLICATION VERSION provided" - usage - exit 1 -fi - -DOWNLOAD_DIR=$3 -if [[ -z ${DOWNLOAD_DIR} ]]; then - echo "ERROR: no DOWNLOAD DIRECTORY provided" - usage - exit 1 -fi - -if [[ ! -d ${DOWNLOAD_DIR} ]]; then - echo "ERROR: ${DOWNLOAD_DIR} is not a directory" - usage - exit 1 -fi - -APP_GROUP_ID="org.onap.policy.drools-applications.${APP_NAME}.packages" -APP_ARTIFACT_ID="apps-${APP_NAME}" -APP_BASE_URL="https://nexus.onap.org/content/repositories" - -APP_URL="${APP_BASE_URL}" - -if [[ ${APP_VERSION} =~ \-SNAPSHOT$ ]]; then - url_snapshot -else - url_release -fi - -wget "${APP_URL}" -O "${DOWNLOAD_DIR}"/apps-"${APP_NAME}".zip -if [[ $? != 0 ]]; then - echo "ERROR: cannot download ${DOWNLOAD_DIR}/apps-${APP_NAME}.zip" - exit 1 -fi - -echo "APP ${APP_NAME} stored at ${DOWNLOAD_DIR}/apps-${APP_NAME}.zip" -ls -l "${DOWNLOAD_DIR}"/apps-"${APP_NAME}".zip diff --git a/kubernetes/policy/charts/drools/resources/config/opt/policy/config/drools/drools-preinstall.sh b/kubernetes/policy/charts/drools/resources/config/opt/policy/config/drools/drools-preinstall.sh deleted file mode 100644 index a8de4fc2c1..0000000000 --- a/kubernetes/policy/charts/drools/resources/config/opt/policy/config/drools/drools-preinstall.sh +++ /dev/null @@ -1,53 +0,0 @@ -#!/bin/bash -# -# ============LICENSE_START======================================================= -# ONAP -# ================================================================================ -# Copyright (C) 2018 AT&T Intellectual Property. All rights reserved. -# Modifications Copyright © 2018 Amdocs, Bell Canada -# ================================================================================ -# 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========================================================= -# - -# ################################# -# Usage -# ################################# - -function usage { - echo - echo "Usage: $(basename $0)" - echo -} - -if [[ ${DEBUG} == y ]]; then - set -x -fi - -if [[ -z ${BUILD_VERSION} ]]; then - echo "no BUILD_VERSION available as environment variable"" - usage - exit 1 -fi - -if [[ -z ${POLICY_INSTALL} ]]; then - echo "no POLICY_INSTALL available as environment variable"" - usage - exit 2 -fi - -CONFIG_DIR=$(dirname "$0") -echo "invoking ${CONFIG_DIR}/apps-install.sh for controlloop ${BUILD_VERSION} at ${POLICY_INSTALL}" -export DEBUG=y -bash ${CONFIG_DIR}/apps-install.sh controlloop ${BUILD_VERSION} ${POLICY_INSTALL} -unzip -o ${POLICY_INSTALL}/app*.zip -d ${POLICY_INSTALL} diff --git a/kubernetes/policy/charts/drools/resources/config/opt/policy/config/drools/drools-tweaks.sh b/kubernetes/policy/charts/drools/resources/config/opt/policy/config/drools/drools-tweaks.sh deleted file mode 100644 index 5f504e2c65..0000000000 --- a/kubernetes/policy/charts/drools/resources/config/opt/policy/config/drools/drools-tweaks.sh +++ /dev/null @@ -1,71 +0,0 @@ -#! /bin/bash -xv - -# Copyright © 2017-2018 Amdocs, Bell Canada, AT&T -# -# 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. - - -"${POLICY_HOME}"/bin/features enable healthcheck -"${POLICY_HOME}"/bin/features enable distributed-locking - -"${POLICY_HOME}"/bin/db-migrator -s pooling -o upgrade - -# make sure the PDPD-CONFIGURATION anonymous topic is created -# so not to lose any configuration updates - -echo -echo "testing publish to PDPD-CONFIGURATION topic" -echo - -curl --silent --connect-timeout 15 -X POST --header "Content-Type: application/json" -d "{}" http://message-router:3904/events/PDPD-CONFIGURATION - -echo -echo "testing subscribe to PDPD-CONFIGURATION topic " -echo - -curl --silent --connect-timeout 15 -X GET http://message-router:3904/events/PDPD-CONFIGURATION/1/1?timeout=5000 - -# for resiliency/scalability scenarios, check to see -# if there's an amsterdam artifact already deployed -# by brmsgw. If so, update the amsterdam controller -# coordinates. In the future, a more sophisticated -# solution will be put in place, that will required -# coordination among policy components. - -echo -echo "checking if there are amsterdam policies already deployed .." -echo - -AMSTERDAM_VERSION=$(curl --silent --connect-timeout 20 -X GET "http://nexus:8081/nexus/service/local/artifact/maven/resolve?r=releases&g=org.onap.policy-engine.drools.amsterdam&a=policy-amsterdam-rules&v=RELEASE" | grep -Po "(?<=).*(?=)") - -if [[ -z ${AMSTERDAM_VERSION} ]]; then - echo "no amsterdam policies have been found .." - exit 0 -fi - -echo -echo "The latest deployed amsterdam artifact in nexus has version ${AMSTERDAM_VERSION}" -echo - -sed -i.INSTALL -e "s/^rules.artifactId=.*/rules.artifactId=policy-amsterdam-rules/g" \ - -e "s/^rules.groupId=.*/rules.groupId=org.onap.policy-engine.drools.amsterdam/g" \ - -e "s/^rules.version=.*/rules.version=${AMSTERDAM_VERSION}/g" "${POLICY_HOME}"/config/amsterdam-controller.properties - -echo -echo "amsterdam controller will be started brained with maven coordinates:" -echo - -grep "^rules" "${POLICY_HOME}"/config/amsterdam-controller.properties - -echo -echo diff --git a/kubernetes/policy/charts/drools/templates/configmap.yaml b/kubernetes/policy/charts/drools/templates/configmap.yaml index 16053d39e7..1f9503130c 100644 --- a/kubernetes/policy/charts/drools/templates/configmap.yaml +++ b/kubernetes/policy/charts/drools/templates/configmap.yaml @@ -1,5 +1,5 @@ # Copyright © 2017 Amdocs, Bell Canada -# Modifications Copyright © 2018 AT&T +# Modifications Copyright © 2018-2019 AT&T # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -13,14 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -apiVersion: v1 -kind: ConfigMap -metadata: - name: {{ include "common.fullname" . }}-settings-configmap - namespace: {{ include "common.namespace" . }} -data: -{{ tpl (.Files.Glob "resources/config/drools/settings.xml").AsConfig . | indent 2 }} ---- apiVersion: v1 kind: ConfigMap metadata: @@ -28,12 +20,3 @@ metadata: namespace: {{ include "common.namespace" . }} data: {{ tpl (.Files.Glob "resources/config/opt/policy/config/drools/*").AsConfig . | indent 2 }} ---- -apiVersion: v1 -kind: ConfigMap -metadata: - name: {{ include "common.fullname" . }}-log-configmap - namespace: {{ include "common.namespace" . }} -data: -{{ tpl (.Files.Glob "resources/config/log/drools/logback.xml").AsConfig . | indent 2 }} - diff --git a/kubernetes/policy/charts/drools/templates/statefulset.yaml b/kubernetes/policy/charts/drools/templates/statefulset.yaml index 4a7f8e2b1d..beacbabd06 100644 --- a/kubernetes/policy/charts/drools/templates/statefulset.yaml +++ b/kubernetes/policy/charts/drools/templates/statefulset.yaml @@ -1,5 +1,5 @@ # Copyright © 2017 Amdocs, Bell Canada -# Modifications Copyright © 2018 AT&T +# Modifications Copyright © 2018-2019 AT&T # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -59,10 +59,6 @@ spec: ports: - containerPort: {{ .Values.service.externalPort }} - containerPort: {{ .Values.service.externalPort2 }} - command: - - /bin/bash - - -c - - ./do-start.sh {{- if eq .Values.liveness.enabled true }} livenessProbe: tcpSocket: @@ -91,30 +87,8 @@ spec: - mountPath: /tmp/policy-install/config/base.conf name: drools-config subPath: base.conf - - mountPath: /tmp/policy-install/config/policy-management.conf - name: drools-config - subPath: policy-management.conf - - mountPath: /tmp/policy-install/config/drools-tweaks.sh - name: drools-config - subPath: drools-tweaks.sh - - mountPath: /tmp/policy-install/config/apps-install.sh - name: drools-config - subPath: apps-install.sh - - mountPath: /tmp/policy-install/config/drools-preinstall.sh - name: drools-config - subPath: drools-preinstall.sh - - mountPath: /usr/share/maven/conf/settings.xml - name: drools-settingsxml - subPath: settings.xml - mountPath: /var/log/onap name: policy-logs - - mountPath: /tmp/logback.xml - name: policy-logback - subPath: logback.xml - lifecycle: - postStart: - exec: - command: ["/bin/sh", "-c", "export LOG=wait_logback.log; touch $LOG; export SRC=/tmp/logback.xml; export DST=/opt/app/policy/config/; while [ ! -e $DST ]; do echo 'Waiting for $DST...' >> $LOG; sleep 5; done; sleep 2; /bin/cp -f $SRC $DST; echo 'Done' >> $LOG"] resources: {{ include "common.resources" . | indent 12 }} {{- if .Values.nodeSelector }} @@ -147,12 +121,6 @@ spec: emptyDir: {} - name: policy-data-filebeat emptyDir: {} - - name: policy-logback - configMap: - name: {{ include "common.fullname" . }}-log-configmap - - name: drools-settingsxml - configMap: - name: {{ include "common.fullname" . }}-settings-configmap - name: drools-config configMap: name: {{ include "common.fullname" . }}-configmap @@ -163,18 +131,6 @@ spec: - key: feature-pooling-dmaap.conf path: feature-pooling-dmaap.conf mode: 0755 - - key: policy-management.conf - path: policy-management.conf - mode: 0755 - - key: drools-tweaks.sh - path: drools-tweaks.sh - mode: 0755 - - key: apps-install.sh - path: apps-install.sh - mode: 0755 - - key: drools-preinstall.sh - path: drools-preinstall.sh - mode: 0755 - name: drools-secret secret: secretName: {{ include "common.fullname" . }}-secret diff --git a/kubernetes/policy/charts/drools/values.yaml b/kubernetes/policy/charts/drools/values.yaml index 1400e6c97e..fdb73e1485 100644 --- a/kubernetes/policy/charts/drools/values.yaml +++ b/kubernetes/policy/charts/drools/values.yaml @@ -1,5 +1,5 @@ # Copyright © 2017 Amdocs, Bell Canada -# Modifications Copyright © 2018 AT&T +# Modifications Copyright © 2018-2019 AT&T # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -28,7 +28,7 @@ global: ################################################################# # application image repository: nexus3.onap.org:10001 -image: onap/policy-drools:1.4-SNAPSHOT-latest +image: onap/policy-pdpd-cl:1.4-SNAPSHOT-latest pullPolicy: Always # flag to enable debugging - application support required