Merge pull request #65453 from apelisse/debug-hack-script

Automatic merge from submit-queue (batch tested with PRs 65453, 65523, 65513, 65560). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Print error when APIServer fails to start

**What this PR does / why we need it**: Print apiserver logs when it fails to start.
This is copied from `update-swagger-spec.sh`.

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
This commit is contained in:
Kubernetes Submit Queue 2018-06-27 22:30:02 -07:00 committed by GitHub
commit 6a2c0c84ca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 3 deletions

View File

@ -53,6 +53,7 @@ ETCD_HOST=${ETCD_HOST:-127.0.0.1}
ETCD_PORT=${ETCD_PORT:-2379}
API_PORT=${API_PORT:-8050}
API_HOST=${API_HOST:-127.0.0.1}
API_LOGFILE=${API_LOGFILE:-/tmp/openapi-api-server.log}
kube::etcd::start
@ -71,10 +72,16 @@ kube::log::status "Starting kube-apiserver"
--token-auth-file=$TMP_DIR/tokenauth.csv \
--logtostderr \
--v=2 \
--service-cluster-ip-range="10.0.0.0/24" >/tmp/openapi-api-server.log 2>&1 &
--service-cluster-ip-range="10.0.0.0/24" >"${API_LOGFILE}" 2>&1 &
APISERVER_PID=$!
kube::util::wait_for_url "${API_HOST}:${API_PORT}/healthz" "apiserver: "
if ! kube::util::wait_for_url "${API_HOST}:${API_PORT}/healthz" "apiserver: "; then
kube::log::error "Here are the last 10 lines from kube-apiserver (${API_LOGFILE})"
kube::log::error "=== BEGIN OF LOG ==="
tail -10 "${API_LOGFILE}" || :
kube::log::error "=== END OF LOG ==="
exit 1
fi
kube::log::status "Updating " ${OPENAPI_ROOT_DIR}

View File

@ -58,7 +58,7 @@ ETCD_HOST=${ETCD_HOST:-127.0.0.1}
ETCD_PORT=${ETCD_PORT:-2379}
API_PORT=${API_PORT:-8050}
API_HOST=${API_HOST:-127.0.0.1}
API_LOGFILE=/tmp/swagger-api-server.log
API_LOGFILE=${API_LOGFILE:-/tmp/swagger-api-server.log}
kube::etcd::start