Skip to content

Commit

Permalink
Merge pull request #4119 from QiWang19/update-api
Browse files Browse the repository at this point in the history
OCPNODE-1632: Bump k8s api to v0.29.0
  • Loading branch information
openshift-merge-bot[bot] committed Jan 22, 2024
2 parents 139e1d0 + 0f13b7a commit 1cb3198
Show file tree
Hide file tree
Showing 1,397 changed files with 69,371 additions and 23,458 deletions.
4 changes: 2 additions & 2 deletions cmd/machine-config-daemon/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,12 +194,12 @@ func runStartCmd(_ *cobra.Command, _ []string) {
case <-ctrlctx.FeatureGateAccess.InitialFeatureGatesObserved():
featureGates, err := ctrlctx.FeatureGateAccess.CurrentFeatureGates()
if err != nil {
klog.Fatalf("Could not get FG: %w", err)
klog.Fatalf("Could not get FG: %v", err)
} else {
klog.Infof("FeatureGates initialized: knownFeatureGates=%v", featureGates.KnownFeatures())
}
case <-time.After(1 * time.Minute):
klog.Fatalf("Could not get FG, timed out: %w", err)
klog.Fatalf("Could not get FG, timed out: %v", err)
}

if err := dn.Run(stopCh, exitCh); err != nil {
Expand Down
4 changes: 2 additions & 2 deletions cmd/machine-config-operator/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,12 @@ func runStartCmd(_ *cobra.Command, _ []string) {
case <-ctrlctx.FeatureGateAccess.InitialFeatureGatesObserved():
featureGates, err := ctrlctx.FeatureGateAccess.CurrentFeatureGates()
if err != nil {
klog.Fatalf("Could not get FG: %w", err)
klog.Fatalf("Could not get FG: %v", err)
} else {
klog.Infof("FeatureGates initialized: knownFeatureGates=%v", featureGates.KnownFeatures())
}
case <-time.After(1 * time.Minute):
klog.Fatalf("Could not get FG, timed out: %w", err)
klog.Fatalf("Could not get FG, timed out: %v", err)
}

go controller.Run(2, ctrlctx.Stop)
Expand Down
146 changes: 75 additions & 71 deletions go.mod

Large diffs are not rendered by default.

351 changes: 194 additions & 157 deletions go.sum

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions pkg/controller/drain/drain_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ func (ctrl *Controller) syncNode(key string) error {
ctrl.featureGatesAccessor,
)
if nErr != nil {
klog.Errorf("Error making MCN for Uncordon failure: %w", err)
klog.Errorf("Error making MCN for Uncordon failure: %v", err)
}
return fmt.Errorf("failed to uncordon node %v: %w", node.Name, err)

Expand All @@ -339,7 +339,7 @@ func (ctrl *Controller) syncNode(key string) error {
ctrl.featureGatesAccessor,
)
if err != nil {
klog.Errorf("Error making MCN for UnCordon success: %w", err)
klog.Errorf("Error making MCN for UnCordon success: %v", err)
}
case daemonconsts.DrainerStateDrain:

Expand Down Expand Up @@ -402,7 +402,7 @@ func (ctrl *Controller) drainNode(node *corev1.Node, drainer *drain.Helper) erro
ctrl.featureGatesAccessor,
)
if Nerr != nil {
klog.Errorf("Error making MCN for Cordon Failure: %w", Nerr)
klog.Errorf("Error making MCN for Cordon Failure: %v", Nerr)
}
return fmt.Errorf("node %s: failed to cordon: %w", node.Name, err)
}
Expand All @@ -416,7 +416,7 @@ func (ctrl *Controller) drainNode(node *corev1.Node, drainer *drain.Helper) erro
ctrl.featureGatesAccessor,
)
if err != nil {
klog.Errorf("Error making MCN for Cordon Success: %w", err)
klog.Errorf("Error making MCN for Cordon Success: %v", err)
}
}

Expand All @@ -432,7 +432,7 @@ func (ctrl *Controller) drainNode(node *corev1.Node, drainer *drain.Helper) erro
ctrl.featureGatesAccessor,
)
if err != nil {
klog.Errorf("Error making MCN for Drain beginning: %w", err)
klog.Errorf("Error making MCN for Drain beginning: %v", err)
}
if err := drain.RunNodeDrain(drainer, node.Name); err != nil {
// To mimic our old daemon logic, we should probably have a more nuanced backoff.
Expand All @@ -459,7 +459,7 @@ func (ctrl *Controller) drainNode(node *corev1.Node, drainer *drain.Helper) erro
ctrl.featureGatesAccessor,
)
if nErr != nil {
klog.Errorf("Error making MCN for Drain failure: %w", nErr)
klog.Errorf("Error making MCN for Drain failure: %v", nErr)
}

