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

[release-4.9] Bug 2011701: do not modify cvo ignores for bootstrap-in-place #5277

Merged
Show file tree
Hide file tree
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
30 changes: 18 additions & 12 deletions data/data/bootstrap/files/usr/local/bin/bootkube.sh.template
Original file line number Diff line number Diff line change
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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this step never necessary(and never will be necessary?) for a BIP flow?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The CVOIgnore asset is only used for the normal bootstrap ignition and not the bootstrap-in-place ignition [1]. That asset is responsible for replacing the ClusterVersion manifest created by the Common Manifests asset [2] with one that adds all of the resources created by installer manifests to the .spec.overrides field.

The line in question here restores the spec.overrides field to whatever the user specified (or the default empty if the user made no changes). If the install is a bootstrap-in-place, then the installer did not modify the .spec.overrides field and so the bootstrap does not need to restore the field.

[1] https://github.com/openshift/installer/pull/5277/files#diff-cc0fbb14ee7d67263a33bebe0004691706613a326f49183d3748d1cecf46e096R36
[2]

&bootkube.CVOOverrides{},

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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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