2014-07-28 00:01:52 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# Copyright 2014 Google Inc. All rights reserved.
|
|
|
|
#
|
|
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
# you may not use this file except in compliance with the License.
|
|
|
|
# You may obtain a copy of the License at
|
|
|
|
#
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
#
|
|
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
# See the License for the specific language governing permissions and
|
|
|
|
# limitations under the License.
|
|
|
|
|
|
|
|
# This command checks that the built commands can function together for
|
|
|
|
# simple scenarios. It does not require Docker so it can run in travis.
|
|
|
|
|
2014-10-06 20:25:27 +00:00
|
|
|
set -o errexit
|
|
|
|
set -o nounset
|
|
|
|
set -o pipefail
|
|
|
|
|
2014-10-03 21:58:49 +00:00
|
|
|
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/..
|
2014-10-22 23:26:59 +00:00
|
|
|
source "${KUBE_ROOT}/hack/lib/init.sh"
|
2014-07-28 00:01:52 +00:00
|
|
|
|
|
|
|
function cleanup()
|
|
|
|
{
|
2014-10-06 20:25:27 +00:00
|
|
|
[[ -n ${APISERVER_PID-} ]] && kill ${APISERVER_PID} 1>&2 2>/dev/null
|
|
|
|
[[ -n ${CTLRMGR_PID-} ]] && kill ${CTLRMGR_PID} 1>&2 2>/dev/null
|
|
|
|
[[ -n ${KUBELET_PID-} ]] && kill ${KUBELET_PID} 1>&2 2>/dev/null
|
|
|
|
[[ -n ${PROXY_PID-} ]] && kill ${PROXY_PID} 1>&2 2>/dev/null
|
2014-10-22 23:26:59 +00:00
|
|
|
|
|
|
|
kube::etcd::cleanup
|
|
|
|
|
|
|
|
kube::log::status "Clean up complete"
|
2014-07-28 00:01:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
trap cleanup EXIT SIGINT
|
|
|
|
|
2014-10-22 23:26:59 +00:00
|
|
|
kube::etcd::start
|
2014-07-28 00:01:52 +00:00
|
|
|
|
2014-08-23 01:12:16 +00:00
|
|
|
ETCD_HOST=${ETCD_HOST:-127.0.0.1}
|
|
|
|
ETCD_PORT=${ETCD_PORT:-4001}
|
|
|
|
API_PORT=${API_PORT:-8080}
|
|
|
|
API_HOST=${API_HOST:-127.0.0.1}
|
|
|
|
KUBELET_PORT=${KUBELET_PORT:-10250}
|
2014-10-22 01:21:44 +00:00
|
|
|
CTLRMGR_PORT=${CTLRMGR_PORT:-10252}
|
2014-07-28 00:01:52 +00:00
|
|
|
|
2014-10-06 01:24:19 +00:00
|
|
|
# Check kubectl
|
2014-10-22 23:26:59 +00:00
|
|
|
kube::log::status "Running kubectl with no options"
|
|
|
|
"${KUBE_OUTPUT_HOSTBIN}/kubectl"
|
2014-07-28 00:01:52 +00:00
|
|
|
|
|
|
|
# Start kubelet
|
2014-10-22 23:26:59 +00:00
|
|
|
kube::log::status "Starting kubelet"
|
|
|
|
"${KUBE_OUTPUT_HOSTBIN}/kubelet" \
|
2014-11-03 14:24:47 +00:00
|
|
|
--root_dir=/tmp/kubelet.$$ \
|
2014-08-23 01:12:16 +00:00
|
|
|
--etcd_servers="http://${ETCD_HOST}:${ETCD_PORT}" \
|
2014-07-28 00:01:52 +00:00
|
|
|
--hostname_override="127.0.0.1" \
|
|
|
|
--address="127.0.0.1" \
|
|
|
|
--port="$KUBELET_PORT" 1>&2 &
|
|
|
|
KUBELET_PID=$!
|
|
|
|
|
2014-10-22 23:26:59 +00:00
|
|
|
kube::util::wait_for_url "http://127.0.0.1:${KUBELET_PORT}/healthz" "kubelet: "
|
2014-07-28 00:01:52 +00:00
|
|
|
|
|
|
|
# Start apiserver
|
2014-10-22 23:26:59 +00:00
|
|
|
kube::log::status "Starting apiserver"
|
|
|
|
"${KUBE_OUTPUT_HOSTBIN}/apiserver" \
|
2014-07-28 00:01:52 +00:00
|
|
|
--address="127.0.0.1" \
|
2014-11-01 16:19:13 +00:00
|
|
|
--public_address_override="127.0.0.1" \
|
2014-07-28 00:01:52 +00:00
|
|
|
--port="${API_PORT}" \
|
2014-08-23 01:12:16 +00:00
|
|
|
--etcd_servers="http://${ETCD_HOST}:${ETCD_PORT}" \
|
2014-10-10 22:19:23 +00:00
|
|
|
--kubelet_port=${KUBELET_PORT} \
|
2014-09-18 23:03:34 +00:00
|
|
|
--portal_net="10.0.0.0/24" 1>&2 &
|
2014-07-28 00:01:52 +00:00
|
|
|
APISERVER_PID=$!
|
|
|
|
|
2014-10-22 23:26:59 +00:00
|
|
|
kube::util::wait_for_url "http://127.0.0.1:${API_PORT}/healthz" "apiserver: "
|
|
|
|
|
|
|
|
kube_cmd=(
|
|
|
|
"${KUBE_OUTPUT_HOSTBIN}/kubectl"
|
|
|
|
)
|
|
|
|
|
|
|
|
kube_flags=(
|
|
|
|
-s "http://127.0.0.1:${API_PORT}"
|
|
|
|
--match-server-version
|
|
|
|
)
|
2014-07-28 00:01:52 +00:00
|
|
|
|
2014-10-22 01:21:44 +00:00
|
|
|
# Start controller manager
|
2014-10-22 23:26:59 +00:00
|
|
|
kube::log::status "Starting CONTROLLER-MANAGER"
|
|
|
|
"${KUBE_OUTPUT_HOSTBIN}/controller-manager" \
|
2014-10-22 01:21:44 +00:00
|
|
|
--machines="127.0.0.1" \
|
|
|
|
--master="127.0.0.1:${API_PORT}" 1>&2 &
|
|
|
|
CTLRMGR_PID=$!
|
|
|
|
|
2014-10-22 23:26:59 +00:00
|
|
|
kube::util::wait_for_url "http://127.0.0.1:${CTLRMGR_PORT}/healthz" "controller-manager: "
|
2014-10-22 01:21:44 +00:00
|
|
|
|
2014-10-22 23:26:59 +00:00
|
|
|
kube::log::status "Testing kubectl(pods)"
|
|
|
|
"${kube_cmd[@]}" get pods "${kube_flags[@]}"
|
2014-07-28 00:01:52 +00:00
|
|
|
|
2014-10-22 23:26:59 +00:00
|
|
|
kube::log::status "Testing kubectl(services)"
|
|
|
|
"${kube_cmd[@]}" get services "${kube_flags[@]}"
|
|
|
|
"${kube_cmd[@]}" create -f examples/guestbook/frontend-service.json "${kube_flags[@]}"
|
|
|
|
"${kube_cmd[@]}" delete service frontend "${kube_flags[@]}"
|
2014-07-28 00:01:52 +00:00
|
|
|
|
2014-10-22 23:26:59 +00:00
|
|
|
kube::log::status "Testing kubectl(minions)"
|
|
|
|
"${kube_cmd[@]}" get minions "${kube_flags[@]}"
|
|
|
|
"${kube_cmd[@]}" get minions 127.0.0.1 "${kube_flags[@]}"
|
2014-07-28 00:01:52 +00:00
|
|
|
|
2014-10-22 23:26:59 +00:00
|
|
|
kube::log::status "TEST PASSED"
|
2014-07-28 00:01:52 +00:00
|
|
|
|
|
|
|
# Start proxy
|
|
|
|
#PROXY_LOG=/tmp/kube-proxy.log
|
2014-10-22 23:26:59 +00:00
|
|
|
#${KUBE_OUTPUT_HOSTBIN}/proxy \
|
2014-07-28 00:01:52 +00:00
|
|
|
# --etcd_servers="http://127.0.0.1:${ETCD_PORT}" 1>&2 &
|
2014-07-25 19:28:20 +00:00
|
|
|
#PROXY_PID=$!
|