diff --git a/cmd/openshift-install/create.go b/cmd/openshift-install/create.go index 4ab59bb9b91..40a333488be 100644 --- a/cmd/openshift-install/create.go +++ b/cmd/openshift-install/create.go @@ -229,7 +229,7 @@ func destroyBootstrap(ctx context.Context, config *rest.Config, directory string events := client.CoreV1().Events("kube-system") eventTimeout := 30 * time.Minute - logrus.Infof("Waiting up to %v for the bootstrap-complete event...", eventTimeout) + logrus.Infof("Waiting up to %v for the bootstrap-success event...", eventTimeout) eventContext, cancel := context.WithTimeout(ctx, eventTimeout) defer cancel() _, err = Until( @@ -268,11 +268,11 @@ func destroyBootstrap(ctx context.Context, config *rest.Config, directory string } logrus.Debugf("added %s: %s", event.Name, event.Message) - return event.Name == "bootstrap-complete", nil + return event.Name == "bootstrap-success", nil }, ) if err != nil { - return errors.Wrap(err, "waiting for bootstrap-complete") + return errors.Wrap(err, "waiting for bootstrap-success") } logrus.Info("Destroying the bootstrap resources...") diff --git a/data/data/bootstrap/files/usr/local/bin/bootkube.sh.template b/data/data/bootstrap/files/usr/local/bin/bootkube.sh.template index a2fe578870b..4fe0616d537 100755 --- a/data/data/bootstrap/files/usr/local/bin/bootkube.sh.template +++ b/data/data/bootstrap/files/usr/local/bin/bootkube.sh.template @@ -211,7 +211,11 @@ podman run \ --volume /etc/kubernetes:/etc/kubernetes:z \ --network=host \ "${CLUSTER_BOOTSTRAP_IMAGE}" \ - start --asset-dir=/assets --required-pods openshift-kube-apiserver/openshift-kube-apiserver,openshift-kube-scheduler/openshift-kube-scheduler,openshift-kube-controller-manager/openshift-kube-controller-manager,openshift-cluster-version/cluster-version-operator + start \ + --asset-dir=/assets \ + --strict \ + --tear-down-event run-forever \ + --required-pods openshift-kube-apiserver/openshift-kube-apiserver,openshift-kube-scheduler/openshift-kube-scheduler,openshift-kube-controller-manager/openshift-kube-controller-manager,openshift-cluster-version/cluster-version-operator # Workaround for https://github.com/opencontainers/runc/pull/1807 touch /opt/openshift/.bootkube.done diff --git a/data/data/bootstrap/files/usr/local/bin/openshift.sh b/data/data/bootstrap/files/usr/local/bin/openshift.sh deleted file mode 100755 index 6dcdbb52fd9..00000000000 --- a/data/data/bootstrap/files/usr/local/bin/openshift.sh +++ /dev/null @@ -1,71 +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 -} - -wait_for_pods() { - echo "Waiting for pods in namespace $1..." - while true - do - out=$(kubectl --namespace "$1" get pods --output custom-columns=STATUS:.status.phase,NAME:.metadata.name --no-headers=true) - echo "$out" - - # make sure kubectl returns at least one status - if [ "$(wc --lines <<< "$out")" -eq 0 ] - then - echo "No pods were found. Waiting for 5 seconds..." - sleep 5 - continue - fi - - if ! grep --invert-match '^Running' <<< "$out" - then - return - fi - - echo "Not all pods available yet. Waiting for 5 seconds..." - sleep 5 - done - set -e -} - -# Wait for Kubernetes pods -wait_for_pods kube-system - -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" diff --git a/data/data/bootstrap/files/usr/local/bin/report-progress.sh b/data/data/bootstrap/files/usr/local/bin/report-progress.sh deleted file mode 100755 index d3245c31c4e..00000000000 --- a/data/data/bootstrap/files/usr/local/bin/report-progress.sh +++ /dev/null @@ -1,38 +0,0 @@ -#!/usr/bin/env bash - -KUBECONFIG="${1}" -NAME="${2}" -MESSAGE="${3}" - -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 - -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 diff --git a/data/data/bootstrap/systemd/units/openshift.service b/data/data/bootstrap/systemd/units/openshift.service deleted file mode 100644 index c09bc11e709..00000000000 --- a/data/data/bootstrap/systemd/units/openshift.service +++ /dev/null @@ -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 - -Restart=on-failure -RestartSec=5s diff --git a/data/data/bootstrap/systemd/units/progress.service b/data/data/bootstrap/systemd/units/progress.service deleted file mode 100644 index a66554a1871..00000000000 --- a/data/data/bootstrap/systemd/units/progress.service +++ /dev/null @@ -1,14 +0,0 @@ -[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 - -[Service] -ExecStart=/usr/local/bin/report-progress.sh /opt/openshift/auth/kubeconfig bootstrap-complete "cluster bootstrapping has completed" - -Restart=on-failure -RestartSec=5s - -[Install] -WantedBy=multi-user.target diff --git a/docs/design/assetgeneration.md b/docs/design/assetgeneration.md index 24a4587ab43..fa61de13d0f 100644 --- a/docs/design/assetgeneration.md +++ b/docs/design/assetgeneration.md @@ -76,7 +76,7 @@ $ openshift-install create install-config # Generate install-config.yaml $ openshift-install create manifests -# Generate manifests/ and openshift/ dir, also remove install-config.yaml +# Generate manifests/ and post-pod-manifests/ directories, also remove install-config.yaml ``` ## Target generation diff --git a/docs/user/aws/install.md b/docs/user/aws/install.md index e5dfac51690..b80596a64e5 100644 --- a/docs/user/aws/install.md +++ b/docs/user/aws/install.md @@ -23,7 +23,7 @@ Step 3: Download the Installer. [~]$ openshift-install-linux-amd64 create cluster INFO Waiting up to 30m0s for the Kubernetes API... INFO API v1.11.0+85a0623 up -INFO Waiting up to 30m0s for the bootstrap-complete event... +INFO Waiting up to 30m0s for the bootstrap-success event... INFO Destroying the bootstrap resources... INFO Waiting up to 10m0s for the openshift-console route to be created... INFO Install complete! diff --git a/pkg/asset/ignition/bootstrap/bootstrap.go b/pkg/asset/ignition/bootstrap/bootstrap.go index fde8a392660..14c09a8e156 100644 --- a/pkg/asset/ignition/bootstrap/bootstrap.go +++ b/pkg/asset/ignition/bootstrap/bootstrap.go @@ -221,7 +221,7 @@ func (a *Bootstrap) addStorageFiles(base string, uri string, templateData *boots func (a *Bootstrap) addSystemdUnits(uri string, templateData *bootstrapTemplateData) (err error) { enabled := map[string]struct{}{ - "progress.service": {}, + "bootkube.service": {}, "kubelet.service": {}, "systemd-journal-gatewayd.socket": {}, } diff --git a/pkg/asset/manifests/openshift.go b/pkg/asset/manifests/openshift.go index 67a3c7fb34c..bfa6a0d1668 100644 --- a/pkg/asset/manifests/openshift.go +++ b/pkg/asset/manifests/openshift.go @@ -23,7 +23,7 @@ import ( ) const ( - openshiftManifestDir = "openshift" + openshiftManifestDir = "post-pod-manifests" ) var (