Skip to content

Commit

Permalink
Merge pull request #5277 from openshift-cherrypick-robot/cherry-pick-…
Browse files Browse the repository at this point in the history
…5271-to-release-4.9

[release-4.9] Bug 2011701: do not modify cvo ignores for bootstrap-in-place
  • Loading branch information
openshift-merge-robot committed Oct 7, 2021
2 parents 514b839 + 3568bd0 commit 5be9076
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 14 deletions.
30 changes: 18 additions & 12 deletions data/data/bootstrap/files/usr/local/bin/bootkube.sh.template
Expand Up @@ -420,22 +420,28 @@ then
fi
fi

if [ ! -f cvo-overrides.done ]
then
record_service_stage_start "cvo-overrides"
# remove overrides for installer manifests and restore any user-supplied overrides
oc patch clusterversion.config.openshift.io version \
--kubeconfig=/opt/openshift/auth/kubeconfig \
--type=merge \
--patch-file=/opt/openshift/original_cvo_overrides.patch
touch cvo-overrides.done
record_service_stage_success
fi

if [ "$BOOTSTRAP_INPLACE" = true ]
then
. /usr/local/bin/bootstrap-in-place.sh "${CLUSTER_BOOTSTRAP_IMAGE}"
else
if [ ! -f cvo-overrides.done ]
then
record_service_stage_start "cvo-overrides"
# remove overrides for installer manifests and restore any user-supplied overrides
echo "Restoring CVO overrides"
until \
oc patch clusterversion.config.openshift.io version \
--kubeconfig=/opt/openshift/auth/kubeconfig \
--type=merge \
--patch-file=/opt/openshift/original_cvo_overrides.patch
do
sleep 10
echo "Trying again to restore CVO overrides"
done
touch cvo-overrides.done
record_service_stage_success
fi

rm --force /etc/kubernetes/manifests/machineconfigoperator-bootstrap-pod.yaml

if [ ! -z "$CLUSTER_ETCD_OPERATOR_IMAGE" ]
Expand Down
18 changes: 18 additions & 0 deletions pkg/asset/ignition/bootstrap/bootstrap.go
Expand Up @@ -2,6 +2,7 @@ package bootstrap

import (
"github.com/openshift/installer/pkg/asset"
"github.com/openshift/installer/pkg/asset/ignition"
)

const (
Expand All @@ -15,12 +16,29 @@ type Bootstrap struct {

var _ asset.WritableAsset = (*Bootstrap)(nil)

// Dependencies returns the assets on which the Bootstrap asset depends.
func (a *Bootstrap) Dependencies() []asset.Asset {
return append(
a.Common.Dependencies(),
&CVOIgnore{},
)
}

// Generate generates the ignition config for the Bootstrap asset.
func (a *Bootstrap) Generate(dependencies asset.Parents) error {
templateData := a.getTemplateData(dependencies, false)
if err := a.generateConfig(dependencies, templateData); err != nil {
return err
}

// replace cvo-overrides.yaml so that CVO does not try to create resources for the manifests that the installer
// is supplying to cluster-bootstrap
cvoIgnore := &CVOIgnore{}
dependencies.Get(cvoIgnore)
for _, file := range ignition.FilesFromAsset(rootDir, "root", 0644, cvoIgnore) {
a.Config.Storage.Files = replaceOrAppend(a.Config.Storage.Files, file)
}

if err := a.generateFile(bootstrapIgnFilename); err != nil {
return err
}
Expand Down
2 changes: 0 additions & 2 deletions pkg/asset/ignition/bootstrap/common.go
Expand Up @@ -97,7 +97,6 @@ type Common struct {
func (a *Common) Dependencies() []asset.Asset {
return []asset.Asset{
&baremetal.IronicCreds{},
&CVOIgnore{},
&installconfig.InstallConfig{},
&kubeconfig.AdminInternalClient{},
&kubeconfig.Kubelet{},
Expand Down Expand Up @@ -487,7 +486,6 @@ func (a *Common) addParentFiles(dependencies asset.Parents) {
&machines.Worker{},
&mcign.MasterIgnitionCustomizations{},
&mcign.WorkerIgnitionCustomizations{},
&CVOIgnore{}, // this must come after manifests.Manifests so that it replaces cvo-overrides.yaml
} {
dependencies.Get(asset)

Expand Down

0 comments on commit 5be9076

Please sign in to comment.