Merge pull request #108313 from zshihang/gce

wait for default service account instead of its token
This commit is contained in:
Kubernetes Prow Robot 2022-02-24 11:40:31 -08:00 committed by GitHub
commit 673fa1d9d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 10 deletions

View File

@ -15,7 +15,7 @@
IMAGE=gcr.io/k8s-staging-addon-manager/kube-addon-manager
ARCH?=amd64
TEMP_DIR:=$(shell mktemp -d)
VERSION=v9.1.5
VERSION=v9.1.6
KUBECTL_VERSION?=v1.20.2
BASEIMAGE=k8s.gcr.io/debian-base-$(ARCH):v1.0.1

View File

@ -35,18 +35,14 @@ fi
log INFO "== Kubernetes addon manager started at $(date -Is) with ADDON_CHECK_INTERVAL_SEC=${ADDON_CHECK_INTERVAL_SEC} =="
# Wait for the default service account to be created in the kube-system namespace.
token_found=""
while [ -z "${token_found}" ]; do
sleep 0.5
# shellcheck disable=SC2086
# Disabling because "${KUBECTL_OPTS}" needs to allow for expansion here
if ! token_found=$(${KUBECTL} ${KUBECTL_OPTS} get --namespace="${SYSTEM_NAMESPACE}" serviceaccount default -o go-template="{{with index .secrets 0}}{{.name}}{{end}}"); then
token_found="";
while ! ${KUBECTL} ${KUBECTL_OPTS} get --namespace="${SYSTEM_NAMESPACE}" serviceaccount default; do
log WRN "== Error getting default service account, retry in 0.5 second =="
fi
sleep 0.5
done
log INFO "== Default service account in the ${SYSTEM_NAMESPACE} namespace has token ${token_found} =="
log INFO "== Default service account in the ${SYSTEM_NAMESPACE} namespace =="
# Create admission_control objects if defined before any other addon services. If the limits
# are defined in a namespace other than default, we should still create the limits for the