From 3ab001798590b8cf349df6ab51561888909e6814 Mon Sep 17 00:00:00 2001 From: Jorge Hernandez Date: Wed, 23 May 2018 13:59:50 -0500 Subject: get latest amsterdam maven coordinates from nexus - latest coordinates will be set to the controller for failure and scale out case so to not require manual operation. - reduce the replicat count to 2 to make life easier to testers, and since should be expected to support enough performance testing. - fix aai so urls. Change-Id: I5d0d6d6c1c8242944d9d56601c5d463e790df900 Issue-ID: OOM-1104 Signed-off-by: Jorge Hernandez --- .../config/opt/policy/config/drools/base.conf | 4 +- .../opt/policy/config/drools/drools-tweaks.sh | 60 ++++++++++++++++++++-- .../charts/drools/templates/statefulset.yaml | 4 -- kubernetes/policy/charts/drools/values.yaml | 3 +- 4 files changed, 58 insertions(+), 13 deletions(-) (limited to 'kubernetes') 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 9202b0ada7..1236176514 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 @@ -78,13 +78,13 @@ DMAAP_SERVERS=message-router # AAI -AAI_URL=https://aai.api.simpledemo.openecomp.org:8443 +AAI_URL=https://aai.{{.Release.Namespace}}:8443 AAI_USERNAME=POLICY AAI_PASSWORD=POLICY # MSO -SO_URL=http://mso:8080/ecomp/mso/infra +SO_URL=http://so.{{.Release.Namespace}}:8080/ecomp/mso/infra SO_USERNAME=InfraPortalClient SO_PASSWORD=password1$ 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 54700078c5..218cd8aead 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,4 @@ -#! /bin/bash +#! /bin/bash -xv # Copyright © 2017-2018 Amdocs, Bell Canada, AT&T # @@ -15,8 +15,58 @@ # limitations under the License. -${POLICY_HOME}/bin/features enable healthcheck -${POLICY_HOME}/bin/features enable pooling-dmaap -${POLICY_HOME}/bin/features enable distributed-locking +"${POLICY_HOME}"/bin/features enable healthcheck +"${POLICY_HOME}"/bin/features enable pooling-dmaap +"${POLICY_HOME}"/bin/features enable distributed-locking -${POLICY_HOME}/bin/db-migrator -s pooling -o upgrade +"${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 "creating PDPD-CONFIGURATION topic" +echo + +curl --silent --connect-timeout 60 -X POST --header "Content-Type: application/json" -d "{}" http://message-router:3904/events/PDPD-CONFIGURATION + +echo +echo "removing PDPD-CONFIGURATION topic dummy message" +echo + +curl --silent --connect-timeout 60 -X GET http://message-router:3904/events/PDPD-CONFIGURATION/1/1?timeout=15000 + +# 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 60 -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/statefulset.yaml b/kubernetes/policy/charts/drools/templates/statefulset.yaml index 68b415e989..71844f108d 100644 --- a/kubernetes/policy/charts/drools/templates/statefulset.yaml +++ b/kubernetes/policy/charts/drools/templates/statefulset.yaml @@ -51,10 +51,6 @@ spec: image: "{{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}" imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} name: {{ include "common.name" . }}-readiness - hostAliases: - - ip: "{{ .Values.config.aaiServiceClusterIp }}" - hostnames: - - "aai.api.simpledemo.openecomp.org" containers: - name: {{ include "common.name" . }} image: "{{ include "common.repository" . }}/{{ .Values.image }}" diff --git a/kubernetes/policy/charts/drools/values.yaml b/kubernetes/policy/charts/drools/values.yaml index 9ce804032e..ca62f2b01d 100644 --- a/kubernetes/policy/charts/drools/values.yaml +++ b/kubernetes/policy/charts/drools/values.yaml @@ -36,10 +36,9 @@ debugEnabled: false # application configuration config: nexusPort: 8081 - aaiServiceClusterIp: 10.43.255.254 # default number of instances -replicaCount: 4 +replicaCount: 2 nodeSelector: {} -- cgit 1.2.3-korg