Skip to content

Commit

Permalink
feat: update kainstall
Browse files Browse the repository at this point in the history
  • Loading branch information
yaokl committed Jan 5, 2024
1 parent 0fb1410 commit e718f06
Show file tree
Hide file tree
Showing 3 changed files with 240 additions and 226 deletions.
20 changes: 3 additions & 17 deletions kainstall-centos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,6 @@ GCR_PROXY="${GCR_PROXY:-k8sgcr.lework.workers.dev}"
SKIP_UPGRADE_PLAN=${SKIP_UPGRADE_PLAN:-false}
SKIP_SET_OS_REPO=${SKIP_SET_OS_REPO:-false}

# I decided the version based on this link(https://github.com/kubernetes/kops/issues/15204), because I couldn't find which version started to change
FLANNEL_NAMESPACE_CHANGED_VERSION="${FLANNEL_NAMESPACE_CHANGED_VERSION:-1.25.7}"

trap trap::info 1 2 3 15 EXIT

######################################################################################################
Expand Down Expand Up @@ -1566,7 +1563,7 @@ function cert::renew_node() {
if [[ "${status}" == "0" ]]; then
sleep 5
command::exec "${MGMT_NODE}" "kubectl uncordon ${host}"
check::exit_code "$?" "cert" "uncordon ${host} node"
check::exit_code "$?" "cert" "uncordon ${host} node" "exit"
fi
fi
done
Expand Down Expand Up @@ -2480,12 +2477,6 @@ spec:
fi
}
#compare version numbers
function is::larger_version_than() {
local version1=$1;
local version2=$2;
return "$(echo "$version1" "$version2" | awk '{if ($1 >= $2) print 1; else print 0}')"
}
function add::network() {
# 添加network组件
Expand All @@ -2500,19 +2491,15 @@ function add::network() {
sed -i -e 's#10.244.0.0/16#${KUBE_POD_SUBNET}#g' \
-e 's#quay.io/coreos#${KUBE_IMAGE_REPO}#g' \
-e 's#docker.io/flannel#${KUBE_IMAGE_REPO}#g' \
-e 's#namespace: kube-system#namespace: kube-flannel#g' \
-e 's#\"Type\": \"vxlan\"#\"Type\": \"${KUBE_FLANNEL_TYPE}\"#g' \"${flannel_file}\"
if [[ \"${KUBE_FLANNEL_TYPE}\" == \"vxlan\" ]]; then
sed -i 's#\"Type\": \"vxlan\"#\"Type\": \"vxlan\", \"DirectRouting\": true#g' \"${flannel_file}\"
fi
"
check::exit_code "$?" "flannel" "change flannel pod subnet"
kube::apply "${flannel_file}"
is::larger_version_than "${KUBE_VERSION}" "${FLANNEL_NAMESPACE_CHANGED_VERSION}"
if [ $? -eq 1 ];then
kube::wait "flannel" "kube-flannel" "pods" "app=flannel"
else
kube::wait "flannel" "kube-system" "pods" "app=flannel"
fi
kube::wait "flannel" "kube-flannel" "pods" "app=flannel"
elif [[ "$KUBE_NETWORK" == "calico" ]]; then
log::info "[network]" "add calico"
Expand Down Expand Up @@ -3994,7 +3981,6 @@ while [ "${1:-}" != "" ]; do
SUDO_PASSWORD=${1:-}
;;
* ) help::usage
exit 1
esac
shift
done
Expand Down
Loading

0 comments on commit e718f06

Please sign in to comment.