@@ -459,15 +459,15 @@ installAzureCNI() {
459459}
460460
461461# extract the cached or downloaded kube package and remove
462- extractKubeBinariesToUsrLocalBin () {
462+ extractKubeBinariesToOptBin () {
463463 local k8s_tgz_tmp=$1
464464 local k8s_version=$2
465465 local is_private_url=$3
466466
467- extract_tarball " ${k8s_tgz_tmp} " " /usr/local /bin" \
467+ extract_tarball " ${k8s_tgz_tmp} " " /opt /bin" \
468468 --transform=" s|.*|&-${k8s_version} |" --show-transformed-names --strip-components=3 \
469469 kubernetes/node/bin/kubelet kubernetes/node/bin/kubectl || exit $ERR_K8S_INSTALL_ERR
470- if [ ! -f " /usr/local/ bin/kubectl-${k8s_version} " ] || [ ! -f " /usr/local /bin/kubelet-${k8s_version} " ]; then
470+ if [ ! -f " /opt/ bin/kubectl-${k8s_version} " ] || [ ! -f " /opt /bin/kubelet-${k8s_version} " ]; then
471471 exit $ERR_K8S_INSTALL_ERR
472472 fi
473473 if [ " $is_private_url " = " false" ]; then
@@ -500,7 +500,7 @@ extractKubeBinaries() {
500500
501501 echo " cached package ${k8s_tgz_tmp} found, will extract that"
502502 # remove the current kubelet and kubectl binaries before extracting new binaries from the cached package
503- rm -rf /usr/local/ bin/kubelet-* /usr/local /bin/kubectl-*
503+ rm -rf /opt/ bin/kubelet-* /opt /bin/kubectl-*
504504 else
505505 k8s_tgz_tmp=" ${k8s_downloads_dir} /${k8s_tgz_tmp_filename} "
506506 mkdir -p ${k8s_downloads_dir}
@@ -523,7 +523,7 @@ extractKubeBinaries() {
523523 fi
524524 fi
525525
526- extractKubeBinariesToUsrLocalBin " ${k8s_tgz_tmp} " " ${k8s_version} " " ${is_private_url} "
526+ extractKubeBinariesToOptBin " ${k8s_tgz_tmp} " " ${k8s_version} " " ${is_private_url} "
527527}
528528
529529installToolFromBootstrapProfileRegistry () {
@@ -579,7 +579,7 @@ installKubeletKubectlFromBootstrapProfileRegistry() {
579579 local registry_server=$1
580580 local kubernetes_version=$2
581581 for tool_name in $( get_kubernetes_tools) ; do
582- install_path=" /usr/local /bin/${tool_name} "
582+ install_path=" /opt /bin/${tool_name} "
583583 if ! installToolFromBootstrapProfileRegistry " ${tool_name} " " ${registry_server} " " ${kubernetes_version} " " ${install_path} " ; then
584584 # SHOULD_ENFORCE_KUBE_PMC_INSTALL will only be set for e2e tests, which should not fallback to reflect result of package installation behavior
585585 # TODO: remove SHOULD_ENFORCE_KUBE_PMC_INSTALL check when the test cluster supports > 1.34.0 case
@@ -604,7 +604,7 @@ installKubeletKubectlFromURL() {
604604
605605 if [ ! -z " ${CUSTOM_KUBE_BINARY_DOWNLOAD_URL} " ]; then
606606 # remove the kubelet and kubectl binaries to make sure the only binary left is from the CUSTOM_KUBE_BINARY_DOWNLOAD_URL
607- rm -rf /usr/local/ bin/kubelet-* /usr/local /bin/kubectl-*
607+ rm -rf /opt/ bin/kubelet-* /opt /bin/kubectl-*
608608
609609 # NOTE(mainred): we expect kubelet binary to be under `kubernetes/node/bin`. This suits the current setting of
610610 # kube binaries used by AKS and Kubernetes upstream.
@@ -617,7 +617,7 @@ installKubeletKubectlFromURL() {
617617 fi
618618
619619 # if the custom url is not specified and the required kubectl/kubelet-version via private url is not installed, install using the default url/package
620- if [ ! -f " /usr/local/ bin/kubectl-${KUBERNETES_VERSION} " ] || [ ! -f " /usr/local /bin/kubelet-${KUBERNETES_VERSION} " ]; then
620+ if [ ! -f " /opt/ bin/kubectl-${KUBERNETES_VERSION} " ] || [ ! -f " /opt /bin/kubelet-${KUBERNETES_VERSION} " ]; then
621621 if [ " $install_default_if_missing " = " true" ]; then
622622 if [ -n " ${BOOTSTRAP_PROFILE_CONTAINER_REGISTRY_SERVER} " ]; then
623623 # network isolated cluster
@@ -635,11 +635,10 @@ installKubeletKubectlFromURL() {
635635 fi
636636 fi
637637 fi
638- mv " /usr/local/ bin/kubelet-${KUBERNETES_VERSION} " " /usr/local/ bin/kubelet"
639- mv " /usr/local/ bin/kubectl-${KUBERNETES_VERSION} " " /usr/local/ bin/kubectl"
638+ install -m0755 " /opt/ bin/kubelet-${KUBERNETES_VERSION} " /opt/ bin/kubelet
639+ install -m0755 " /opt/ bin/kubectl-${KUBERNETES_VERSION} " /opt/ bin/kubectl
640640
641- chmod a+x /usr/local/bin/kubelet /usr/local/bin/kubectl
642- rm -rf /usr/local/bin/kubelet-* /usr/local/bin/kubectl-* /home/hyperkube-downloads &
641+ rm -rf /opt/bin/kubelet-* /opt/bin/kubectl-* /home/hyperkube-downloads &
643642}
644643
645644pullContainerImage () {
0 commit comments