mirror of https://github.com/k3s-io/k3s
Merge pull request #53500 from rphillips/fixes/build_common_ifconfig
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. common.sh fix to detect ip instead of ifconfig **What this PR does / why we need it**: The IP address detection recently [added](https://github.com/kubernetes/kubernetes/commit/ca76002) to build/common.sh to whitelist the host IP will error if ifconfig is not installed. This patch detects if `ip` is installed and then uses `ip` instead of `ifconfig`. **Which issue this PR fixes** **Special notes for your reviewer**: **Release note**: /cc @zhouhaibing089pull/6/head
commit
9af40f8229
|
@ -317,6 +317,10 @@ function kube::build::has_docker() {
|
|||
which docker &> /dev/null
|
||||
}
|
||||
|
||||
function kube::build::has_ip() {
|
||||
ip -Version | grep 'iproute2' &> /dev/null
|
||||
}
|
||||
|
||||
# Detect if a specific image exists
|
||||
#
|
||||
# $1 - image repo name
|
||||
|
@ -628,11 +632,15 @@ function kube::build::rsync_probe {
|
|||
# This will set the global var KUBE_RSYNC_ADDR to the effective port that the
|
||||
# rsync daemon can be reached out.
|
||||
function kube::build::start_rsyncd_container() {
|
||||
IPTOOL=ifconfig
|
||||
if kube::build::has_ip ; then
|
||||
IPTOOL="ip address"
|
||||
fi
|
||||
kube::build::stop_rsyncd_container
|
||||
V=3 kube::log::status "Starting rsyncd container"
|
||||
kube::build::run_build_command_ex \
|
||||
"${KUBE_RSYNC_CONTAINER_NAME}" -p 127.0.0.1:${KUBE_RSYNC_PORT}:${KUBE_CONTAINER_RSYNC_PORT} -d \
|
||||
-e ALLOW_HOST="$(ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v '127.0.0.1')" \
|
||||
-e ALLOW_HOST="$(${IPTOOL} | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v '127.0.0.1')" \
|
||||
-- /rsyncd.sh >/dev/null
|
||||
|
||||
local mapped_port
|
||||
|
|
Loading…
Reference in New Issue