// Return early without deleting the ongoing drain.
Expand All @@ -475,7 +475,7 @@ func (ctrl *Controller) drainNode(node *corev1.Node, drainer *drain.Helper) erro
ctrl.featureGatesAccessor,
)
if err != nil {
klog.Errorf("Error making MCN for Drain success: %w", err)
klog.Errorf("Error making MCN for Drain success: %v", err)
}

// Drain was successful. Delete the ongoing drain.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ func (ctrl *Controller) addMachineSet(obj interface{}) {
// this.
err := ctrl.enqueueAllMachineSets()
if err != nil {
klog.Errorf("Error enqueuing all machine sets: %w", err)
klog.Errorf("Error enqueuing all machine sets: %v", err)
}
}

Expand All @@ -248,7 +248,7 @@ func (ctrl *Controller) updateMachineSet(old, _ interface{}) {
// this.
err := ctrl.enqueueAllMachineSets()
if err != nil {
klog.Errorf("Error enqueuing all machine sets: %w", err)
klog.Errorf("Error enqueuing all machine sets: %v", err)
}
}

Expand All @@ -270,7 +270,7 @@ func (ctrl *Controller) addConfigMap(obj interface{}) {
// Update all machine sets since the "golden" configmap has been updated
err := ctrl.enqueueAllMachineSets()
if err != nil {
klog.Errorf("Error enqueuing all machine sets: %w", err)
klog.Errorf("Error enqueuing all machine sets: %v", err)
}
}

Expand Down
4 changes: 2 additions & 2 deletions pkg/controller/node/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ func (ctrl *Controller) syncStatusOnly(pool *mcfgv1.MachineConfigPool) error {
}
}
if err != nil {
klog.Errorf("Could not get FG: %w", err)
klog.Errorf("Could not get FG: %v", err)
} else if mcnExists && fg.Enabled(configv1.FeatureGateMachineConfigNodes) {
for _, node := range nodes {
ms, err := ctrl.client.MachineconfigurationV1alpha1().MachineConfigNodes().Get(context.TODO(), node.Name, metav1.GetOptions{})
if err != nil {
klog.Errorf("Could not find our MachineConfigNode for node. %s: %w", node.Name, err)
klog.Errorf("Could not find our MachineConfigNode for node. %s: %v", node.Name, err)
continue
}
machineConfigStates = append(machineConfigStates, ms)
Expand Down
2 changes: 1 addition & 1 deletion pkg/controller/render/render_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ func (ctrl *Controller) syncMachineConfigPool(key string) error {
}

if err := ctrl.syncGeneratedMachineConfig(pool, mcs); err != nil {
klog.Errorf("Error syncing Generated MCFG: %w", err)
klog.Errorf("Error syncing Generated MCFG: %v", err)
return ctrl.syncFailingStatus(pool, err)
}
return ctrl.syncAvailableStatus(pool)
Expand Down
14 changes: 7 additions & 7 deletions pkg/daemon/daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -680,13 +680,13 @@ func (dn *Daemon) syncNode(key string) error {
dn.featureGatesAccessor,
)
if err != nil {
klog.Errorf("Error making MCN for Rebooted: %w", err)
klog.Errorf("Error making MCN for Rebooted: %v", err)
}
removeRebooting := make(map[string]string)
removeRebooting[constants.MachineConfigDaemonPostConfigAction] = ""
_, err = dn.nodeWriter.SetAnnotations(removeRebooting)
if err != nil {
klog.Errorf("Could not unset rebooting Anno: %w", err)
klog.Errorf("Could not unset rebooting Anno: %v", err)
}
}

Expand Down Expand Up @@ -746,7 +746,7 @@ func (dn *Daemon) syncNode(key string) error {
dn.featureGatesAccessor,
)
if err != nil {
klog.Errorf("Error making MCN for Resumed true: %w", err)
klog.Errorf("Error making MCN for Resumed true: %v", err)
}
removeRebooting := make(map[string]string)
removeRebooting[constants.MachineConfigDaemonReasonAnnotationKey] = ""
Expand Down Expand Up @@ -783,7 +783,7 @@ func (dn *Daemon) syncNode(key string) error {
dn.featureGatesAccessor,
)
if err != nil {
klog.Errorf("Error making MCN for Updated false: %w", err)
klog.Errorf("Error making MCN for Updated false: %v", err)
}

// Only check for config drift if we need to update.
Expand All @@ -805,7 +805,7 @@ func (dn *Daemon) syncNode(key string) error {
dn.featureGatesAccessor,
)
if err != nil {
klog.Errorf("Error making MCN for Updated: %w", err)
klog.Errorf("Error making MCN for Updated: %v", err)
}
}
klog.V(2).Infof("Node %s is already synced", node.Name)
Expand Down Expand Up @@ -1773,7 +1773,7 @@ func PersistNetworkInterfaces(osRoot string) error {
// nmstatectl clean up will fail if stamp file not
// found or `ROOT/etc/systemd/network` folder not
// found, these error is OK to ignore
klog.Infof("Cleanup error ignored: %w", err)
klog.Infof("Cleanup error ignored: %v", err)
return nil
}
return fmt.Errorf("failed to run nmstatectl: %w", err)
Expand Down Expand Up @@ -2058,7 +2058,7 @@ func (dn *Daemon) updateConfigAndState(state *stateAndConfigs) (bool, bool, erro
dn.featureGatesAccessor,
)
if err != nil {
klog.Errorf("Error making MCN for Resumed true: %w", err)
klog.Errorf("Error making MCN for Resumed true: %v", err)
}
klog.Infof("Completing update to target %s", state.getCurrentName())
if err := dn.completeUpdate(state.currentConfig.GetName()); err != nil {
Expand Down
2 changes: 1 addition & 1 deletion pkg/daemon/drain.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func (dn *Daemon) performDrain() error {
dn.featureGatesAccessor,
)
if err != nil {
klog.Errorf("Error making MCN for Drain not required: %w", err)
klog.Errorf("Error making MCN for Drain not required: %v", err)
}
dn.nodeWriter.Eventf(corev1.EventTypeNormal, "Drain", "Drain not required, skipping")
return nil
Expand Down
8 changes: 4 additions & 4 deletions pkg/daemon/image-inspect.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func imageInspect(imageName string) (*types.ImageInspectInfo, *digest.Digest, er
err error
)

retryOpts := retry.Options{
retryOpts := retry.RetryOptions{
MaxRetry: cmdRetriesCount,
}

Expand All @@ -57,15 +57,15 @@ func imageInspect(imageName string) (*types.ImageInspectInfo, *digest.Digest, er

// retry.IfNecessary takes into account whether the error is "retryable"
// so we don't keep looping on errors that will never resolve
if err := retry.IfNecessary(ctx, func() error {
if err := retry.RetryIfNecessary(ctx, func() error {
src, err = newDockerImageSource(ctx, sys, imageName)
return err
}, &retryOpts); err != nil {
return nil, nil, fmt.Errorf("error parsing image name %q: %w", imageName, err)
}

var rawManifest []byte
if err := retry.IfNecessary(ctx, func() error {
if err := retry.RetryIfNecessary(ctx, func() error {
rawManifest, _, err = src.GetManifest(ctx, nil)

return err
Expand All @@ -86,7 +86,7 @@ func imageInspect(imageName string) (*types.ImageInspectInfo, *digest.Digest, er
return nil, nil, fmt.Errorf("error parsing manifest for image %q: %w", imageName, err)
}

if err := retry.IfNecessary(ctx, func() error {
if err := retry.RetryIfNecessary(ctx, func() error {
imgInspect, err = img.Inspect(ctx)
return err
}, &retryOpts); err != nil {
Expand Down
2 changes: 1 addition & 1 deletion pkg/daemon/rpm-ostree.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ func (r *RpmOstreeClient) Initialize() error {

err := useMergedPullSecrets()
if err != nil {
klog.Errorf("error while linking rpm-ostree pull secrets %w", err)
klog.Errorf("error while linking rpm-ostree pull secrets %v", err)
}

return nil
Expand Down
22 changes: 11 additions & 11 deletions pkg/daemon/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ func (dn *Daemon) performPostConfigChangeAction(postConfigChangeActions []string
dn.featureGatesAccessor,
)
if err != nil {
klog.Errorf("Error making MCN for rebooting: %w", err)
klog.Errorf("Error making MCN for rebooting: %v", err)
}
logSystem("Rebooting node")
return dn.reboot(fmt.Sprintf("Node will reboot into config %s", configName))
Expand All @@ -114,7 +114,7 @@ func (dn *Daemon) performPostConfigChangeAction(postConfigChangeActions []string
dn.featureGatesAccessor,
)
if err != nil {
klog.Errorf("Error making MCN for no post config change action: %w", err)
klog.Errorf("Error making MCN for no post config change action: %v", err)
}
logSystem("Node has Desired Config %s, skipping reboot", configName)
}
Expand All @@ -139,7 +139,7 @@ func (dn *Daemon) performPostConfigChangeAction(postConfigChangeActions []string
dn.featureGatesAccessor,
)
if err != nil {
klog.Errorf("Error making MCN for Reloading success: %w", err)
klog.Errorf("Error making MCN for Reloading success: %v", err)
}

if dn.nodeWriter != nil {
Expand Down Expand Up @@ -685,7 +685,7 @@ func (dn *Daemon) update(oldConfig, newConfig *mcfgv1.MachineConfig, skipCertifi
dn.featureGatesAccessor,
)
if Nerr != nil {
klog.Errorf("Error making MCN for Preparing update failed: %w", err)
klog.Errorf("Error making MCN for Preparing update failed: %v", err)
}
wrappedErr := fmt.Errorf("can't reconcile config %s with %s: %w", oldConfigName, newConfigName, reconcilableError)
if dn.nodeWriter != nil {
Expand All @@ -709,7 +709,7 @@ func (dn *Daemon) update(oldConfig, newConfig *mcfgv1.MachineConfig, skipCertifi
dn.featureGatesAccessor,
)
if Nerr != nil {
klog.Errorf("Error making MCN for Preparing update failed: %w", err)
klog.Errorf("Error making MCN for Preparing update failed: %v", err)
}
return err
}
Expand All @@ -729,7 +729,7 @@ func (dn *Daemon) update(oldConfig, newConfig *mcfgv1.MachineConfig, skipCertifi
dn.featureGatesAccessor,
)
if err != nil {
klog.Errorf("Error making MCN for Update Compatible: %w", err)
klog.Errorf("Error making MCN for Update Compatible: %v", err)
}
pool := ""
var ok bool
Expand All @@ -743,7 +743,7 @@ func (dn *Daemon) update(oldConfig, newConfig *mcfgv1.MachineConfig, skipCertifi

err = upgrademonitor.GenerateAndApplyMachineConfigNodeSpec(dn.featureGatesAccessor, pool, dn.node, dn.mcfgClient)
if err != nil {
klog.Errorf("Error making MCN spec for Update Compatible: %w", err)
klog.Errorf("Error making MCN spec for Update Compatible: %v", err)
}
if drain {
if err := dn.performDrain(); err != nil {
Expand All @@ -761,7 +761,7 @@ func (dn *Daemon) update(oldConfig, newConfig *mcfgv1.MachineConfig, skipCertifi
dn.featureGatesAccessor,
)
if err != nil {
klog.Errorf("Error making MCN for Drain not required: %w", err)
klog.Errorf("Error making MCN for Drain not required: %v", err)
}
}

Expand All @@ -788,7 +788,7 @@ func (dn *Daemon) update(oldConfig, newConfig *mcfgv1.MachineConfig, skipCertifi
dn.featureGatesAccessor,
)
if err != nil {
klog.Errorf("Error making MCN for Updating Files and OS: %w", err)
klog.Errorf("Error making MCN for Updating Files and OS: %v", err)
}

// update files on disk that need updating
Expand Down Expand Up @@ -900,7 +900,7 @@ func (dn *Daemon) update(oldConfig, newConfig *mcfgv1.MachineConfig, skipCertifi
dn.featureGatesAccessor,
)
if err != nil {
klog.Errorf("Error making MCN for Updated Files and OS: %w", err)
klog.Errorf("Error making MCN for Updated Files and OS: %v", err)
}

err = dn.performPostConfigChangeAction(actions, newConfig.GetName())
Expand Down Expand Up @@ -2386,7 +2386,7 @@ func (dn *Daemon) reboot(rationale string) error {
Rebooting[constants.MachineConfigDaemonPostConfigAction] = constants.MachineConfigDaemonStateRebooting
_, err := dn.nodeWriter.SetAnnotations(Rebooting)
if err != nil {
klog.Errorf("Error setting post config action annotation %w", err)
klog.Errorf("Error setting post config action annotation %v", err)
}
}

Expand Down
4 changes: 2 additions & 2 deletions pkg/operator/operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,11 +191,11 @@ func New(

err := corev1.AddToScheme(scheme.Scheme)
if err != nil {
klog.Errorf("Could not modify scheme: %w", err)
klog.Errorf("Could not modify scheme: %v", err)
}
err = opv1.AddToScheme(scheme.Scheme)
if err != nil {
klog.Errorf("Could not modify scheme: %w", err)
klog.Errorf("Could not modify scheme: %v", err)
}

for _, i := range []cache.SharedIndexInformer{
Expand Down

0 comments on commit 1cb3198

Please sign in to comment.