-
Notifications
You must be signed in to change notification settings - Fork 40k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Check if netstat or iproute2 is available #59852
Conversation
@cblecker did you mean to push the pipe error message commit to this PR? |
hack/lib/etcd.sh
Outdated
@@ -28,7 +28,16 @@ kube::etcd::validate() { | |||
} | |||
|
|||
# validate etcd port is free | |||
if netstat -nat | grep "[\.:]${ETCD_PORT:?} .*LISTEN" >/dev/null 2>&1; then | |||
local port_check_command | |||
if which ss &> /dev/null && ss -Version | grep 'iproute2' &> /dev/null; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd use command -v
as it's apparently kosher for implementations of which
to not set exit status and look at loads of things other than installed binaries. On my machine, which
is:
$ type which
which is aliased to `(alias; declare -f) | /usr/bin/which --tty-only --read-alias --read-functions --show-tilde --show-dot'
3d51213
to
ede8e0a
Compare
/hold cancel PTAL @dims @stevekuznetsov :) |
/lgtm |
/hold for @dims |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: cblecker, stevekuznetsov The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these OWNERS Files:
Approvers can indicate their approval by writing |
/hold cancel LGTM 👍
|
/test all [submit-queue is verifying that this PR is safe to merge] |
Automatic merge from submit-queue (batch tested with PRs 59878, 59852). If you want to cherry-pick this change to another branch, please follow the instructions here. |
What this PR does / why we need it:
In #59655, I incorrectly assumed that the kubetest image would have net-tools. It doesn't. This checks and uses
ss
from iproute2, ornetstat
from net-tools. The kubetest image does appear to have iproute2.Release note: