From a82a034082b76ef422f36dacbfafbdfe24232879 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Tue, 4 Oct 2022 13:27:16 -0400 Subject: [PATCH] Drop `machine-os-content` references xref https://github.com/openshift/enhancements/blob/master/enhancements/ocp-coreos-layering/ocp-coreos-layering.md This is part of https://issues.redhat.com/browse/MCO-392 --- cmd/machine-config-operator/bootstrap.go | 2 -- ...machine-config-operator_05_osimageurl.yaml | 2 +- install/image-references | 7 ---- pkg/controller/common/helpers.go | 11 ++----- pkg/operator/bootstrap.go | 1 - pkg/operator/images.go | 1 - pkg/operator/sync.go | 32 +++++-------------- 7 files changed, 11 insertions(+), 45 deletions(-) diff --git a/cmd/machine-config-operator/bootstrap.go b/cmd/machine-config-operator/bootstrap.go index 502345609c..5705981b16 100644 --- a/cmd/machine-config-operator/bootstrap.go +++ b/cmd/machine-config-operator/bootstrap.go @@ -133,7 +133,6 @@ func runBootstrapCmd(_ *cobra.Command, _ []string) { imgstream := resourceread.ReadImageStreamV1OrDie(imageRefData) bootstrapOpts.mcoImage = findImageOrDie(imgstream, "machine-config-operator") - bootstrapOpts.oscontentImage = findImageOrDie(imgstream, "machine-os-content") bootstrapOpts.keepalivedImage = findImageOrDie(imgstream, "keepalived-ipfailover") bootstrapOpts.corednsImage = findImageOrDie(imgstream, "coredns") bootstrapOpts.baremetalRuntimeCfgImage = findImageOrDie(imgstream, "baremetal-runtimecfg") @@ -155,7 +154,6 @@ func runBootstrapCmd(_ *cobra.Command, _ []string) { imgs := operator.Images{ RenderConfigImages: operator.RenderConfigImages{ MachineConfigOperator: bootstrapOpts.mcoImage, - MachineOSContent: bootstrapOpts.oscontentImage, KeepalivedBootstrap: bootstrapOpts.keepalivedImage, CorednsBootstrap: bootstrapOpts.corednsImage, BaremetalRuntimeCfgBootstrap: bootstrapOpts.baremetalRuntimeCfgImage, diff --git a/install/0000_80_machine-config-operator_05_osimageurl.yaml b/install/0000_80_machine-config-operator_05_osimageurl.yaml index 732c92d63b..255bf9658c 100644 --- a/install/0000_80_machine-config-operator_05_osimageurl.yaml +++ b/install/0000_80_machine-config-operator_05_osimageurl.yaml @@ -16,4 +16,4 @@ data: # The OS payload used for 4.10 and below; more information in # https://github.com/openshift/machine-config-operator/blob/master/docs/OSUpgrades.md # (The original issue was https://github.com/openshift/machine-config-operator/issues/183 ) - osImageURL: "placeholder.url.oc.will.replace.this.org/placeholdernamespace:machine-os-content" + osImageURL: "" diff --git a/install/image-references b/install/image-references index 47dfabadf2..69f4cbe986 100644 --- a/install/image-references +++ b/install/image-references @@ -20,13 +20,6 @@ spec: from: kind: DockerImage name: placeholder.url.oc.will.replace.this.org/placeholdernamespace:kube-rbac-proxy - # This one is special, it's the OS payload - # https://github.com/openshift/machine-config-operator/issues/183 - # See the machine-config-osimageurl configmap. - - name: machine-os-content - from: - kind: DockerImage - name: placeholder.url.oc.will.replace.this.org/placeholdernamespace:machine-os-content - name: rhel-coreos from: kind: DockerImage diff --git a/pkg/controller/common/helpers.go b/pkg/controller/common/helpers.go index f0b04e308e..74002dca3f 100644 --- a/pkg/controller/common/helpers.go +++ b/pkg/controller/common/helpers.go @@ -56,9 +56,6 @@ import ( "github.com/openshift/machine-config-operator/pkg/generated/clientset/versioned/scheme" ) -// Gates whether or not the MCO uses the new format base OS container image by default -var UseNewFormatImageByDefault = true - // strToPtr converts the input string to a pointer to itself func strToPtr(s string) *string { return &s @@ -1058,13 +1055,9 @@ func GetIgnitionFileDataByPath(config *ign3types.Config, path string) ([]byte, e return nil, nil } -// GetDefaultBaseImageContainer is kind of a "soft feature gate" for using the "new format" image by default, its behavior -// is determined by the "UseNewFormatImageByDefault" boolean +// GetDefaultBaseImageContainer returns the default bootable host base image. func GetDefaultBaseImageContainer(cconfigspec *mcfgv1.ControllerConfigSpec) string { - if UseNewFormatImageByDefault { - return cconfigspec.BaseOSContainerImage - } - return cconfigspec.OSImageURL + return cconfigspec.BaseOSContainerImage } // Configures common template FuncMaps used across all renderers. diff --git a/pkg/operator/bootstrap.go b/pkg/operator/bootstrap.go index 2ae3be03ae..5e4ec67e0c 100644 --- a/pkg/operator/bootstrap.go +++ b/pkg/operator/bootstrap.go @@ -138,7 +138,6 @@ func RenderBootstrap( spec.RootCAData = bundle spec.PullSecret = nil - spec.OSImageURL = imgs.MachineOSContent spec.BaseOSContainerImage = imgs.BaseOSContainerImage spec.BaseOSExtensionsContainerImage = imgs.BaseOSExtensionsContainerImage spec.ReleaseImage = releaseImage diff --git a/pkg/operator/images.go b/pkg/operator/images.go index 78e6da9a35..42bc7876cd 100644 --- a/pkg/operator/images.go +++ b/pkg/operator/images.go @@ -16,7 +16,6 @@ type Images struct { // RenderConfigImages are image names used to render templates under ./manifests/ type RenderConfigImages struct { MachineConfigOperator string `json:"machineConfigOperator"` - MachineOSContent string `json:"machineOSContent"` // The new format image BaseOSContainerImage string `json:"baseOSContainerImage"` // The matching extensions container for the new format image diff --git a/pkg/operator/sync.go b/pkg/operator/sync.go index 9c6a165335..9ca6f8ff18 100644 --- a/pkg/operator/sync.go +++ b/pkg/operator/sync.go @@ -497,11 +497,10 @@ func (optr *Operator) syncRenderConfig(_ *renderConfig) error { // sync up os image url // TODO: this should probably be part of the imgs - oscontainer, osextensionscontainer, osimageurl, err := optr.getOsImageURLs(optr.namespace) + oscontainer, osextensionscontainer, err := optr.getOsImageURLs(optr.namespace) if err != nil { return err } - imgs.MachineOSContent = osimageurl imgs.BaseOSContainerImage = oscontainer imgs.BaseOSExtensionsContainerImage = osextensionscontainer @@ -554,7 +553,6 @@ func (optr *Operator) syncRenderConfig(_ *renderConfig) error { spec.ImageRegistryBundleUserData = imgRegistryUsrData spec.PullSecret = &corev1.ObjectReference{Namespace: "openshift-config", Name: "pull-secret"} spec.InternalRegistryPullSecret = internalRegistryPullSecret - spec.OSImageURL = imgs.MachineOSContent spec.BaseOSContainerImage = imgs.BaseOSContainerImage spec.BaseOSExtensionsContainerImage = imgs.BaseOSExtensionsContainerImage spec.Images = map[string]string{ @@ -1197,19 +1195,13 @@ func (optr *Operator) syncRequiredMachineConfigPools(_ *renderConfig) error { _, hasRequiredPoolLabel := pool.Labels[requiredForUpgradeMachineConfigPoolLabelKey] if hasRequiredPoolLabel { - newFormatOpURL, _, opURL, err := optr.getOsImageURLs(optr.namespace) + opURL, _, err := optr.getOsImageURLs(optr.namespace) if err != nil { klog.Errorf("Error getting configmap osImageURL: %q", err) return false, nil } releaseVersion, _ := optr.vStore.Get("operator") - // TODO(jkyros): The operator looks at the osimageurl configmap directly, so we can't use - // our centralized default image selection helper, but we can still use the constant. - // This will come out once we drop machine-os-content. - if ctrlcommon.UseNewFormatImageByDefault { - opURL = newFormatOpURL - } if err := isMachineConfigPoolConfigurationValid(pool, version.Hash, releaseVersion, opURL, optr.mcLister.Get); err != nil { lastErr = fmt.Errorf("MachineConfigPool %s has not progressed to latest configuration: %w, retrying", pool.Name, err) syncerr := optr.syncUpgradeableStatus() @@ -1385,29 +1377,21 @@ func (optr *Operator) waitForControllerConfigToBeCompleted(resource *mcfgv1.Cont } // getOsImageURLs returns (new type, new extensions, old type) for operating system update images. -func (optr *Operator) getOsImageURLs(namespace string) (string, string, string, error) { +func (optr *Operator) getOsImageURLs(namespace string) (string, string, error) { cm, err := optr.mcoCmLister.ConfigMaps(namespace).Get(osImageConfigMapName) if err != nil { - return "", "", "", err + return "", "", err } releaseVersion := cm.Data["releaseVersion"] optrVersion, _ := optr.vStore.Get("operator") if releaseVersion != optrVersion { - return "", "", "", fmt.Errorf("refusing to read osImageURL version %q, operator version %q", releaseVersion, optrVersion) + return "", "", fmt.Errorf("refusing to read osImageURL version %q, operator version %q", releaseVersion, optrVersion) } - newextensions, _ := cm.Data["baseOSExtensionsContainerImage"] - - newformat, hasNewFormat := cm.Data["baseOSContainerImage"] - - oldformat, hasOldFormat := cm.Data["osImageURL"] - - // If we don't have a new format image, and we can't fall back to the old one - if !hasOldFormat && !hasNewFormat { - return "", "", "", fmt.Errorf("Missing baseOSContainerImage and osImageURL from configmap") - } + baseOSImage := cm.Data["baseOSContainerImage"] + extensionsImage := cm.Data["baseOSExtensionsContainerImage"] - return newformat, newextensions, oldformat, nil + return baseOSImage, extensionsImage, nil } func (optr *Operator) getCAsFromConfigMap(namespace, name, key string) ([]byte, error) {