Skip to content

Various error-handling fixes - #206

Merged
openshift-merge-robot merged 6 commits into
openshift:masterfrom
jlebon:pr/fix-false-pos
Dec 1, 2018
Merged

openshift-merge-robot merged 6 commits into
openshift:masterfrom
jlebon:pr/fix-false-pos

Conversation

@jlebon

@jlebon jlebon commented Nov 30, 2018

Copy link
Copy Markdown
Member

See individual commit messages.

We had two "failed to initialize daemon" log messages in the
`runStartCmd()` function. One can still distinguish which one was
emitted since glog does print the line number too, but really that first
one wasn't accurate, so tweak it.
Whenever we try to get a MachineConfig, keep retrying for 5 minutes in
case we hit transient errors. One such error for example is the
MachineConfig inexplicably disappearing (see openshift#199).
@openshift-ci-robot openshift-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Nov 30, 2018
@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 Nov 30, 2018
@jlebon

jlebon commented Nov 30, 2018

Copy link
Copy Markdown
Member Author

Marked as WIP for now since this does not yet address (3) in #199 (comment).

@ashcrow

ashcrow commented Nov 30, 2018

Copy link
Copy Markdown
Member

Changes look good. I'm not crazy about daemon: retry for 5 minutes to get MachineConfig though. Is that more so related to #203?

@ashcrow

ashcrow commented Nov 30, 2018

Copy link
Copy Markdown
Member

/test e2e-aws

2 similar comments
@ashcrow

ashcrow commented Nov 30, 2018

Copy link
Copy Markdown
Member

/test e2e-aws

@ashcrow

ashcrow commented Nov 30, 2018

Copy link
Copy Markdown
Member

/test e2e-aws

@ashcrow

ashcrow commented Nov 30, 2018

Copy link
Copy Markdown
Member

These commits are currently being manually tested by @kikisdeliveryservice and @jlebon

@ashcrow

ashcrow commented Nov 30, 2018

Copy link
Copy Markdown
Member

/test e2e-aws

2 similar comments
@ashcrow

ashcrow commented Nov 30, 2018

Copy link
Copy Markdown
Member

/test e2e-aws

@ashcrow

ashcrow commented Nov 30, 2018

Copy link
Copy Markdown
Member

/test e2e-aws

@openshift-ci-robot openshift-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Nov 30, 2018
@jlebon jlebon changed the title WIP: Various error-handling fixes Various error-handling fixes Nov 30, 2018
@openshift-ci-robot openshift-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Nov 30, 2018
@jlebon

jlebon commented Nov 30, 2018

Copy link
Copy Markdown
Member Author

OK, dropping WIP on this, though I'd appreciate some manual testing from others. I pushed another commit which reworks how we use channels and error-handling in goroutines. This allows us to avoid the nuclear reboot-on-error pattern in favour of the mark-degraded-and-exit-on-error pattern.

Comment thread pkg/daemon/writer.go Resolved
There were a bunch of places where instead of propagating up the error
that made us want to set the node to degraded, we were returning the
error from whether setting the degraded status *itself* was successful.
This resulted in e.g. callers thinking that the callee succeeded (since
the node was successfully marked degraded), when in reality it should've
jumped ship (see e.g. openshift#199).

Fix this by adding some support functions that just "passthrough" errors
instead of returning the error from setting the node annotation itself.
This also centralizes where the "Marking degraded due to" msg comes
from.
There's no point in fetching it if the caller already passed a specific
MachineConfig to use.
This patch strengthens our error-handling and use of channels in the
following ways:

1. Don't abuse the stop channel in `Run()`. It should be solely used to
   make sure spawned goroutines also exit when we exit.
2. Add a new `exitCh` channel which allows callbacks to communicate back
   to the main `poll` in `Run()` any errors that occur and exit. This
   means that e.g. an error in `handleNodeUpdate()` can signal an error
   and cause the daemon to exit cleanly instead of going with the
   nuclear option of rebooting. Similarly for the kubelet healthz
   monitor.
3. Consistently set the degraded state: previously, functions like
   `prepUpdateFromCluster()` were trusted to set the degraded state in
   the case of errors, but it didn't do so for all errors. Instead,
   delegate back degraded state setting to the higher-level `Run()` (in
   the case of errors happening during `handleNodeUpdate()` and
   `runOnceFromMachineConfig()` (in the in-cluster case).
@ashcrow

ashcrow commented Nov 30, 2018

Copy link
Copy Markdown
Member

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Nov 30, 2018
@openshift-ci-robot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ashcrow, 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

@kikisdeliveryservice

Copy link
Copy Markdown
Contributor

LGTM as well. Thanks for this @jlebon

@openshift-bot

Copy link
Copy Markdown
Contributor

/retest

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

1 similar comment
@openshift-bot

Copy link
Copy Markdown
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 91d1382 into openshift:master Dec 1, 2018
@jlebon
jlebon deleted the pr/fix-false-pos branch May 1, 2023 15:32
ptalgulk01 pushed a commit to ptalgulk01/machine-config-operator that referenced this pull request May 15, 2026
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/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants