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

Fix: When workflow already executed. After controller restart, healthcheck could never be scheduled #236

Merged
merged 3 commits into from
Sep 16, 2024

Conversation

carlyjiang
Copy link
Contributor

@carlyjiang carlyjiang commented Sep 15, 2024

Fix: When workflow already executed. After reconcile and there's no reschedule handler, the healthcheck will never be executed.

Proposed Changes

  • When reconcile event, if it is executed and there's scheduled timer in controller handler, then directly return.
  • When scheduled timer executed, it should fetch latest healthcheck spec and submit workflow. (in case workflow has any change)

Testing Done

  • Add unit-tests
  • Deploy healthcheck, repeatAfterSec changed from 900s to 180s, the frequency updated properly.
  • Deploy healthcheck, repeatAfterSec changed from 90 to 180s, the frequency updated properly.
  • Restarted controller, it will reconcile all healthchecks, and since there's no scheduled handler populated, workflow will be submitted and reschedule timer.

Copy link

codecov bot commented Sep 15, 2024

Codecov Report

Attention: Patch coverage is 76.92308% with 3 lines in your changes missing coverage. Please review.

Project coverage is 69.20%. Comparing base (52b6ad0) to head (2a9c116).
Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
internal/controllers/healthcheck_controller.go 76.92% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #236      +/-   ##
==========================================
+ Coverage   67.99%   69.20%   +1.21%     
==========================================
  Files           3        3              
  Lines         978      984       +6     
==========================================
+ Hits          665      681      +16     
+ Misses        232      223       -9     
+ Partials       81       80       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

…e scheduled

Signed-off-by: Yu Jiang <yu_jiang@intuit.com>
Signed-off-by: Yu Jiang <yu_jiang@intuit.com>
@carlyjiang carlyjiang changed the title Fix: When workflow already executed. After reconcile, it will never be scheduled Fix: When workflow already executed. After controller restart, healthcheck will never be scheduled Sep 15, 2024
@carlyjiang carlyjiang changed the title Fix: When workflow already executed. After controller restart, healthcheck will never be scheduled Fix: When workflow already executed. After controller restart, healthcheck could never be scheduled Sep 16, 2024
Signed-off-by: Yu Jiang <yu_jiang@intuit.com>
Copy link

@kevdowney kevdowney left a comment

Choose a reason for hiding this comment

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

LGTM

@carlyjiang carlyjiang merged commit ad374d2 into master Sep 16, 2024
4 checks passed
@carlyjiang carlyjiang deleted the bug-fix branch September 16, 2024 17:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants