Skip to content

Conversation

@jlebon
Copy link
Member

@jlebon jlebon commented Jan 15, 2019

The same way we pass the specific desiredConfig we "locked on" when
updating, also similarly pass the currentConfig. This is a minor
optimization so we avoid querying the cluster again for information we
already have, but it does also make the code more resilient to humans
meddling with node annotations.

Requires: #310

@openshift-ci-robot openshift-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Jan 15, 2019
@cgwalters
Copy link
Member

I was looking at a similar patch recently, but I was thinking more like

$ git diff
diff --git a/pkg/daemon/daemon.go b/pkg/daemon/daemon.go
index 5309697..c78133a 100644
--- a/pkg/daemon/daemon.go
+++ b/pkg/daemon/daemon.go
@@ -598,7 +598,7 @@ func (dn *Daemon) CheckStateOnBoot() error {
        } else {
                // currentConfig != desiredConfig, and we're not booting up into the desiredConfig.
                // Kick off an update.
-               if err := dn.triggerUpdateWithMachineConfig(stateAndConfigs.desiredConfig); err != nil {
+               if err := dn.update(stateAndConfigs.currentConfig, stateAndConfigs.desiredConfig); err != nil {
                        return err
                }
        }
diff --git a/pkg/daemon/update.go b/pkg/daemon/update.go
index 158f876..4e78920 100644
--- a/pkg/daemon/update.go
+++ b/pkg/daemon/update.go
@@ -69,6 +69,12 @@ func (dn *Daemon) writePendingState(desiredConfig *mcfgv1.MachineConfig) error {
 func (dn *Daemon) update(oldConfig, newConfig *mcfgv1.MachineConfig) error {
        var err error
 
+       if dn.onceFrom != "" && !ValidPath(dn.onceFrom) {
+               if err = dn.nodeWriter.SetUpdateWorking(dn.kubeClient.CoreV1().Nodes(), dn.name); err != nil {
+                       return err
+               }
+       }
+
        oldConfigName := oldConfig.GetName()
        newConfigName := newConfig.GetName()
        glog.Infof("Checking reconcilable for config %v to %v", oldConfigName, newConfigName)

@cgwalters
Copy link
Member

There's all these layers of "update/triggerUpdate*" functions that get into the "onceFrom" stuff and I get a bit confused by them...but the lowest level seems to be update() and so let's move the important bit of setting the node annotation there and have the main cluster path call it?

@jlebon
Copy link
Member Author

jlebon commented Jan 15, 2019

Yeah, I think that'd work. Though it's a bit more involved than I wanted to go given the current freeze. Whereas the patch as written is pretty easy to reason through. Let's enhance it later? Your diff did make me notice something else though. I pushed another minor commit for that! ⬆️

The same way we pass the specific desiredConfig we "locked on" when
updating, also similarly pass the currentConfig. This is a minor
optimization so we avoid querying the cluster again for information we
already have, but it does also make the code more resilient to humans
meddling with node annotations.

Related: openshift#301
We should drain the node if we're *not* in one-shot mode. The previous
conditional still worked because "" is not a valid path, but it muddles
the intent.
@ashcrow
Copy link
Member

ashcrow commented Jan 15, 2019

Infra flake

/retest

@ashcrow
Copy link
Member

ashcrow commented Jan 16, 2019

/retest

@ashcrow
Copy link
Member

ashcrow commented Jan 16, 2019

Terraform flake

/retest

Copy link
Member

@ashcrow ashcrow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deferring to a second review to merge.

@ashcrow
Copy link
Member

ashcrow commented Jan 16, 2019

/approve

@ashcrow
Copy link
Member

ashcrow commented Jan 16, 2019

Monitor flake:

net/http: request canceled (Client.Timeout exceeded while awaiting headers)

/retest

@cgwalters
Copy link
Member

/lgtm

This will help a bit for #273

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Jan 18, 2019
@openshift-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ashcrow, cgwalters, jlebon

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ashcrow
Copy link
Member

ashcrow commented Jan 18, 2019

Terraform errors with AWS. Will force a test once the clean up occurs.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@ashcrow
Copy link
Member

ashcrow commented Jan 18, 2019

/retest

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-merge-robot openshift-merge-robot merged commit f6b0264 into openshift:master Jan 18, 2019
osherdp pushed a commit to osherdp/machine-config-operator that referenced this pull request Apr 13, 2021
@jlebon jlebon deleted the pr/currentSkip branch May 1, 2023 15:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants