Allow test-cmd to run on non-Linux OS

pull/6/head
Clayton Coleman 2016-04-24 14:54:22 -04:00
parent 44021747ab
commit 4752d1a181
No known key found for this signature in database
GPG Key ID: 3D16906B4F1C5CB3
1 changed files with 25 additions and 1 deletions

View File

@ -148,6 +148,9 @@ HOME="${KUBE_TEMP}"
kube::log::status "Running kubectl with no options"
"${KUBE_OUTPUT_HOSTBIN}/kubectl"
# Only run kubelet on platforms it supports
if [[ "$(go env GOHOSTOS)" == "linux" ]]; then
kube::log::status "Starting kubelet in masterless mode"
"${KUBE_OUTPUT_HOSTBIN}/kubelet" \
--really-crash-for-testing=true \
@ -177,6 +180,8 @@ KUBELET_PID=$!
kube::util::wait_for_url "http://127.0.0.1:${KUBELET_HEALTHZ_PORT}/healthz" "kubelet"
fi
# Start kube-apiserver
kube::log::status "Starting kube-apiserver"
@ -206,7 +211,26 @@ kube::log::status "Starting controller-manager"
CTLRMGR_PID=$!
kube::util::wait_for_url "http://127.0.0.1:${CTLRMGR_PORT}/healthz" "controller-manager"
kube::util::wait_for_url "http://127.0.0.1:${API_PORT}/api/v1/nodes/127.0.0.1" "apiserver(nodes)"
if [[ "$(go env GOHOSTOS)" == "linux" ]]; then
kube::util::wait_for_url "http://127.0.0.1:${API_PORT}/api/v1/nodes/127.0.0.1" "apiserver(nodes)"
else
# create a fake node
kubectl create -f - -s "http://127.0.0.1:${API_PORT}" << __EOF__
{
"kind": "Node",
"apiVersion": "v1",
"metadata": {
"name": "127.0.0.1"
},
"status": {
"capacity": {
"memory": "1Gi"
}
}
}
__EOF__
fi
# Expose kubectl directly for readability
PATH="${KUBE_OUTPUT_HOSTBIN}":$PATH