From 2cbcccc6d06324f3c91306ed73f262b631457a23 Mon Sep 17 00:00:00 2001 From: Todd Malsbary Date: Fri, 7 Aug 2020 10:20:12 -0700 Subject: Add playbooks for v2 emco chart. Rename v2/onap4k8s to v2/emco, and rename sanity-check-for-v2.sh to emco.sh. This allows --plugins emco to be passed to installer.sh in place of --plugins onap4k8s. Issue-ID: MULTICLOUD-1181 Signed-off-by: Todd Change-Id: Idb427a8aa4c8aaff181965a540078c8cf6dd88aa --- .../playbooks/configure-emco-reset.yml | 56 +++ kud/deployment_infra/playbooks/configure-emco.yml | 55 +++ .../playbooks/configure-onap4k8s-reset.yml | 2 +- kud/tests/emco.sh | 534 +++++++++++++++++++++ kud/tests/sanity-check-for-v2.sh | 534 --------------------- 5 files changed, 646 insertions(+), 535 deletions(-) create mode 100644 kud/deployment_infra/playbooks/configure-emco-reset.yml create mode 100644 kud/deployment_infra/playbooks/configure-emco.yml create mode 100755 kud/tests/emco.sh delete mode 100755 kud/tests/sanity-check-for-v2.sh (limited to 'kud') diff --git a/kud/deployment_infra/playbooks/configure-emco-reset.yml b/kud/deployment_infra/playbooks/configure-emco-reset.yml new file mode 100644 index 00000000..a4560cc2 --- /dev/null +++ b/kud/deployment_infra/playbooks/configure-emco-reset.yml @@ -0,0 +1,56 @@ +--- +# SPDX-license-identifier: Apache-2.0 +############################################################################## +# Copyright (c) 2018 +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## + +- hosts: kube-master + tasks: + - name: Load kud variables + include_vars: + file: kud-vars.yml + + - name: Change the emco directory and run helm delete + command: /usr/local/bin/helm delete --purge emco + register: helm_delete + args: + chdir: /opt/multicloud/deployments/helm/v2/emco + + - debug: + var: helm_delete.stdout_lines + + - name: Change the emco directory and delete the emco namespace + command: /usr/local/bin/kubectl delete ns emco + register: delete_emco_ns + args: + chdir: /opt/multicloud/deployments/helm/v2/emco + + - debug: + var: delete_emco_ns.stdout_lines + + - name: Change the emco directory and make clean + command: /usr/bin/make clean + register: make_clean + args: + chdir: /opt/multicloud/deployments/helm/v2/emco + + - debug: + var: make_clean.stdout_lines + + - name: Change the emco directory and make repo-stop + command: /usr/bin/make repo-stop + register: make_repo_stop + args: + chdir: /opt/multicloud/deployments/helm/v2/emco + + - debug: + var: make_repo_stop.stdout_lines + + - name: clean multicloud-k8s path + file: + state: absent + path: /opt/multicloud diff --git a/kud/deployment_infra/playbooks/configure-emco.yml b/kud/deployment_infra/playbooks/configure-emco.yml new file mode 100644 index 00000000..255ce6a4 --- /dev/null +++ b/kud/deployment_infra/playbooks/configure-emco.yml @@ -0,0 +1,55 @@ +--- +# SPDX-license-identifier: Apache-2.0 +############################################################################## +# Copyright (c) 2018 +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## + +- hosts: kube-master + tasks: + - name: Load kud variables + include_vars: + file: kud-vars.yml + + - name: Getting emco code in /opt folder + git: + repo: 'https://github.com/onap/multicloud-k8s.git' + dest: /opt/multicloud + + - name: install make package for ubuntu systems + apt: name=make state=present update_cache=yes + when: ansible_distribution == "Ubuntu" + + - name: install make package for centos systems + yum: name=make state=present update_cache=yes + when: ansible_distribution == "CentOS" + + - name: Change the emco directory and run the command make repo + command: /usr/bin/make repo + register: make_repo + args: + chdir: /opt/multicloud/deployments/helm/v2/emco + + - debug: + var: make_repo.stdout_lines + + - name: Change the emco directory and run the command make all + command: /usr/bin/make all + register: make_all + args: + chdir: /opt/multicloud/deployments/helm/v2/emco + + - debug: + var: make_all.stdout_lines + + - name: Change the emco directory and run the command helm install + command: /usr/local/bin/helm install dist/packages/emco-0.1.0.tgz --name emco --namespace emco + register: helm_install + args: + chdir: /opt/multicloud/deployments/helm/v2/emco + + - debug: + var: helm_install.stdout_lines diff --git a/kud/deployment_infra/playbooks/configure-onap4k8s-reset.yml b/kud/deployment_infra/playbooks/configure-onap4k8s-reset.yml index 6adaf2ee..d6f2f6bc 100644 --- a/kud/deployment_infra/playbooks/configure-onap4k8s-reset.yml +++ b/kud/deployment_infra/playbooks/configure-onap4k8s-reset.yml @@ -23,7 +23,7 @@ - debug: var: helm_delete.stdout_lines - - name: Change the onap4k8s directory and delete the ona4k8s-ns namespace + - name: Change the onap4k8s directory and delete the onap4k8s-ns namespace command: /usr/local/bin/kubectl delete ns onap4k8s-ns register: delete_onap_ns args: diff --git a/kud/tests/emco.sh b/kud/tests/emco.sh new file mode 100755 index 00000000..80dc2d5c --- /dev/null +++ b/kud/tests/emco.sh @@ -0,0 +1,534 @@ +#!/bin/bash + +# Copyright 2020 Intel Corporation, Inc +# +# 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. +# + +set -o errexit +set -o nounset +set -o pipefail + +source _common_test.sh +source _functions.sh +#source _common.sh + +# TODO Workaround for MULTICLOUD-1202 +function delete_resource_nox { + call_api_nox -X DELETE "$1" + ! call_api -X GET "$1" >/dev/null +} + +master_ip=$(kubectl cluster-info | grep "Kubernetes master" | \ + awk -F ":" '{print $2}' | awk -F "//" '{print $2}') +rsync_service_port=30441 +rsync_service_host="$master_ip" +base_url_orchestrator=${base_url_orchestrator:-"http://$master_ip:30415/v2"} +base_url_clm=${base_url_clm:-"http://$master_ip:30461/v2"} + +CSAR_DIR="/opt/csar" +csar_id="cb009bfe-bbee-11e8-9766-525400435678" + +app1_helm_path="$CSAR_DIR/$csar_id/prometheus-operator.tar.gz" +app1_profile_path="$CSAR_DIR/$csar_id/prometheus-operator_profile.tar.gz" +app2_helm_path="$CSAR_DIR/$csar_id/collectd.tar.gz" +app2_profile_path="$CSAR_DIR/$csar_id/collectd_profile.tar.gz" + +kubeconfig_path="$HOME/.kube/config" + +function populate_CSAR_composite_app_helm { + _checks_args "$1" + pushd "${CSAR_DIR}/$1" + print_msg "Create Helm Chart Archives for compositeApp" + rm -f *.tar.gz + tar -czf collectd.tar.gz -C $test_folder/vnfs/comp-app/collection/app1/helm . + tar -czf prometheus-operator.tar.gz -C $test_folder/vnfs/comp-app/collection/app2/helm . + tar -czf collectd_profile.tar.gz -C $test_folder/vnfs/comp-app/collection/app1/profile . + tar -czf prometheus-operator_profile.tar.gz -C $test_folder/vnfs/comp-app/collection/app2/profile . + popd +} + + +# ---------BEGIN: SET CLM DATA--------------- + +clusterprovidername="sanity-test-cluster-provider" +clusterproviderdata="$(cat</dev/null -} - -master_ip=$(kubectl cluster-info | grep "Kubernetes master" | \ - awk -F ":" '{print $2}' | awk -F "//" '{print $2}') -rsync_service_port=30441 -rsync_service_host="$master_ip" -base_url_orchestrator=${base_url_orchestrator:-"http://$master_ip:30415/v2"} -base_url_clm=${base_url_clm:-"http://$master_ip:30461/v2"} - -CSAR_DIR="/opt/csar" -csar_id="cb009bfe-bbee-11e8-9766-525400435678" - -app1_helm_path="$CSAR_DIR/$csar_id/prometheus-operator.tar.gz" -app1_profile_path="$CSAR_DIR/$csar_id/prometheus-operator_profile.tar.gz" -app2_helm_path="$CSAR_DIR/$csar_id/collectd.tar.gz" -app2_profile_path="$CSAR_DIR/$csar_id/collectd_profile.tar.gz" - -kubeconfig_path="$HOME/.kube/config" - -function populate_CSAR_composite_app_helm { - _checks_args "$1" - pushd "${CSAR_DIR}/$1" - print_msg "Create Helm Chart Archives for compositeApp" - rm -f *.tar.gz - tar -czf collectd.tar.gz -C $test_folder/vnfs/comp-app/collection/app1/helm . - tar -czf prometheus-operator.tar.gz -C $test_folder/vnfs/comp-app/collection/app2/helm . - tar -czf collectd_profile.tar.gz -C $test_folder/vnfs/comp-app/collection/app1/profile . - tar -czf prometheus-operator_profile.tar.gz -C $test_folder/vnfs/comp-app/collection/app2/profile . - popd -} - - -# ---------BEGIN: SET CLM DATA--------------- - -clusterprovidername="sanity-test-cluster-provider" -clusterproviderdata="$(cat<