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

OCPBUGS-32980: [release-4.14]:fix extra-reboot on upgrade with paused mcp worker #1053

Merged
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,12 @@ package controller
import (
"context"
"fmt"
"k8s.io/apimachinery/pkg/runtime/schema"
"os"
"reflect"
"time"

"k8s.io/apimachinery/pkg/runtime/schema"

apiconfigv1 "github.com/openshift/api/config/v1"
performancev2 "github.com/openshift/cluster-node-tuning-operator/pkg/apis/performanceprofile/v2"
tunedv1 "github.com/openshift/cluster-node-tuning-operator/pkg/apis/tuned/v1"
Expand Down Expand Up @@ -582,7 +583,7 @@ func (r *PerformanceProfileReconciler) reconcileCgroupsV1(ctx context.Context, i
}

// (TODO) This code can be removed in the future when the cgroupsv2 is supported
currentMC, err := r.getCurrentMachineConfigByMCP(ctx, profileMCP)
currentMC, err := r.getStagedMachineConfigByMCP(ctx, profileMCP)
if err != nil {
return reconcile.Result{}, err, true
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -632,6 +632,11 @@ var _ = Describe("Controller", func() {
},
},
},
Configuration: mcov1.MachineConfigPoolStatusConfiguration{
ObjectReference: corev1.ObjectReference{
Name: "test",
},
},
},
Status: mcov1.MachineConfigPoolStatus{
Conditions: []mcov1.MachineConfigPoolCondition{
Expand Down
6 changes: 3 additions & 3 deletions pkg/performanceprofile/controller/resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,17 @@ func mergeMaps(src map[string]string, dst map[string]string) {

// TODO: we should merge all create, get and delete methods

func (r *PerformanceProfileReconciler) getCurrentMachineConfigByMCP(ctx context.Context, mcp *mcov1.MachineConfigPool) (*mcov1.MachineConfig, error) {
func (r *PerformanceProfileReconciler) getStagedMachineConfigByMCP(ctx context.Context, mcp *mcov1.MachineConfigPool) (*mcov1.MachineConfig, error) {
if mcp == nil {
return nil, fmt.Errorf("nil MachineConfigPool object")
}

currentMCName := mcp.Status.Configuration.Name
currentMCName := mcp.Spec.Configuration.Name
if currentMCName == "" { // should never happen
return nil, fmt.Errorf("MCP %q missing configuration name", mcp.Name)
}

klog.Infof("checking current MachineConfig %q", currentMCName)
klog.Infof("checking staged MachineConfig %q", currentMCName)

return r.getMachineConfig(ctx, currentMCName)
}
Expand Down
5 changes: 5 additions & 0 deletions pkg/performanceprofile/utils/testing/testing.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,11 @@ func NewProfileMCP() *mcov1.MachineConfigPool {
MachineConfigSelector: &metav1.LabelSelector{
MatchLabels: map[string]string{MachineConfigLabelKey: MachineConfigLabelValue},
},
Configuration: mcov1.MachineConfigPoolStatusConfiguration{
ObjectReference: corev1.ObjectReference{
Name: "test",
},
},
},
Status: mcov1.MachineConfigPoolStatus{
Configuration: mcov1.MachineConfigPoolStatusConfiguration{
Expand Down