X-Git-Url: https://gerrit.akraino.org/r/gitweb?a=blobdiff_plain;f=deploy%2Fsite%2Fvm%2Fvm.sh;h=9f6e455edbac364654c3b6d16b2a8ac4af67813f;hb=adbd076f40c348b04e52321c3c5cdaa528915f1a;hp=14f9319a357aaff4d07fae853bde731674e6a15b;hpb=47623705343c39416af4b272ff01b36ae097ddb7;p=icn.git diff --git a/deploy/site/vm/vm.sh b/deploy/site/vm/vm.sh index 14f9319..9f6e455 100755 --- a/deploy/site/vm/vm.sh +++ b/deploy/site/vm/vm.sh @@ -5,65 +5,33 @@ SCRIPTDIR="$(readlink -f $(dirname ${BASH_SOURCE[0]}))" LIBDIR="$(dirname $(dirname $(dirname ${SCRIPTDIR})))/env/lib" source $LIBDIR/common.sh +source $SCRIPTDIR/../common.sh BUILDDIR=${SCRIPTDIR/deploy/build} mkdir -p ${BUILDDIR} -function build { - SSH_AUTHORIZED_KEY=$(cat ${HOME}/.ssh/id_rsa.pub) - # Use ! instead of usual / to avoid escaping / in - # SSH_AUTHORIZED_KEY - sed -e 's!sshAuthorizedKey: .*!sshAuthorizedKey: '"${SSH_AUTHORIZED_KEY}"'!' ${SCRIPTDIR}/clusters-values.yaml >${BUILDDIR}/clusters-values.yaml -} - -function deploy { - helm -n metal3 install machines ${SCRIPTDIR}/../../machines --create-namespace -f ${BUILDDIR}/machines-values.yaml - helm -n metal3 install clusters ${SCRIPTDIR}/../../clusters --create-namespace -f ${BUILDDIR}/clusters-values.yaml -} - -function clean { - helm -n metal3 uninstall clusters - helm -n metal3 uninstall machines -} - -function is_cluster_ready { - [[ $(kubectl -n metal3 get cluster e2etest -o jsonpath='{.status.conditions[?(@.type=="Ready")].status}') == "True" ]] -} - -function are_kustomizations_ready { - [[ $(kubectl --kubeconfig=${BUILDDIR}/e2etest-admin.conf get Kustomization -n flux-system -o jsonpath='{range .items[*]}{.status.conditions[?(@.type=="Ready")].status}{"\n"}{end}' | grep -c -v True) == 0 ]] -} - -function are_helmreleases_ready { - [[ $(kubectl --kubeconfig=${BUILDDIR}/e2etest-admin.conf get HelmRelease -n flux-system -o jsonpath='{range .items[*]}{.status.conditions[?(@.type=="Ready")].status}{"\n"}{end}' | grep -c -v True) == 0 ]] -} - -function wait_for_all_ready { - WAIT_FOR_INTERVAL=60s - wait_for is_cluster_ready - clusterctl -n metal3 get kubeconfig e2etest >${BUILDDIR}/e2etest-admin.conf - chmod 600 ${BUILDDIR}/e2etest-admin.conf - # TODO The following checks are not ideal: resources created by - # operators aren't detected here, but this is the best that can be - # currently done - WAIT_FOR_INTERVAL=30s - wait_for are_kustomizations_ready - wait_for are_helmreleases_ready -} +SITE_REPO=${SITE_REPO:-"https://gerrit.akraino.org/r/icn"} +SITE_BRANCH=${SITE_BRANCH:-"master"} +SITE_PATH=${SITE_PATH:-"deploy/site/vm/deployment"} case $1 in - "build") build ;; - "clean") clean ;; - "deploy") deploy ;; - "wait") wait_for_all_ready ;; + "clean") site_clean ;; + "deploy") + gpg --import ${FLUX_SOPS_PRIVATE_KEY} + site_deploy ;; + "wait") + site_wait_for_all_ready + site_insert_control_plane_network_identity_into_ssh_config + ;; + "wait-clean") site_wait_for_all_deleted ;; *) cat <