X-Git-Url: https://gerrit.akraino.org/r/gitweb?a=blobdiff_plain;f=env%2Fmetal3%2F03_launch_prereq.sh;h=e8fa538905d0b4241f237149f736bc3b5d62882d;hb=ee4e975fbd60cd72c65f89519448a77463e6e432;hp=b2bba22e77dc623abaf0b91ff727acb0ce73645f;hpb=5910e45742205d4654082afcd69ef5b77e4c8942;p=icn.git diff --git a/env/metal3/03_launch_prereq.sh b/env/metal3/03_launch_prereq.sh index b2bba22..e8fa538 100755 --- a/env/metal3/03_launch_prereq.sh +++ b/env/metal3/03_launch_prereq.sh @@ -11,71 +11,6 @@ if [[ $EUID -ne 0 ]]; then exit 1 fi -function get_default_interface_ipaddress { - local _ip=$1 - local _default_interface=$(awk '$2 == 00000000 { print $1 }' /proc/net/route) - local _ipv4address=$(ip addr show dev $_default_interface | awk '$1 == "inet" { sub("/.*", "", $2); print $2 }') - eval $_ip="'$_ipv4address'" -} - -function check_cni_network { - #since bootstrap cluster is a single node cluster, - #podman and bootstap cluster have same network configuration to avoid the cni network conf conflicts - if [ ! -d "/etc/cni/net.d" ]; then - mkdir -p "/etc/cni/net.d" - fi - - if [ -f "/etc/cni/net.d/87-podman-bridge.conflist" ]; then - rm -rf /etc/cni/net.d/87-podman-bridge.conflist - fi - - if [ "$1" == "offline" ]; then - cp $BUILD_DIR/87-podman-bridge.conflist /etc/cni/net.d/ - return - fi - - if !(wget $PODMAN_CNI_CONFLIST -P /etc/cni/net.d/); then - exit 1 - fi -} - -function create_k8s_regular_user { - if [ ! -d "$HOME/.kube" ]; then - mkdir -p $HOME/.kube - fi - - if [ ! -f /etc/kubernetes/admin.conf]; then - exit 1 - fi - - cp -rf /etc/kubernetes/admin.conf $HOME/.kube/config - chown $(id -u):$(id -g) $HOME/.kube/config -} - -function check_k8s_node_status { - echo 'checking bootstrap cluster single node status' - node_status="False" - - for i in {1..5}; do - check_node=$(kubectl get node -o \ - jsonpath='{.items[0].status.conditions[?(@.reason == "KubeletReady")].status}') - if [ $check_node != "" ]; then - node_status=${check_node} - fi - - if [ $node_status == "True" ]; then - break - fi - - sleep 3 - done - - if [ $node_status != "True" ]; then - echo "bootstrap cluster single node status is not ready" - exit 1 - fi -} - function install_ironic_container { # set password for mariadb mariadb_password=$(echo $(date;hostname)|sha256sum |cut -c-20) @@ -122,24 +57,6 @@ function install_ironic_container { -v "$IRONIC_DATA_DIR:/shared" "${IRONIC_INSPECTOR_IMAGE}" } -function remove_k8s_noschedule_taint { - #Bootstrap cluster is a single node - nodename=$(kubectl get node -o jsonpath='{.items[0].metadata.name}') - if !(kubectl taint node $nodename node-role.kubernetes.io/master:NoSchedule-); then - exit 1 - fi -} - -function install_k8s_single_node { - get_default_interface_ipaddress apiserver_advertise_addr - kubeadm_init="kubeadm init --kubernetes-version=$KUBE_VERSION \ - --pod-network-cidr=$POD_NETWORK_CIDR \ - --apiserver-advertise-address=$apiserver_advertise_addr" - if !(${kubeadm_init}); then - exit 1 - fi -} - function create_ironic_env { cat < ${PWD}/ironic.env PROVISIONING_INTERFACE=provisioning @@ -155,16 +72,6 @@ EOF } function install { - #Kubeadm usage is deprecated in v1,0,0 version - #install_kubernetes - #install_k8s_single_node - #check_cni_network $1 - #create_k8s_regular_user - #check_k8s_node_status - #remove_k8s_noschedule_taint - - #install_podman - #Todo - error handling mechanism create_ironic_env install_ironic_container }