aboutsummaryrefslogtreecommitdiffstats
path: root/kubernetes
diff options
context:
space:
mode:
authorJorge Hernandez <jh1730@att.com>2018-04-10 19:35:13 -0500
committerJorge Hernandez <jh1730@att.com>2018-04-11 13:13:34 -0500
commit63ec8bc51a634deedd8e33919508676ecb126186 (patch)
tree96c156b6c0b8f6eeb622cc85c987f369b3aeab44 /kubernetes
parentc3c89fbd196923b950474a2fa986d63c3db33d1c (diff)
update drools container configuration
Change-Id: Iac0075c991c4e0a8e03c3f3b4bf440b704a089a8 Issue-ID: OOM-904 Signed-off-by: Jorge Hernandez <jh1730@att.com>
Diffstat (limited to 'kubernetes')
-rw-r--r--kubernetes/policy/charts/drools/resources/config/opt/policy/config/drools/apps-install.sh124
-rw-r--r--kubernetes/policy/charts/drools/resources/config/opt/policy/config/drools/base.conf6
-rw-r--r--kubernetes/policy/charts/drools/resources/config/opt/policy/config/drools/drools-tweaks.sh5
-rw-r--r--kubernetes/policy/charts/drools/templates/statefulset.yaml3
4 files changed, 133 insertions, 5 deletions
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
new file mode 100644
index 0000000000..72f7a74695
--- /dev/null
+++ b/kubernetes/policy/charts/drools/resources/config/opt/policy/config/drools/apps-install.sh
@@ -0,0 +1,124 @@
+#!/bin/bash
+#
+# ============LICENSE_START=======================================================
+# ONAP
+# ================================================================================
+# Copyright (C) 2018 AT&T Intellectual Property. 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.
+# 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) <application-name> <zipped-application-version> <download-directory>"
+ 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 "(?<=<value>).*(?=</value>)" | 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/base.conf b/kubernetes/policy/charts/drools/resources/config/opt/policy/config/drools/base.conf
index 127a483da5..a7ab3ee141 100644
--- a/kubernetes/policy/charts/drools/resources/config/opt/policy/config/drools/base.conf
+++ b/kubernetes/policy/charts/drools/resources/config/opt/policy/config/drools/base.conf
@@ -1,4 +1,4 @@
-# Copyright © 2017 Amdocs, Bell Canada, AT&T
+# 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.
@@ -15,9 +15,9 @@
# SYSTEM software configuration
POLICY_HOME=/opt/app/policy
-POLICY_LOGS=/var/log/ONAP/policy
+POLICY_LOGS=/var/log/onap/policy/pdpd
JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
-KEYSTORE_PASSWD=PolicyR0ck$
+KEYSTORE_PASSWD=Pol1cy_0nap
# Telemetry credentials
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
index 62822ac824..65ef7053cd 100644
--- 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
@@ -1,4 +1,6 @@
-# Copyright © 2017 Amdocs, Bell Canada, AT&T
+#! /bin/bash
+
+# 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.
@@ -12,6 +14,5 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-#! /bin/bash
${POLICY_HOME}/bin/features enable healthcheck
diff --git a/kubernetes/policy/charts/drools/templates/statefulset.yaml b/kubernetes/policy/charts/drools/templates/statefulset.yaml
index edff99a7cd..7a616d71e6 100644
--- a/kubernetes/policy/charts/drools/templates/statefulset.yaml
+++ b/kubernetes/policy/charts/drools/templates/statefulset.yaml
@@ -100,6 +100,9 @@ spec:
- 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: /usr/share/maven/conf/settings.xml
name: drools-settingsxml
subPath: settings.xml