mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-03 09:22:44 +00:00
Make hack/local-up-cluster.sh work again for etcd 2
This commit is contained in:
parent
0307d7ba98
commit
449f9d915e
@ -19,6 +19,7 @@
|
|||||||
kube::etcd::start() {
|
kube::etcd::start() {
|
||||||
local host=${ETCD_HOST:-127.0.0.1}
|
local host=${ETCD_HOST:-127.0.0.1}
|
||||||
local port=${ETCD_PORT:-4001}
|
local port=${ETCD_PORT:-4001}
|
||||||
|
local testhost=${ETCD_PUBLIC_HOST:-localhost}
|
||||||
|
|
||||||
which etcd >/dev/null || {
|
which etcd >/dev/null || {
|
||||||
kube::log::usage "etcd must be in your PATH"
|
kube::log::usage "etcd must be in your PATH"
|
||||||
@ -38,18 +39,13 @@ kube::etcd::start() {
|
|||||||
|
|
||||||
# Start etcd
|
# Start etcd
|
||||||
ETCD_DIR=$(mktemp -d -t test-etcd.XXXXXX)
|
ETCD_DIR=$(mktemp -d -t test-etcd.XXXXXX)
|
||||||
kube::log::usage "etcd -data-dir ${ETCD_DIR} -addr ${host}:${port} >/dev/null 2>/dev/null"
|
kube::log::usage "etcd -data-dir ${ETCD_DIR} --bind-addr ${host}:${port} >/dev/null 2>/dev/null"
|
||||||
etcd -data-dir ${ETCD_DIR} -addr ${host}:${port} >/dev/null 2>/dev/null &
|
etcd -data-dir ${ETCD_DIR} -addr ${host}:${port} >/dev/null 2>/dev/null &
|
||||||
ETCD_PID=$!
|
ETCD_PID=$!
|
||||||
|
|
||||||
echo "Waiting for etcd to come up."
|
echo "Waiting for etcd to come up."
|
||||||
while true; do
|
kube::util::wait_for_url "http://${testhost}:${port}/v2/machines" "etcd: " 0.25 80
|
||||||
if curl -L http://127.0.0.1:4001/v2/keys/test -XPUT -d value="test"; then
|
curl -X PUT "http://${testhost}:${port}/v2/keys/_test"
|
||||||
break
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
kube::util::wait_for_url "http://${host}:${port}/v2/keys/test" "etcd: "
|
|
||||||
}
|
}
|
||||||
|
|
||||||
kube::etcd::cleanup() {
|
kube::etcd::cleanup() {
|
||||||
|
@ -93,7 +93,7 @@ sudo "${GO_OUT}/kube-apiserver" \
|
|||||||
--address="${API_HOST}" \
|
--address="${API_HOST}" \
|
||||||
--port="${API_PORT}" \
|
--port="${API_PORT}" \
|
||||||
--runtime_config=api/v1beta3 \
|
--runtime_config=api/v1beta3 \
|
||||||
--etcd_servers="http://127.0.0.1:4001" \
|
--etcd_servers="http://localhost:4001" \
|
||||||
--portal_net="10.0.0.0/24" \
|
--portal_net="10.0.0.0/24" \
|
||||||
--cors_allowed_origins="${API_CORS_ALLOWED_ORIGINS}" >"${APISERVER_LOG}" 2>&1 &
|
--cors_allowed_origins="${API_CORS_ALLOWED_ORIGINS}" >"${APISERVER_LOG}" 2>&1 &
|
||||||
APISERVER_PID=$!
|
APISERVER_PID=$!
|
||||||
|
Loading…
Reference in New Issue
Block a user