Skip to content

Commit

Permalink
Merge pull request #17613 from stevekuznetsov/skuznets/server-startup…
Browse files Browse the repository at this point in the history
…-logic

Automatic merge from submit-queue.

Poll for server start using impersonation

When we poll for server start on `/healthz` and/or `/healthz/ready` with
the administrative `$KUBECONFIG` we do so as part of the
`system:masters` group and therefore the response fromt these endpoints
will succeed before the RBAC system is initialized as we bypass it.
Using impersonation here allows the poll on these endpoints to not only
wait for the server to start but also to wait for the RBAC
initialization.

Signed-off-by: Steve Kuznetsov <[email protected]>

/cc @liggitt @deads2k @enj 
Fixes #17574
  • Loading branch information
openshift-merge-robot authored Dec 5, 2017
2 parents 5a8373a + bba1e13 commit a70cac6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
16 changes: 8 additions & 8 deletions hack/lib/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -275,8 +275,8 @@ function os::start::master() {
os::log::debug "OpenShift server start at: $( date )"

os::test::junit::declare_suite_start "setup/start-master"
os::cmd::try_until_text "oc get --raw /healthz --config='${ADMIN_KUBECONFIG}'" 'ok' $(( 160 * second )) 0.25
os::cmd::try_until_text "oc get --raw /healthz/ready --config='${ADMIN_KUBECONFIG}'" 'ok' $(( 160 * second )) 0.25
os::cmd::try_until_text "oc get --raw /healthz --as system:unauthenticated --config='${ADMIN_KUBECONFIG}'" 'ok' $(( 160 * second )) 0.25
os::cmd::try_until_text "oc get --raw /healthz/ready --as system:unauthenticated --config='${ADMIN_KUBECONFIG}'" 'ok' $(( 160 * second )) 0.25
os::cmd::try_until_success "oc get service kubernetes --namespace default --config='${ADMIN_KUBECONFIG}'" $(( 160 * second )) 0.25
os::test::junit::declare_suite_end

Expand Down Expand Up @@ -329,9 +329,9 @@ function os::start::all_in_one() {
os::log::debug "OpenShift server start at: $( date )"

os::test::junit::declare_suite_start "setup/start-all_in_one"
os::cmd::try_until_text "oc get --raw /healthz --config='${ADMIN_KUBECONFIG}'" 'ok' $(( 80 * second )) 0.25
os::cmd::try_until_text "oc get --raw ${KUBELET_SCHEME}://${KUBELET_HOST}:${KUBELET_PORT}/healthz --config='${ADMIN_KUBECONFIG}'" 'ok' $(( 2 * minute )) 0.5
os::cmd::try_until_text "oc get --raw /healthz/ready --config='${ADMIN_KUBECONFIG}'" 'ok' $(( 80 * second )) 0.25
os::cmd::try_until_text "oc get --raw /healthz --as system:unauthenticated --config='${ADMIN_KUBECONFIG}'" 'ok' $(( 80 * second )) 0.25
os::cmd::try_until_text "oc get --raw ${KUBELET_SCHEME}://${KUBELET_HOST}:${KUBELET_PORT}/healthz --as system:unauthenticated --config='${ADMIN_KUBECONFIG}'" 'ok' $(( 2 * minute )) 0.5
os::cmd::try_until_text "oc get --raw /healthz/ready --as system:unauthenticated --config='${ADMIN_KUBECONFIG}'" 'ok' $(( 80 * second )) 0.25
os::cmd::try_until_success "oc get service kubernetes --namespace default --config='${ADMIN_KUBECONFIG}'" $(( 160 * second )) 0.25
os::cmd::try_until_success "oc get --raw /api/v1/nodes/${KUBELET_HOST} --config='${ADMIN_KUBECONFIG}'" $(( 80 * second )) 0.25
os::test::junit::declare_suite_end
Expand Down Expand Up @@ -403,8 +403,8 @@ function os::start::api_server() {
os::log::debug "OpenShift API server start at: $( date )"

os::test::junit::declare_suite_start "setup/start-api_server"
os::cmd::try_until_text "oc get --raw /healthz --config='${ADMIN_KUBECONFIG}'" 'ok' $(( 80 * second )) 0.25
os::cmd::try_until_text "oc get --raw /healthz/ready --config='${ADMIN_KUBECONFIG}'" 'ok' $(( 160 * second )) 0.25
os::cmd::try_until_text "oc get --raw /healthz --as system:unauthenticated --config='${ADMIN_KUBECONFIG}'" 'ok' $(( 80 * second )) 0.25
os::cmd::try_until_text "oc get --raw /healthz/ready --as system:unauthenticated --config='${ADMIN_KUBECONFIG}'" 'ok' $(( 160 * second )) 0.25
os::test::junit::declare_suite_end

os::log::debug "OpenShift API server health checks done at: $( date )"
Expand Down Expand Up @@ -473,7 +473,7 @@ function os::start::internal::start_node() {
os::log::debug "OpenShift node start at: $( date )"

os::test::junit::declare_suite_start "setup/start-node"
os::cmd::try_until_text "oc get --raw ${KUBELET_SCHEME}://${KUBELET_HOST}:${KUBELET_PORT}/healthz --config='${ADMIN_KUBECONFIG}'" 'ok' $(( 80 * second )) 0.25
os::cmd::try_until_text "oc get --raw ${KUBELET_SCHEME}://${KUBELET_HOST}:${KUBELET_PORT}/healthz --as system:unauthenticated --config='${ADMIN_KUBECONFIG}'" 'ok' $(( 80 * second )) 0.25
os::test::junit::declare_suite_end

os::log::debug "OpenShift node health checks done at: $( date )"
Expand Down
6 changes: 3 additions & 3 deletions test/extended/alternate_launches.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ sudo env "PATH=${PATH}" OPENSHIFT_PROFILE=web OPENSHIFT_ON_PANIC=crash openshift
--loglevel=4 \
&>"${LOG_DIR}/os-apiserver.log" &

os::cmd::try_until_text "oc get --raw /healthz --config='${MASTER_CONFIG_DIR}/admin.kubeconfig'" 'ok' $(( 80 * second )) 0.25
os::cmd::try_until_text "oc get --raw /healthz/ready --config='${MASTER_CONFIG_DIR}/admin.kubeconfig'" 'ok' $(( 80 * second )) 0.25
os::cmd::try_until_text "oc get --raw /healthz --as system:unauthenticated --config='${MASTER_CONFIG_DIR}/admin.kubeconfig'" 'ok' $(( 80 * second )) 0.25
os::cmd::try_until_text "oc get --raw /healthz/ready --as system:unauthenticated --config='${MASTER_CONFIG_DIR}/admin.kubeconfig'" 'ok' $(( 80 * second )) 0.25
os::log::info "OpenShift API server up at: "
date

Expand Down Expand Up @@ -131,7 +131,7 @@ export OS_PID=$!
os::log::info "OpenShift server start at: "
date

os::cmd::try_until_text "oc get --raw ${KUBELET_SCHEME}://${KUBELET_HOST}:${KUBELET_PORT}/healthz --config='${MASTER_CONFIG_DIR}/admin.kubeconfig'" 'ok' minute 0.5
os::cmd::try_until_text "oc get --raw ${KUBELET_SCHEME}://${KUBELET_HOST}:${KUBELET_PORT}/healthz --as system:unauthenticated --config='${MASTER_CONFIG_DIR}/admin.kubeconfig'" 'ok' minute 0.5
os::cmd::try_until_success "oc get --raw /api/v1/nodes/${KUBELET_HOST} --config='${MASTER_CONFIG_DIR}/admin.kubeconfig'" $(( 80 * second )) 0.25
os::log::info "OpenShift node health checks done at: "
date
Expand Down

0 comments on commit a70cac6

Please sign in to comment.