Skip to content

Commit

Permalink
Drop machine-os-content references
Browse files Browse the repository at this point in the history
  • Loading branch information
cgwalters committed Sep 27, 2023
1 parent d136bfa commit a82a034
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 45 deletions.
2 changes: 0 additions & 2 deletions cmd/machine-config-operator/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion install/0000_80_machine-config-operator_05_osimageurl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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: ""
7 changes: 0 additions & 7 deletions install/image-references
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 2 additions & 9 deletions pkg/controller/common/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down
1 change: 0 additions & 1 deletion pkg/operator/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion pkg/operator/images.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
32 changes: 8 additions & 24 deletions pkg/operator/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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{
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit a82a034

Please sign in to comment.