summaryrefslogtreecommitdiffstats
path: root/cm-container
diff options
context:
space:
mode:
authorJack Lucas <jflucas@research.att.com>2018-08-22 19:29:40 +0000
committerJack Lucas <jflucas@research.att.com>2018-08-22 19:29:52 +0000
commit45cb899800a171a398238665009af73927969db0 (patch)
treeebcf1f9c6622bfe29bf36a4591475f977a622468 /cm-container
parentc6b1a01dcaa092662ce517b3aaeb2eec3443818d (diff)
Update CM to 18.7.23
Issue-ID: DCAEGEN2-619 Change-Id: I8140061d9358a99f2e13bb78facb15dbc77229a7 Signed-off-by: Jack Lucas <jflucas@research.att.com>
Diffstat (limited to 'cm-container')
-rw-r--r--cm-container/Dockerfile-template11
-rw-r--r--cm-container/dcae-cleanup.sh62
-rwxr-xr-xcm-container/get-type-files.sh2
-rw-r--r--cm-container/pom.xml2
4 files changed, 72 insertions, 5 deletions
diff --git a/cm-container/Dockerfile-template b/cm-container/Dockerfile-template
index 2c67d51..5c052a0 100644
--- a/cm-container/Dockerfile-template
+++ b/cm-container/Dockerfile-template
@@ -17,7 +17,7 @@
# ============LICENSE_END=========================================================
#
# ECOMP is a trademark and service mark of AT&T Intellectual Property.
-FROM cloudifyplatform/community:cloudify-manager-18.2.28
+FROM cloudifyplatform/community:18.7.23
MAINTAINER maintainer
ENV TYPE_REPO {{ ONAPTEMPLATE_RAWREPOURL_org_onap_dcaegen2_platform_plugins_releases }}
@@ -25,12 +25,13 @@ ENV CCSDK_REPO {{ ONAPTEMPLATE_RAWREPOURL_org_onap_ccsdk_platform_plugins_releas
# Store type files locally
RUN mkdir scripts
-COPY get-type-files.sh scripts
+COPY get-type-files.sh dcae-cleanup.sh scripts/
# Load our type files and the Cloudify 3.4 type files
RUN scripts/get-type-files.sh ${TYPE_REPO} ${CCSDK_REPO}\
&& mkdir /opt/manager/resources/spec/cloudify/3.4\
&& curl -Ss https://cloudify.co/spec/cloudify/3.4/types.yaml > /opt/manager/resources/spec/cloudify/3.4/types.yaml\
- && chown -R cfyuser:cfyuser /opt/manager/resources/spec/cloudify/3.4
+ && chown -R cfyuser:cfyuser /opt/manager/resources/spec/cloudify/3.4\
+ && chmod +x scripts/*.sh
# Create mount point for CM config file
RUN mkdir -p /opt/onap && chown cfyuser:cfyuser /opt/onap
@@ -38,6 +39,10 @@ RUN mkdir -p /opt/onap && chown cfyuser:cfyuser /opt/onap
# Install python development-related packages
RUN yum install -y gcc python-devel python-virtualenv python-pip
+# Install jq (used for cleanup--parsing output of CM API call)
+RUN curl -Ss -L "https://github.com/stedolan/jq/releases/download/jq-1.5/jq-linux64" > /bin/jq \
+&& chmod +x /bin/jq
+
# Set up virtualenv and install Cloudify CLI 4.2
RUN pip install --upgrade pip==9.0.3 \
&& virtualenv cfy42 \
diff --git a/cm-container/dcae-cleanup.sh b/cm-container/dcae-cleanup.sh
new file mode 100644
index 0000000..a072dd4
--- /dev/null
+++ b/cm-container/dcae-cleanup.sh
@@ -0,0 +1,62 @@
+#!/bin/bash
+# ================================================================================
+# 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=========================================================
+
+# Clean up DCAE during ONAP uninstall
+#
+# When helm delete is being used to uninstall all of ONAP, helm does
+# not know about k8s entities that were created by Cloudify Manager.
+# This script--intended to run as a preUninstall hook when Cloudify Manager itself
+# is undeleted--uses Cloudify to clean up the k8s entities deployed by Cloudify.
+#
+# Rather than using the 'cfy uninstall' command to run a full 'uninstall' workflow
+# against the deployments, this script uses 'cfy executions' to run a 'stop'
+# stop operation against the nodes in each deployment. The reason for this is that,
+# at the time this script run, we have no# guarantees about what other components are
+# still running. In particular, a full 'uninstall' will cause API requests to Consul
+# and will raise RecoverableErrors if it cannot connect. RecoverableErrors send Cloudify
+# into a long retry loop. Instead, we invoke only the 'stop'
+# operation on each node, and the 'stop' operation uses the k8s API (guaranteed to be
+# present) but not the Consul API.
+#
+# Note that the script finds all of the deployments known to Cloudify and runs the
+# 'stop' operation on every node
+# The result of the script is that all of the k8s entities deployed by Cloudify
+# should be destroyed. Cloudify Manager itself isn't fully cleaned up (the deployments and
+# blueprints are left), but that doesn't matter because Cloudify Manager will be
+# destroyed by Helm.
+
+
+set -x
+set +e
+
+# Get the CM admin password from the config file
+# Brittle, but the container is built with an unchanging version of CM,
+# so no real risk of a breaking change
+CMPASS=$(grep 'admin_password:' /etc/cloudify/config.yaml | cut -d ':' -f2 | tr -d ' ')
+TYPENAMES='[dcae.nodes.ContainerizedServiceComponent,dcae.nodes.ContainerizedServiceComponent,dcae.nodes.ContainerizedServiceComponent,dcae.nodes.ContainerizedServiceComponent]'
+
+# Uninstall components managed by Cloudify
+# Get the list of deployment ids known to Cloudify via curl to Cloudify API.
+# The output of the curl is JSON that looks like {"items" :[{"id": "config_binding_service"}, ...], "metadata" :{...}}
+#
+# jq gives us the just the deployment ids (e.g., "config_binding_service"), one per line
+#
+# xargs -I lets us run the cfy executions command once for each deployment id extracted by jq
+
+curl -Ss --user admin:$CMPASS -H "Tenant: default_tenant" "localhost/api/v3.1/deployments?_include=id" \
+| /bin/jq .items[].id \
+| xargs -I % sh -c 'cfy executions start -d % -p type_names=${TYPENAMES} -p operation=cloudify.interfaces.lifecycle.stop execute_operation' \ No newline at end of file
diff --git a/cm-container/get-type-files.sh b/cm-container/get-type-files.sh
index 06d8e47..dd848e9 100755
--- a/cm-container/get-type-files.sh
+++ b/cm-container/get-type-files.sh
@@ -31,7 +31,7 @@ DCAETYPEFILES=\
"\
/dcaepolicyplugin/2.3.0/dcaepolicyplugin_types.yaml \
/relationshipplugin/1.0.0/relationshipplugin_types.yaml \
-/k8splugin/1.1.0/k8splugin_types.yaml \
+/k8splugin/1.4.2/k8splugin_types.yaml \
"
diff --git a/cm-container/pom.xml b/cm-container/pom.xml
index 5abfe68..f8e78f1 100644
--- a/cm-container/pom.xml
+++ b/cm-container/pom.xml
@@ -27,7 +27,7 @@ limitations under the License.
<groupId>org.onap.dcaegen2.deployments</groupId>
<artifactId>cm-container</artifactId>
<name>dcaegen2-deployments-cm-container</name>
- <version>1.3.0</version>
+ <version>1.4.0</version>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>