Skip to content

[feat]: implement maintenance watcher for linodeCluster#1075

Open
tchinmai7 wants to merge 4 commits into
mainfrom
monitor-maintenance
Open

[feat]: implement maintenance watcher for linodeCluster#1075
tchinmai7 wants to merge 4 commits into
mainfrom
monitor-maintenance

Conversation

@tchinmai7

Copy link
Copy Markdown
Contributor

What this PR does / why we need it:
Automatically detects linodes that are scheduled for maintenance, and adds a condition on the machines. Maintenance can be disruptive, depending on the workload running on the clusters, and operators may want to know ahead of time, and surge replace nodes. This allows operators to configure a MachineHealthCheck to detect when machines are schedueld for maintenance and replace them.

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #

Special notes for your reviewer:

TODOs:

  • squashed commits
  • includes documentation
  • adds unit tests
  • adds or updates e2e tests

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR adds “maintenance awareness” to CAPL by querying Linode’s Account Maintenance API and surfacing upcoming scheduled maintenance on the corresponding Cluster API Machine objects as a MaintenanceScheduled condition, enabling operators to drive remediation via MachineHealthCheck.

Changes:

  • Add ListMaintenances to the Linode client interfaces, tracing wrapper, and gomock clients.
  • Extend LinodeClusterReconciler to query scheduled maintenances (next 72h) and patch owning CAPI Machine conditions.
  • Add unit tests and user documentation for configuring MachineHealthCheck to remediate machines scheduled for maintenance.

Reviewed changes

Copilot reviewed 4 out of 6 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
observability/wrappers/linodeclient/linodeclient.gen.go Adds tracing wrapper method for ListMaintenances.
mock/client.go Updates gomock clients to include ListMaintenances and a maintenance client mock.
internal/controller/linodecluster_controller.go Implements maintenance lookup + patches MaintenanceScheduled onto owning CAPI Machines during cluster reconcile.
internal/controller/linodecluster_controller_maintenance_test.go Adds unit tests for maintenance collection and condition patching behavior.
docs/src/topics/health-checking.md Documents the new MaintenanceScheduled condition and MHC examples for remediation.
clients/clients.go Extends LinodeClient interface with LinodeMaintenanceClient.
Files not reviewed (2)
  • mock/client.go: Language not supported
  • observability/wrappers/linodeclient/linodeclient.gen.go: Language not supported

Comment thread internal/controller/linodecluster_controller.go
Comment thread internal/controller/linodecluster_controller.go Outdated
Comment thread internal/controller/linodecluster_controller.go
Comment thread internal/controller/linodecluster_controller.go
Comment thread internal/controller/linodecluster_controller.go
Comment thread internal/controller/linodecluster_controller.go Outdated
Comment thread internal/controller/linodecluster_controller.go Outdated
Comment thread docs/src/topics/health-checking.md
@codecov

codecov Bot commented Jun 18, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 67.64706% with 22 lines in your changes missing coverage. Please review.
✅ Project coverage is 69.21%. Comparing base (dc240b0) to head (02b8593).

Files with missing lines Patch % Lines
internal/controller/linodecluster_controller.go 79.31% 7 Missing and 5 partials ⚠️
util/helpers.go 0.00% 10 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1075      +/-   ##
==========================================
- Coverage   69.23%   69.21%   -0.02%     
==========================================
  Files          71       71              
  Lines        6566     6634      +68     
==========================================
+ Hits         4546     4592      +46     
- Misses       1725     1742      +17     
- Partials      295      300       +5     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants