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

🐛 Agents stop update managedcluster status when clock is out of sync. #770

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

xuezhaojun
Copy link
Member

@xuezhaojun xuezhaojun commented Dec 17, 2024

Summary

This patch aim to stop agents from updating managed cluster status when clock is already out of sync.

The issue occurs when the hub sets the managed cluster status to unknown due to an outdated lease, while the agent simultaneously sets the managed cluster status to available because the API server is accessible. This conflict causes the managed cluster status to flap back and forth frequently, triggering numerous reconciliations and resulting in performance issues.

@openshift-ci openshift-ci bot requested review from ldpliu and skeeey December 17, 2024 06:19
@xuezhaojun xuezhaojun force-pushed the check-clocksync-before-agent-modify-managedclusterstatus branch from 1aae1d5 to 54fc61e Compare December 17, 2024 06:31
Copy link

codecov bot commented Dec 17, 2024

Codecov Report

Attention: Patch coverage is 54.54545% with 5 lines in your changes missing coverage. Please review.

Project coverage is 63.77%. Comparing base (17e05da) to head (528c61e).
Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
...stration/spoke/managedcluster/status_controller.go 33.33% 3 Missing and 1 partial ⚠️
pkg/registration/hub/lease/clocksynccontroller.go 80.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #770      +/-   ##
==========================================
+ Coverage   63.60%   63.77%   +0.16%     
==========================================
  Files         192      192              
  Lines       18433    18596     +163     
==========================================
+ Hits        11725    11860     +135     
- Misses       5735     5757      +22     
- Partials      973      979       +6     
Flag Coverage Δ
unit 63.77% <54.54%> (+0.16%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

@jgato
Copy link

jgato commented Dec 17, 2024

what are the consequences of not been able to update the ManagedCluster status? Do we lost any kind of feature?
It would happen that we would need to have different clocks. Like a managedcluster, testing different functionalities related with time, ptp, ntp, and therefore, it would be "playing" with the clock.

@xuezhaojun
Copy link
Member Author

xuezhaojun commented Dec 17, 2024

what are the consequences of not been able to update the ManagedCluster status? Do we lost any kind of feature? It would happen that we would need to have different clocks. Like a managedcluster, testing different functionalities related with time, ptp, ntp, and therefore, it would be "playing" with the clock.

@jgato The OCM is not designed to work under the situation when clocks are not synced, if clocks are not synced, the first priority is to fix it.

This PR prevents status flapping by ensuring managed clusters remain in Unknown state instead of alternating between Unknown and Available.

@xuezhaojun
Copy link
Member Author

/assign @qiujian16

@xuezhaojun
Copy link
Member Author

/assign @elgnay

@xuezhaojun xuezhaojun force-pushed the check-clocksync-before-agent-modify-managedclusterstatus branch from 54fc61e to 8ff2ec6 Compare December 18, 2024 02:32
@xuezhaojun xuezhaojun force-pushed the check-clocksync-before-agent-modify-managedclusterstatus branch from 8ff2ec6 to 973330f Compare December 18, 2024 03:34
@openshift-ci openshift-ci bot removed the approved label Dec 18, 2024
@xuezhaojun xuezhaojun force-pushed the check-clocksync-before-agent-modify-managedclusterstatus branch from 973330f to e4d8de9 Compare December 18, 2024 04:22
@qiujian16
Copy link
Member

We need also document this change in the website.

@xuezhaojun xuezhaojun force-pushed the check-clocksync-before-agent-modify-managedclusterstatus branch 2 times, most recently from 6da70c8 to 429463a Compare December 18, 2024 07:41
@qiujian16
Copy link
Member

/approve

Copy link
Contributor

openshift-ci bot commented Dec 18, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: qiujian16, xuezhaojun

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

The pull request process is described here

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

@xuezhaojun
Copy link
Member Author

We need also document this change in the website.

Agree, will add tasks for it.

Signed-off-by: xuezhaojun <zxue@redhat.com>
@xuezhaojun xuezhaojun force-pushed the check-clocksync-before-agent-modify-managedclusterstatus branch from 429463a to 528c61e Compare December 22, 2024 08:20
stop = runAgent(managedClusterName, agentOptions, commOptions, spokeCfg)
defer stop()

assertAvailableCondition(managedClusterName, metav1.ConditionTrue, 0)
Copy link
Member Author

@xuezhaojun xuezhaojun Dec 22, 2024

Choose a reason for hiding this comment

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

@qiujian16 After run agent again, check if conditions become True, please take another look.

@xuezhaojun
Copy link
Member Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants