Skip to content

Commit

Permalink
Merge pull request #1101 from crawford/retry-progress-report
Browse files Browse the repository at this point in the history
data/bootstrap: retry when reporting progress
  • Loading branch information
openshift-merge-robot authored Jan 19, 2019
2 parents 3711aae + 3aae55e commit d127242
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 21 deletions.
48 changes: 30 additions & 18 deletions data/data/bootstrap/files/usr/local/bin/report-progress.sh
Original file line number Diff line number Diff line change
@@ -1,26 +1,38 @@
#!/usr/bin/env bash
set -e

KUBECONFIG="${1}"
NAME="${2}"
MESSAGE="${3}"
TIMESTAMP="$(date -u +'%Y-%m-%dT%H:%M:%SZ')"

echo "Reporting install progress..."
wait_for_existance() {
while [ ! -e "${1}" ]
do
sleep 5
done
}

echo "Waiting for bootstrap to complete..."
wait_for_existance /opt/openshift/.bootkube.done
wait_for_existance /opt/openshift/.openshift.done

oc --config="$KUBECONFIG" create -f - <<EOF
apiVersion: v1
kind: Event
metadata:
name: "${NAME}"
namespace: kube-system
involvedObject:
namespace: kube-system
message: "${MESSAGE}"
firstTimestamp: "${TIMESTAMP}"
lastTimestamp: "${TIMESTAMP}"
count: 1
source:
component: cluster
host: $(hostname)
echo "Reporting install progress..."
timestamp="$(date -u +'%Y-%m-%dT%H:%M:%SZ')"
while ! oc --config="$KUBECONFIG" create -f - <<-EOF
apiVersion: v1
kind: Event
metadata:
name: "${NAME}"
namespace: kube-system
involvedObject:
namespace: kube-system
message: "${MESSAGE}"
firstTimestamp: "${timestamp}"
lastTimestamp: "${timestamp}"
count: 1
source:
component: cluster
host: $(hostname)
EOF
do
sleep 5
done
3 changes: 0 additions & 3 deletions data/data/bootstrap/systemd/units/progress.service
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ Wants=bootkube.service openshift.service
After=bootkube.service openshift.service

[Service]
# Workaround for https://github.com/systemd/systemd/issues/1312 and https://github.com/opencontainers/runc/pull/1807
ExecStartPre=/usr/bin/test -f /opt/openshift/.bootkube.done
ExecStartPre=/usr/bin/test -f /opt/openshift/.openshift.done
ExecStart=/usr/local/bin/report-progress.sh /opt/openshift/auth/kubeconfig bootstrap-complete "cluster bootstrapping has completed"

Restart=on-failure
Expand Down

0 comments on commit d127242

Please sign in to comment.