[Federation] Account for caching in kubectl

This commit is contained in:
Christian Bell 2017-06-23 11:39:56 -07:00
parent afc4506c33
commit 27230004ec

View File

@ -81,14 +81,14 @@ function init() {
kube::log::status "DNS_ZONE_NAME: \"${DNS_ZONE_NAME}\", DNS_PROVIDER: \"${DNS_PROVIDER}\"" kube::log::status "DNS_ZONE_NAME: \"${DNS_ZONE_NAME}\", DNS_PROVIDER: \"${DNS_PROVIDER}\""
kube::log::status "Image: \"${kube_registry}/hyperkube-amd64:${kube_version}\"" kube::log::status "Image: \"${kube_registry}/hyperkube-amd64:${kube_version}\""
# The very first thing that kubefed does when it comes up is run RBAC # The very first thing that kubefed does when it comes up is run RBAC API
# API discovery. We believe this sometimes fail on new clusters and as # discovery. If it doesn't appear to be available, issue 'get role' to ensure
# a result causes kubefed to assume that the RBAC API doesn't exist. # that kubectl updates its cache.
# Therefore, we are applying this workaround for now to ensure that the ${KUBE_ROOT}/cluster/kubectl.sh get role
# RBAC API is available before running kubefed.
timeout 1m bash <<EOF timeout 1m bash <<EOF
while [[ ! "$(${KUBE_ROOT}/cluster/kubectl.sh api-versions)" =~ "rbac.authorization.k8s.io/" ]]; do while [[ ! "$(${KUBE_ROOT}/cluster/kubectl.sh api-versions)" =~ "rbac.authorization.k8s.io/" ]]; do
kube::log::status "Waiting for rbac.authorization.k8s.io API group to appear" ${KUBE_ROOT}/cluster/kubectl.sh get role
echo "Waiting for rbac.authorization.k8s.io API group to appear"
sleep 2 sleep 2
done done
EOF EOF