diff options
author | Kuralamudhan Ramakrishnan <kuralamudhan.ramakrishnan@intel.com> | 2019-10-18 09:08:50 -0700 |
---|---|---|
committer | Kuralamudhan Ramakrishnan <kuralamudhan.ramakrishnan@intel.com> | 2019-10-23 14:33:28 -0700 |
commit | 47224ff96fea8e5a4cda20e5211f66adceb87d10 (patch) | |
tree | 6ef7f3225c77adc50117146143c598c4fa769bf1 /kud/hosting_providers/containerized | |
parent | 07eb93be83349a4da6b41c5a0a1dc98284462098 (diff) |
Adding onap4ks installation script in kud containerized installer
Issue-ID: MULTICLOUD-867
Co-authored-by: Pramod Raghavendra Jayathirth <pramod.raghavendra.jayathirth@intel.com>
Co-authored-by: Ritu Sood <ritu.sood@intel.com>
Change-Id: I37b8112bdd5809f1ae0eaa58ddb0d834d395e8d8
Signed-off-by: Kuralamudhan Ramakrishnan <kuralamudhan.ramakrishnan@intel.com>
Diffstat (limited to 'kud/hosting_providers/containerized')
-rwxr-xr-x | kud/hosting_providers/containerized/installer.sh | 63 | ||||
-rw-r--r-- | kud/hosting_providers/containerized/inventory/group_vars/k8s-cluster.yml | 9 |
2 files changed, 69 insertions, 3 deletions
diff --git a/kud/hosting_providers/containerized/installer.sh b/kud/hosting_providers/containerized/installer.sh index 426c89a0..52fe6279 100755 --- a/kud/hosting_providers/containerized/installer.sh +++ b/kud/hosting_providers/containerized/installer.sh @@ -27,7 +27,7 @@ function install_prerequisites { # _install_ansible() - Install and Configure Ansible program function _install_ansible { - local version=$(grep "ansible_version" ${kud_playbooks}/kud-vars.yml | \ + local version=$(grep "ansible_version" ${kud_playbooks}/kud-vars.yml | awk -F ': ' '{print $2}') mkdir -p /etc/ansible/ pip install ansible==$version @@ -100,6 +100,7 @@ function install_k8s { # install_addons() - Install Kubenertes AddOns function install_addons { + local plugins_name=$1 source /etc/environment echo "Installing Kubernetes AddOns" ansible-galaxy install $verbose -r \ @@ -108,7 +109,7 @@ function install_addons { ansible-playbook $verbose -i \ $kud_inventory $kud_playbooks/configure-kud.yml | \ tee $cluster_log/setup-kud.log - for addon in ${KUD_ADDONS:-virtlet ovn4nfv nfd}; do + for addon in ${KUD_ADDONS:-virtlet ovn4nfv nfd $plugins_name}; do echo "Deploying $addon using configure-$addon.yml playbook.." ansible-playbook $verbose -i \ $kud_inventory $kud_playbooks/configure-${addon}.yml | \ @@ -188,7 +189,7 @@ function install_pkg { function install_cluster { install_k8s $1 - install_addons + install_addons $2 echo "installed the addons" if ${KUD_PLUGIN_ENABLED:-false}; then install_plugin @@ -197,18 +198,53 @@ function install_cluster { _print_kubernetes_info } +function usage { + echo "installer usage:" + echo "./installer.sh --install_pkg - Install the required softwarepackage" + echo "./installer.sh --cluster <cluster name> \ +- Install k8s cluster with default plugins" + echo "./installer.sh --cluster <cluster name> \ +--plugins <plugin_1 plugin_2> - Install k8s cluster with default plugins \ +and additional plugins such as onap4k8s." +} + +if [ $# -eq 0 ]; then + echo "Error: No arguments supplied" + usage + exit 1 +fi + +if [ -z "$1" ]; then + echo "Error: Null argument passed" + usage + exit 1 +fi if [ "$1" == "--install_pkg" ]; then export kud_inventory_folder=$kud_folder/inventory kud_inventory=$kud_inventory_folder/hosts.ini install_pkg + echo "install pkg" exit 0 fi if [ "$1" == "--cluster" ]; then + if [ -z "${2-}" ]; then + echo "Error: Cluster name is null" + usage + exit 1 + fi + cluster_name=$2 kud_multi_cluster_path=/opt/kud/multi-cluster cluster_path=$kud_multi_cluster_path/$cluster_name + echo $cluster_path + if [ ! -d "${cluster_path}" ]; then + echo "Error: cluster_path ${cluster_path} doesn't exit" + usage + exit 1 + fi + cluster_log=$kud_multi_cluster_path/$cluster_name/log export kud_inventory_folder=$kud_folder/inventory/$cluster_name kud_inventory=$kud_inventory_folder/hosts.ini @@ -218,6 +254,27 @@ if [ "$1" == "--cluster" ]; then cp $kud_multi_cluster_path/$cluster_name/hosts.ini $kud_inventory_folder/ cp -rf $kud_folder/inventory/group_vars $kud_inventory_folder/ + if [ -n "$3" ]; then + if [ "$3" == "--plugins" ]; then + if [ -z "${4-}" ]; then + echo "Error: plugins arguments is null; Refer the usage" + usage + exit 1 + fi + plugins_name=${@:4:$#} + install_cluster $cluster_name $plugins_name + exit 0 + else + echo "Error: cluster argument should have plugins; \ + Refer the usage" + usage + exit 1 + fi + fi install_cluster $cluster_name exit 0 fi + +echo "Error: Refer the installer usage" +usage +exit 1 diff --git a/kud/hosting_providers/containerized/inventory/group_vars/k8s-cluster.yml b/kud/hosting_providers/containerized/inventory/group_vars/k8s-cluster.yml index bc085b4e..31d0d669 100644 --- a/kud/hosting_providers/containerized/inventory/group_vars/k8s-cluster.yml +++ b/kud/hosting_providers/containerized/inventory/group_vars/k8s-cluster.yml @@ -71,3 +71,12 @@ local_release_dir: "/tmp/releases" # cannot access each over via ssh or you want to use local docker # images as a cache for multiple clusters. download_localhost: false + +# Subnet for cluster IPs +kube_service_addresses: 10.244.0.0/18 + +# Subnet for Pod IPs +kube_pods_subnet: 10.244.64.0/18 + +# disable localdns cache +enable_nodelocaldns: false |