1
0
mirror of https://github.com/openshift/installer.git synced 2026-02-05 15:47:14 +01:00

data/bootstrap: Replace openshift.sh with cluster-bootstrap

With this commit, I take advantage of
openshift/cluster-bootstrap@fc5e0941 (start: wire the library-go
dynamic client create, 2019-02-05, openshift/cluster-bootstrap#14) to
replace our previous openshift.sh (with a minor change to the manifest
directory).  I'm currently using a cp in bootkube.sh to shift those
manifests into the generic directory; I plan on consolidating
Openshift into Manifests in pkg/asset/manifests in follow-up work.

This change is especially important since the pivot to loopback
kubeconfigs in openshift.sh: 82d81d9f53 (data/data/bootstrap: use
loopback kubeconfig for API access, 2019-07-24, #2086), because once
cluster-bootstrap (launched from bootkube.sh) decides it's done it
tears down the bootstrap control plane.  Without the bootstrap control
plane, further attempts by openshift.sh to push manifests via the
loopback kubeconfig fail [1].

We could roll reporting into bootkube.sh as well (dropping
progress.service), but Abhinav wanted to keep it separate [2].

[1]: https://bugzilla.redhat.com/show_bug.cgi?id=1748452
[2]: https://github.com/openshift/installer/pull/1381#issuecomment-531878733
This commit is contained in:
W. Trevor King
2019-01-24 04:22:28 -08:00
parent 40ac25c1d0
commit 108a45bdb1
7 changed files with 10 additions and 59 deletions

View File

@@ -48,6 +48,13 @@ systemctl restart cri-o.service
mkdir --parents ./{bootstrap-manifests,manifests}
if [ ! -f openshift-manifests.done ]
then
echo "Moving OpenShift manifests in with the rest of them"
cp openshift/* manifests/
touch openshift-manifests.done
fi
if [ ! -f cvo-bootstrap.done ]
then
echo "Rendering Cluster Version Operator Manifests..."

View File

@@ -4,7 +4,7 @@ ARTIFACTS="/tmp/artifacts"
echo "Gathering bootstrap journals ..."
mkdir -p "${ARTIFACTS}/bootstrap/journals"
for service in release-image bootkube openshift kubelet crio approve-csr
for service in release-image bootkube kubelet crio approve-csr
do
journalctl --boot --no-pager --output=short --unit="${service}" > "${ARTIFACTS}/bootstrap/journals/${service}.log"
done

View File

@@ -1,42 +0,0 @@
#!/usr/bin/env bash
set -e
KUBECONFIG="$1"
kubectl() {
echo "Executing kubectl $*" >&2
while true
do
set +e
out=$(oc --config="$KUBECONFIG" "$@" 2>&1)
status=$?
set -e
if grep --quiet "AlreadyExists" <<< "$out"
then
echo "$out, skipping" >&2
return
fi
echo "$out"
if [ "$status" -eq 0 ]
then
return
fi
echo "kubectl $* failed. Retrying in 5 seconds..." >&2
sleep 5
done
}
for file in $(find . -maxdepth 1 -type f | sort)
do
echo "Creating object from file: $file ..."
kubectl create --filename "$file"
echo "Done creating object from file: $file ..."
done
# Workaround for https://github.com/opencontainers/runc/pull/1807
touch /opt/openshift/.openshift.done
echo "OpenShift installation is done"

View File

@@ -11,7 +11,6 @@ wait_for_existance() {
echo "Waiting for bootstrap to complete..."
wait_for_existance /opt/openshift/.bootkube.done
wait_for_existance /opt/openshift/.openshift.done
echo "Reporting install progress..."
while ! oc --config="$KUBECONFIG" create -f - <<-EOF

View File

@@ -11,7 +11,6 @@ wait_for_existance() {
echo "Waiting for bootstrap to complete..."
wait_for_existance /opt/openshift/.bootkube.done
wait_for_existance /opt/openshift/.openshift.done
## remove the routes setup so that we can open up the blackhole
systemctl stop gcp-routes.service

View File

@@ -1,12 +0,0 @@
[Unit]
Description=Bootstrap an OpenShift cluster
Wants=bootkube.service
After=bootkube.service
ConditionPathExists=!/opt/openshift/.openshift.done
[Service]
WorkingDirectory=/opt/openshift/openshift
ExecStart=/usr/local/bin/openshift.sh /opt/openshift/auth/kubeconfig-loopback
Restart=on-failure
RestartSec=5s

View File

@@ -1,8 +1,8 @@
[Unit]
Description=Report the completion of the cluster bootstrap process
# Workaround for https://github.com/systemd/systemd/issues/1312
Wants=bootkube.service openshift.service
After=bootkube.service openshift.service
Wants=bootkube.service
After=bootkube.service
[Service]
ExecStart=/usr/local/bin/report-progress.sh /opt/openshift/auth/kubeconfig