Skip to content

fix(ensurance): clear node taint after cool-down when usage recovers - #934

Draft
ljluestc wants to merge 2 commits into
gocrane:mainfrom
ljluestc:fix/894-node-taint-not-auto-cleared
Draft

fix(ensurance): clear node taint after cool-down when usage recovers#934
ljluestc wants to merge 2 commits into
gocrane:mainfrom
ljluestc:fix/894-node-taint-not-auto-cleared

Conversation

@ljluestc

@ljluestc ljluestc commented Aug 2, 2026

Copy link
Copy Markdown

The avoidance action's node taint was never removed once the metric dropped back below the watermark:

  1. computeActionContext fired Restored exactly once (it reset the trigger counter immediately), so the cool-down was evaluated only at that single instant - which is almost always inside the cool-down window (restoreThreshold x probe interval < coolDownSeconds).
  2. While waiting out the cool-down, mergeSchedulingActions kept calling ToggleScheduleSetting(true), which refreshed lastTriggeredTime on every round, so the cool-down could never elapse anyway.

With this change the restore stays pending while usage remains below the watermark (counters are only cleared once the restore is executed or the rule triggers again), the cool-down is re-evaluated on every analysis round, and lastTriggeredTime is only refreshed by real triggers. After coolDownSeconds elapses, ScheduleExecutor restores the node and removes the EnsuranceAnalyzedPressure taint.

Adds unit tests covering the reporter's scenario, cool-down semantics, and re-triggering after a completed restore.

Fixes #894

What type of PR is this?

What this PR does / why we need it:

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

The avoidance action's node taint was never removed once the metric
dropped back below the watermark:

1. computeActionContext fired Restored exactly once (it reset the
   trigger counter immediately), so the cool-down was evaluated only at
   that single instant - which is almost always inside the cool-down
   window (restoreThreshold x probe interval < coolDownSeconds).
2. While waiting out the cool-down, mergeSchedulingActions kept calling
   ToggleScheduleSetting(true), which refreshed lastTriggeredTime on
   every round, so the cool-down could never elapse anyway.

With this change the restore stays pending while usage remains below the
watermark (counters are only cleared once the restore is executed or the
rule triggers again), the cool-down is re-evaluated on every analysis
round, and lastTriggeredTime is only refreshed by real triggers. After
coolDownSeconds elapses, ScheduleExecutor restores the node and removes
the EnsuranceAnalyzedPressure taint.

Adds unit tests covering the reporter's scenario, cool-down semantics,
and re-triggering after a completed restore.

Fixes gocrane#894
Documents root cause (one-shot restore + cool-down never elapsing),
the pending-restore fix, the recordRestoreDecision audit log, the
rejected break-variant, and the unit/e2e verification evidence.
@github-actions github-actions Bot added the documentation Improvements or additions to documentation label Aug 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

干扰检测和主动回避--节点污点不能自动清除

1 participant