From 01d6019fca028906a5d4674a3a785b7851bb75e3 Mon Sep 17 00:00:00 2001 From: Jack Lucas Date: Wed, 17 Jun 2020 17:11:17 -0400 Subject: Remove plugin uploads from bootstrap container Update other blueprints Update blueprints for components loaded at boot time Move Consul service registrations out of bootstrap script (use Consul init container in OOM chart instead) Issue-ID: DCAEGEN2-1789 Issue-ID: DCAEGEN2-2237 Issue-ID: DCAEGEN2-2236 Signed-off-by: Jack Lucas Change-Id: I3532d21be3c520a63ca6176dc2c085665db0add8 --- scripts/bootstrap.sh | 66 ++---------------------------------------------- scripts/load-plugins.sh | 67 ------------------------------------------------- scripts/uninstall.sh | 4 --- 3 files changed, 2 insertions(+), 135 deletions(-) delete mode 100755 scripts/load-plugins.sh (limited to 'scripts') diff --git a/scripts/bootstrap.sh b/scripts/bootstrap.sh index 7fa339a..ff953cf 100755 --- a/scripts/bootstrap.sh +++ b/scripts/bootstrap.sh @@ -22,7 +22,6 @@ # ONAP common Kubernetes namespace in ONAP_NAMESPACE environment variable # If DCAE components are deployed in a separate Kubernetes namespace, that namespace in DCAE_NAMESPACE variable. # Consul address with port in CONSUL variable -# Plugin wagon files in /wagons # Blueprints for components to be installed in /blueprints # Input files for components to be installed in /inputs # Configuration JSON files that need to be loaded into Consul in /dcae-configs @@ -119,18 +118,6 @@ function deploy { fi } -# Install plugin if it's not already installed -# $1 -- path to wagon file for plugin -function install_plugin { - ARCHIVE=$(basename $1) - # See if it's already installed - if cm_hasany "plugins?archive_name=$ARCHIVE" - then - echo plugin $1 already installed on ${CMADDR} - else - cfy plugin upload $1 - fi -} ### END FUNCTION DEFINTIONS ### @@ -141,35 +128,14 @@ trap keep_running ERR set -e -# Consul service registration data -CBS_REG='{"ID": "dcae-cbs0", "Name": "config_binding_service", "Address": "config-binding-service", "Port": 10000}' -CBS_REG1='{"ID": "dcae-cbs1", "Name": "config-binding-service", "Address": "config-binding-service", "Port": 10000}' - # Set up profile to access Cloudify Manager cfy profiles use -u admin -t default_tenant -p "${CMPASS}" ${CFYTLS} "${CMADDR}" # Output status, for debugging purposes cfy status -# Check Consul readiness -# The readiness container waits for a "consul-server" container to be ready, -# but this isn't always enough. We need the Consul API to be up and for -# the cluster to be formed, otherwise our Consul accesses might fail. -# (Note in ONAP R2, we never saw a problem, but occasionally in R3 we -# have seen Consul not be fully ready, so we add these checks, originally -# used in the R1 HEAT-based deployment.) -# Wait for Consul API to come up -until curl http://${CONSUL}/v1/agent/services -do - echo Waiting for Consul API - sleep 60 -done -# Wait for a leader to be elected -until [[ "$(curl -Ss http://{$CONSUL}/v1/status/leader)" != '""' ]] -do - echo Waiting for leader - sleep 30 -done +# Store the CM password into a Cloudify secret +cfy secret create -s ${CMPASS} cmpass # Load configurations into Consul KV store for config in /dcae-configs/*.json @@ -181,34 +147,6 @@ do curl -v -X PUT -H "Content-Type: application/json" --data-binary @/tmp/dcae-upload ${CONSUL}/v1/kv/${key} done -# Put service registrations into the local Consul configuration directory -for sr in CBS_REG CBS_REG1 -do - echo '{"service" : ' ${!sr} ' }'> /opt/consul/config/${sr}.json -done - -# Start the local consul agent instance -/opt/consul/bin/consul agent --config-dir /opt/consul/config 2>&1 | tee /opt/consul/consul.log & - -# Store the CM password into a Cloudify secret -cfy secret create -s ${CMPASS} cmpass - -# Load plugins onto CM -for wagon in /wagons/*.wgn -do - install_plugin ${wagon} -done - -# In some oversubscribed cloud environments, we have -# observed that even though the plugin installations appear -# to have completed, there are background installation tasks -# that might still be running. So we check for running system workflows -while cm_hasany "executions?is_system_workflow=true&status=pending&status=started&status=queued&status=scheduled" -do - echo "Waiting for running system workflows to complete" - sleep 15 -done - # After this point, failures should not stop the script or block later commands trap - ERR set +e diff --git a/scripts/load-plugins.sh b/scripts/load-plugins.sh deleted file mode 100755 index 3c25fce..0000000 --- a/scripts/load-plugins.sh +++ /dev/null @@ -1,67 +0,0 @@ -#!/bin/bash -# ============LICENSE_START======================================================= -# org.onap.dcae -# ================================================================================ -# Copyright (c) 2018-2020 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 plugin archives from repos -# $1 is the DCAE repo URL -# $2 is the CCSDK repo URL -# (This script runs at Docker image build time) -# -set -x -set -e -DEST=wagons - -# For DCAE, starting in R5, we pull down wagons directly -DCAEPLUGINFILES=\ -"\ -k8splugin/1.7.2/k8splugin-1.7.2-py27-none-linux_x86_64.wgn -k8splugin/2.0.0/k8splugin-2.0.0-py27-none-linux_x86_64.wgn -relationshipplugin/1.1.0/relationshipplugin-1.1.0-py27-none-linux_x86_64.wgn -clamppolicyplugin/1.1.0/clamppolicyplugin-1.1.0-py27-none-linux_x86_64.wgn -dcaepolicyplugin/2.4.0/dcaepolicyplugin-2.4.0-py27-none-linux_x86_64.wgn \ -" - -# For CCSDK, we pull down the wagon files directly -CCSDKPLUGINFILES=\ -"\ -plugins/pgaas-1.1.0-py27-none-any.wgn -plugins/pgaas-1.2.0-py27-none-linux_x86_64.wgn -plugins/dmaap-1.3.5-py27-none-any.wgn -plugins/dmaap-1.4.0-py27-none-linux_x86_64.wgn -plugins/dmaap-1.4.1-py27-none-linux_x86_64.wgn -plugins/sshkeyshare-1.0.0-py27-none-any.wgn -plugins/sshkeyshare-1.1.0-py27-none-linux_x86_64.wgn -plugins/helm-4.0.0-py27-none-linux_x86_64.wgn -" - -# Copy a set of wagons from a repo -# $1 -- repo baseURL -# $2 -- list of paths to wagons in the repo -function get_wagons { - for wagon in $2 - do - target=$(basename ${wagon}) - curl -Ssf $1/${wagon} > ${DEST}/${target} - done -} - -mkdir ${DEST} -get_wagons $1 "${DCAEPLUGINFILES}" -get_wagons $2 "${CCSDKPLUGINFILES}" diff --git a/scripts/uninstall.sh b/scripts/uninstall.sh index 30dc2bf..ba198e5 100755 --- a/scripts/uninstall.sh +++ b/scripts/uninstall.sh @@ -28,9 +28,6 @@ then CURLTLS="--cacert $CACERT" fi -# Leave the Consul cluster -/opt/consul/bin/consul leave - # 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" :{...}} @@ -51,4 +48,3 @@ curl -Ss --user admin:$CMPASS -H "Tenant: default_tenant" ${CURLTLS} "$CMPROTO:/ curl -Ss --user admin:$CMPASS -H "Tenant: default_tenant" ${CURLTLS} "$CMPROTO://$CMADDR:$CMPORT/api/v3.1/plugins?_include=id" \ | /bin/jq .items[].id \ | xargs -I % sh -c 'cfy plugins delete %' - -- cgit 1.2.3-korg