Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Retry object creation with --validate in kube-addons #5330

Merged
merged 1 commit into from
Mar 16, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 15 additions & 2 deletions cluster/saltbase/salt/kube-addons/kube-addons.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,23 @@
# The business logic for whether a given object should be created
# was already enforced by salt, and /etc/kubernetes/addons is the
# managed result is of that. Start everything below that directory.
echo "== Kubernetes addon manager started at $(date -Is) =="
KUBECTL=/usr/local/bin/kubectl

function create-object() {
obj=$1

for tries in {1..5}; do
if ${KUBECTL} --server="127.0.0.1:8080" create --validate=true -f ${obj}; then
return
fi
echo "++ ${obj} failed, attempt ${try} (sleeping 5) ++"
sleep 5
done
}

echo "== Kubernetes addon manager started at $(date -Is) =="
for obj in $(find /etc/kubernetes/addons -name \*.yaml); do
${KUBECTL} --server="127.0.0.1:8080" create -f ${obj} &
create-object ${obj} &
echo "++ addon ${obj} started in pid $! ++"
done
noerrors="true"
Expand Down