mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-14 18:53:35 +00:00
vendor updates
This commit is contained in:
31
vendor/k8s.io/kubernetes/hack/lib/etcd.sh
generated
vendored
31
vendor/k8s.io/kubernetes/hack/lib/etcd.sh
generated
vendored
@ -16,21 +16,30 @@
|
||||
|
||||
# A set of helpers for starting/running etcd for tests
|
||||
|
||||
ETCD_VERSION=${ETCD_VERSION:-3.1.10}
|
||||
ETCD_VERSION=${ETCD_VERSION:-3.2.14}
|
||||
ETCD_HOST=${ETCD_HOST:-127.0.0.1}
|
||||
ETCD_PORT=${ETCD_PORT:-2379}
|
||||
|
||||
kube::etcd::validate() {
|
||||
# validate if in path
|
||||
which etcd >/dev/null || {
|
||||
command -v etcd >/dev/null || {
|
||||
kube::log::usage "etcd must be in your PATH"
|
||||
exit 1
|
||||
}
|
||||
|
||||
# validate it is not running
|
||||
if pgrep -x etcd >/dev/null 2>&1; then
|
||||
kube::log::usage "etcd appears to already be running on this machine (`pgrep -xl etcd`) (or its a zombie and you need to kill its parent)."
|
||||
kube::log::usage "retry after you resolve this etcd error."
|
||||
# validate etcd port is free
|
||||
local port_check_command
|
||||
if command -v ss &> /dev/null && ss -Version | grep 'iproute2' &> /dev/null; then
|
||||
port_check_command="ss"
|
||||
elif command -v netstat &>/dev/null; then
|
||||
port_check_command="netstat"
|
||||
else
|
||||
kube::log::usage "unable to identify if etcd is bound to port ${ETCD_PORT}. unable to find ss or netstat utilities."
|
||||
exit 1
|
||||
fi
|
||||
if ${port_check_command} -nat | grep "LISTEN" | grep "[\.:]${ETCD_PORT:?}" >/dev/null 2>&1; then
|
||||
kube::log::usage "unable to start etcd as port ${ETCD_PORT} is in use. please stop the process listening on this port and retry."
|
||||
kube::log::usage "`netstat -nat | grep "[\.:]${ETCD_PORT:?} .*LISTEN"`"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@ -74,12 +83,16 @@ kube::etcd::start() {
|
||||
}
|
||||
|
||||
kube::etcd::stop() {
|
||||
kill "${ETCD_PID-}" >/dev/null 2>&1 || :
|
||||
wait "${ETCD_PID-}" >/dev/null 2>&1 || :
|
||||
if [[ -n "${ETCD_PID-}" ]]; then
|
||||
kill "${ETCD_PID}" &>/dev/null || :
|
||||
wait "${ETCD_PID}" &>/dev/null || :
|
||||
fi
|
||||
}
|
||||
|
||||
kube::etcd::clean_etcd_dir() {
|
||||
rm -rf "${ETCD_DIR-}"
|
||||
if [[ -n "${ETCD_DIR-}" ]]; then
|
||||
rm -rf "${ETCD_DIR}"
|
||||
fi
|
||||
}
|
||||
|
||||
kube::etcd::cleanup() {
|
||||
|
Reference in New Issue
Block a user