mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-21 19:01:49 +00:00
Merge pull request #108313 from zshihang/gce
wait for default service account instead of its token
This commit is contained in:
commit
673fa1d9d4
@ -15,7 +15,7 @@
|
|||||||
IMAGE=gcr.io/k8s-staging-addon-manager/kube-addon-manager
|
IMAGE=gcr.io/k8s-staging-addon-manager/kube-addon-manager
|
||||||
ARCH?=amd64
|
ARCH?=amd64
|
||||||
TEMP_DIR:=$(shell mktemp -d)
|
TEMP_DIR:=$(shell mktemp -d)
|
||||||
VERSION=v9.1.5
|
VERSION=v9.1.6
|
||||||
KUBECTL_VERSION?=v1.20.2
|
KUBECTL_VERSION?=v1.20.2
|
||||||
|
|
||||||
BASEIMAGE=k8s.gcr.io/debian-base-$(ARCH):v1.0.1
|
BASEIMAGE=k8s.gcr.io/debian-base-$(ARCH):v1.0.1
|
||||||
|
@ -35,18 +35,14 @@ fi
|
|||||||
log INFO "== Kubernetes addon manager started at $(date -Is) with ADDON_CHECK_INTERVAL_SEC=${ADDON_CHECK_INTERVAL_SEC} =="
|
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.
|
# Wait for the default service account to be created in the kube-system namespace.
|
||||||
token_found=""
|
# shellcheck disable=SC2086
|
||||||
while [ -z "${token_found}" ]; do
|
# Disabling because "${KUBECTL_OPTS}" needs to allow for expansion here
|
||||||
sleep 0.5
|
while ! ${KUBECTL} ${KUBECTL_OPTS} get --namespace="${SYSTEM_NAMESPACE}" serviceaccount default; do
|
||||||
# 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="";
|
|
||||||
log WRN "== Error getting default service account, retry in 0.5 second =="
|
log WRN "== Error getting default service account, retry in 0.5 second =="
|
||||||
fi
|
sleep 0.5
|
||||||
done
|
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
|
# 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
|
# are defined in a namespace other than default, we should still create the limits for the
|
||||||
|
Loading…
Reference in New Issue
Block a user