Install Cluster API into jump server 84/4484/2
authorTodd Malsbary <todd.malsbary@intel.com>
Fri, 29 Oct 2021 00:06:05 +0000 (17:06 -0700)
committerTodd Malsbary <todd.malsbary@intel.com>
Fri, 19 Nov 2021 22:25:30 +0000 (22:25 +0000)
Signed-off-by: Todd Malsbary <todd.malsbary@intel.com>
Change-Id: I35e6891a5ca4a966f9806f863e668cd7bd24c811

.gitignore
Makefile
deploy/cluster-api/cluster-api.sh [new file with mode: 0755]
deploy/kud/kud_bm_launch.sh
env/lib/common.sh
env/metal3/01_install_package.sh

index 371c05f..fee12c7 100644 (file)
@@ -2,3 +2,4 @@ deploy/ironic/logs/
 deploy/baremetal-operator/logs/
 deploy/cert-manager/logs/
 deploy/metal3/scripts/machines-values.yaml
+deploy/cluster-api/logs/
index bf7cfdb..6ed7b15 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -23,6 +23,7 @@ install: jump_server \
 jump_server: package_prerequisite \
        kud_bm_deploy_mini \
        bmh_install \
+       capi_install \
        bpa_op_install \
        bpa_rest_api_install
 
@@ -87,6 +88,9 @@ kud_bm_reset:
 sdwan_verifier:
        pushd $(SDWAN_VERIFIER_PATH) && bash sdwan_verifier.sh && popd
 
+capi_install:
+       ./deploy/cluster-api/cluster-api.sh deploy
+
 bpa_op_install:
        pushd $(BPA_OPERATOR) && make docker && make deploy && popd
 
diff --git a/deploy/cluster-api/cluster-api.sh b/deploy/cluster-api/cluster-api.sh
new file mode 100755 (executable)
index 0000000..f1e48d9
--- /dev/null
@@ -0,0 +1,30 @@
+#!/usr/bin/env bash
+set -eux -o pipefail
+
+SCRIPTDIR="$(readlink -f $(dirname ${BASH_SOURCE[0]}))"
+LIBDIR="$(dirname $(dirname ${SCRIPTDIR}))/env/lib"
+
+source $LIBDIR/logging.sh
+source $LIBDIR/common.sh
+
+function deploy {
+    export EXP_CLUSTER_RESOURCE_SET=true
+    clusterctl init --infrastructure=metal3
+}
+
+function clean {
+    clusterctl delete --all
+}
+
+case $1 in
+    "clean") clean ;;
+    "deploy") deploy ;;
+    *) cat <<EOF
+Usage: $(basename $0) COMMAND
+
+Commands:
+  clean         - Remove Cluster API
+  deploy        - Deploy Cluster API
+EOF
+       ;;
+esac
index d4b72fc..d9ab84d 100755 (executable)
@@ -5,7 +5,7 @@ LIBDIR="$(dirname "$(dirname "$PWD")")"
 
 source $LIBDIR/env/lib/common.sh
 
-export KUBESPRAY_VERSION=2.14.1
+export KUBESPRAY_VERSION=2.16.0
 
 function get_kud_repo {
     if [ -d $DOWNLOAD_PATH/multicloud-k8s ]; then
index e4d8b08..c26b1f8 100755 (executable)
@@ -24,6 +24,9 @@ FORCE_REPO_UPDATE="${FORCE_REPO_UPDATE:-true}"
 # The kustomize version to use
 KUSTOMIZE_VERSION="v4.3.0"
 
+#Cluster API version to use
+CAPI_VERSION="v0.4.3"
+
 #refered from onap
 function call_api {
     #Runs curl with passed flags and provides
@@ -192,6 +195,13 @@ function install_kustomize {
     kustomize version
 }
 
+function install_clusterctl {
+    curl -L https://github.com/kubernetes-sigs/cluster-api/releases/download/${CAPI_VERSION}/clusterctl-linux-amd64 -o clusterctl
+    sudo install -o root -g root -m 0755 clusterctl /usr/local/bin/clusterctl
+    rm clusterctl
+    clusterctl version
+}
+
 function fetch_image {
     if [[ "${BM_IMAGE_URL}" && "${BM_IMAGE}" ]]; then
        mkdir -p "${IRONIC_DATA_DIR}/html/images"
index eb61654..9d7e7e5 100755 (executable)
@@ -62,6 +62,7 @@ install() {
     install_essential_packages
     install_ironic_packages
     install_kustomize
+    install_clusterctl
 }
 
 install