From 16a554c60549b0cb970c5f57894801932d2a0e8e Mon Sep 17 00:00:00 2001 From: Jack Lucas Date: Fri, 23 Mar 2018 19:30:49 -0400 Subject: Add CM container build Change-Id: I13150c229ecd3871c889dbfa979522be2360249d Issue-ID: DCAEGEN2-416 Signed-off-by: Jack Lucas --- cm-container/Dockerfile-template | 34 ++++++++ cm-container/README.md | 33 ++++++++ cm-container/get-type-files.sh | 47 +++++++++++ cm-container/pom.xml | 172 +++++++++++++++++++++++++++++++++++++++ cm-container/test-expand.sh | 2 + 5 files changed, 288 insertions(+) create mode 100644 cm-container/Dockerfile-template create mode 100644 cm-container/README.md create mode 100755 cm-container/get-type-files.sh create mode 100644 cm-container/pom.xml create mode 100755 cm-container/test-expand.sh (limited to 'cm-container') diff --git a/cm-container/Dockerfile-template b/cm-container/Dockerfile-template new file mode 100644 index 0000000..7d97a24 --- /dev/null +++ b/cm-container/Dockerfile-template @@ -0,0 +1,34 @@ +# ============LICENSE_START======================================================= +# org.onap.dcae +# ================================================================================ +# 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========================================================= +# +# ECOMP is a trademark and service mark of AT&T Intellectual Property. +FROM cloudifyplatform/community:cloudify-manager-18.2.28 +MAINTAINER maintainer + +ENV TYPE_REPO {{ ONAPTEMPLATE_RAWREPOURL_org_onap_dcaegen2_platform_plugins_releases }} +# Store type files locally +RUN pwd +RUN mkdir scripts +COPY get-type-files.sh scripts +# Load our type files and the Cloudify 3.4 type files +RUN scripts/get-type-files.sh ${TYPE_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 +# Create mount point for CM config file +RUN mkdir -p /opt/onap && chown cfyuser:cfyuser /opt/onap diff --git a/cm-container/README.md b/cm-container/README.md new file mode 100644 index 0000000..a29423d --- /dev/null +++ b/cm-container/README.md @@ -0,0 +1,33 @@ +# Cloudify Manager Container Builder +## Purpose +The artifacts in this directory build a Docker image based on the +public image from Cloudify (`cloudifyplatform/community`). The +image has the Cloudify Manager software from the base image +and adds our types files. It edits `/etc/cloudify/config.yaml` +to configure the import resolver to use our local type files instead +of fetching them over the Internet. It adds +Cloudify 3.4 type files that are still used in some plugins +and blueprints. Finally, it sets up the `/opt/onap` mount point +for our config files. + +## Running the Container +The container is intended to be launched via a Helm chart as part +of the ONAP deployment process, guided by OOM. It can be run directly +into a native Docker environment, using: +``` +docker run --name cfy-mgr -d --restart unless-stopped \ + -v /sys/fs/cgroup:/sys/fs/cgroup:ro \ + -p :80 \ + --tmpfs /run \ + --tmpfs /run/lock \ + --security-opt seccomp:unconfined + --cap-add SYS_ADMIN \ + -v :/etc/cloudify/.kube/config + -v :/opt/onap/config.txt + +``` +In a Kubernetes environment, we expect that the and the + mounts would be Kubernetes ConfigMaps. + +We also expect that in a Kubernetes environment the external port mapping would not be +needed. diff --git a/cm-container/get-type-files.sh b/cm-container/get-type-files.sh new file mode 100755 index 0000000..038e8e0 --- /dev/null +++ b/cm-container/get-type-files.sh @@ -0,0 +1,47 @@ +#!/bin/bash +# ============LICENSE_START======================================================= +# org.onap.dcae +# ================================================================================ +# 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========================================================= +# +# ECOMP is a trademark and service mark of AT&T Intellectual Property. + +# Pull type files from repos +# Set up the CM import resolver +# $1 is the repo URL +# +set -x +DEST=/opt/manager/resources/onapspec +ONAPTYPEFILES=\ +"\ +/dcaepolicyplugin/2.0.0/dcaepolicyplugin_types.yaml \ +/relationshipplugin/1.0.0/relationshipplugin_types.yaml \ +/k8splugin/1.0.0/k8splugin_types.yaml \ + +" +mkdir ${DEST} +for typefile in ${ONAPTYPEFILES} +do + mkdir -p ${DEST}/$(dirname ${typefile}) + curl -Ss $1/${typefile} >> ${DEST}/${typefile} +done +chown cfyuser:cfyuser ${DEST} +# Add our local type file store to CM import resolver configuration +TYPE_RULE="{${TYPE_REPO}: file://${DEST}}" +# This sed re is 'brittle' but we can be sure the config.yaml file +# won't change as long as we do not change the source Docker image for CM +sed -i -e "s# rules:# rules:\n - ${TYPE_RULE}#" /etc/cloudify/config.yaml +chown cfyuser:cfyuser /etc/cloudify/config.yaml diff --git a/cm-container/pom.xml b/cm-container/pom.xml new file mode 100644 index 0000000..35b2d66 --- /dev/null +++ b/cm-container/pom.xml @@ -0,0 +1,172 @@ + + + + 4.0.0 + + org.onap.dcaegen2.deployments + deployments + 1.2.0-SNAPSHOT + + org.onap.dcaegen2.deployments + cm-container + dcaegen2-deployments-cm-container + 1.0.0 + http://maven.apache.org + + UTF-8 + true + . + + + + + py + Python + **/*.py + + + + + ${project.artifactId}-${project.version} + + + + + org.codehaus.mojo + exec-maven-plugin + 1.2.1 + + + clean phase script + clean + + exec + + + + ${project.artifactId} + clean + + + + + generate-sources script + generate-sources + + exec + + + + ${project.artifactId} + generate-sources + + + + + compile script + compile + + exec + + + + ${project.artifactId} + compile + + + + + package script + package + + exec + + + + ${project.artifactId} + package + + + + + test script + test + + exec + + + + ${project.artifactId} + test + + + + + install script + install + + exec + + + + ${project.artifactId} + install + + + + + deploy script + deploy + + exec + + + + ${project.artifactId} + deploy + + + + + + + + diff --git a/cm-container/test-expand.sh b/cm-container/test-expand.sh new file mode 100755 index 0000000..0d5e8e5 --- /dev/null +++ b/cm-container/test-expand.sh @@ -0,0 +1,2 @@ +#!/bin/bash +sed -e 's#{{ ONAPTEMPLATE_RAWREPOURL_org_onap_dcaegen2_platform_plugins_releases }}#https://nexus.onap.org/content/sites/raw/org.onap.dcaegen2.platform.plugins/R2#g' Dockerfile-template > Dockerfile -- cgit 1.2.3-korg