Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions pkg/controller/bootimage/boot_image_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,12 @@ const (
// Labels and Annotations required for determining architecture of a machineset
MachineSetArchAnnotationKey = "capacity.cluster-autoscaler.kubernetes.io/labels"

ArchLabelKey = "kubernetes.io/arch="
OSLabelKey = "machine.openshift.io/os-id"
ArchLabelKey = "kubernetes.io/arch="
OSLabelKey = "machine.openshift.io/os-id"
OSStreamLabelKey = "machineconfiguration.openshift.io/osstream"

// Stream currently supported by the MCO's boot image controller
SupportedOSStream = "rhel-9"

// Threshold for hot loop detection
HotLoopLimit = 3
Expand Down
14 changes: 12 additions & 2 deletions pkg/controller/bootimage/cpms_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,13 +111,23 @@ func (ctrl *Controller) syncControlPlaneMachineSet(controlPlaneMachineSet *machi
klog.V(4).Infof("Finished syncing ControlPlaneMachineSet %q (%v)", controlPlaneMachineSet.Name, time.Since(startTime))
}()

// If the machineset has an owner reference, exit and report error. This means
// If the machineset has an owner reference, exit and log error. This means
// that the machineset may be managed by another workflow and should not be reconciled.
if len(controlPlaneMachineSet.GetOwnerReferences()) != 0 {
klog.Infof("ControlPlaneMachineSet %s has OwnerReference: %v, skipping boot image update", controlPlaneMachineSet.GetOwnerReferences()[0].Kind+"/"+controlPlaneMachineSet.GetOwnerReferences()[0].Name, controlPlaneMachineSet.Name)
klog.Infof("ControlPlaneMachineSet %s has OwnerReference: %v, skipping boot image update", controlPlaneMachineSet.Name, controlPlaneMachineSet.GetOwnerReferences()[0].Kind+"/"+controlPlaneMachineSet.GetOwnerReferences()[0].Name)
return nil
}

// Skip if the ControlPlaneMachineSet has a label designating a non default stream. If no stream label is defined,
// this is an older, pre "dual stream" ControlPlaneMachineSet and should be reconciled.
if streamLabel, ok := controlPlaneMachineSet.GetLabels()[OSStreamLabelKey]; ok {
if streamLabel != SupportedOSStream {
klog.Infof("ControlPlaneMachineSet %s has unsupported stream: %v, skipping boot image update", controlPlaneMachineSet.Name, streamLabel)
return nil
}
}

// Skip if this is a windows ControlPlaneMachineSet.
if os, ok := controlPlaneMachineSet.Spec.Template.OpenShiftMachineV1Beta1Machine.Spec.Labels[OSLabelKey]; ok {
if os == "Windows" {
klog.Infof("ControlPlaneMachineSet %s has a windows os label, skipping boot image update", controlPlaneMachineSet.Name)
Expand Down
16 changes: 14 additions & 2 deletions pkg/controller/bootimage/ms_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,13 +111,25 @@ func (ctrl *Controller) syncMAPIMachineSet(machineSet *machinev1beta1.MachineSet
klog.V(4).Infof("Finished syncing MAPI machineset %q (%v)", machineSet.Name, time.Since(startTime))
}()

// If the machineset has an owner reference, exit and report error. This means
// If the machineset has an owner reference, exit and log error. This means
// that the machineset may be managed by another workflow and should not be reconciled.
if len(machineSet.GetOwnerReferences()) != 0 {
klog.Infof("machineset %s has OwnerReference: %v, skipping boot image update", machineSet.GetOwnerReferences()[0].Kind+"/"+machineSet.GetOwnerReferences()[0].Name, machineSet.Name)
klog.Infof("machineset %s has OwnerReference: %v, skipping boot image update", machineSet.Name, machineSet.GetOwnerReferences()[0].Kind+"/"+machineSet.GetOwnerReferences()[0].Name)
return true, nil
}

// Skip if the machineset has a label designating a non default stream. Not counted as skipped
// since the MCO intentionally excludes non-default streams. If no stream label is defined,
// this is an older, pre "dual stream" machineset and should be reconciled.
if streamLabel, ok := machineSet.GetLabels()[OSStreamLabelKey]; ok {
if streamLabel != SupportedOSStream {
klog.Infof("machineset %s has unsupported stream: %v, skipping boot image update", machineSet.Name, streamLabel)
return false, nil
}
}

// Skip if this is a windows machineset. Not counted as skipped since the MCO
// intentionally excludes Windows machinesets.
if os, ok := machineSet.Spec.Template.Labels[OSLabelKey]; ok {
if os == "Windows" {
klog.Infof("machineset %s has a windows os label, skipping boot image update", machineSet.Name)
Expand Down