-
Notifications
You must be signed in to change notification settings - Fork 94
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
✨ Add a condition to report when hub and agent clock out of sync. #312
✨ Add a condition to report when hub and agent clock out of sync. #312
Conversation
cee6ba2
to
7423aad
Compare
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #312 +/- ##
==========================================
- Coverage 61.75% 61.63% -0.13%
==========================================
Files 132 133 +1
Lines 13992 14083 +91
==========================================
+ Hits 8641 8680 +39
- Misses 4585 4632 +47
- Partials 766 771 +5
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
I remembered we intentionally didn't use local time here, because we want to keep the time sync between the managed cluster and hub cluster /cc @qiujian16 |
That's new to me, do we know the motivation of keeping clocks sync between hub and agents? |
Find the comment: open-cluster-management-io/registration#40 (comment) It seems the initial implement is based on probeTimestamp but we change to using observedLease directly in this PR: open-cluster-management-io/registration#43 |
7423aad
to
1dd5d7d
Compare
37f0bc4
to
d6825f2
Compare
pkg/work/hub/controllers/manifestworkreplicasetcontroller/manifestworkreplicaset_deploy_test.go
Outdated
Show resolved
Hide resolved
a1678bc
to
2c0fb11
Compare
Hi, @qiujian16 , I tried the bareInformer approach as well, does that means:
informer.AddEventHandler(cache.ResourceEventHandlerFuncs{
UpdateFunc: func(oldObj, newObj interface{}) {
oldLease := oldObj.(*corev1.Lease)
newLease := newObj.(*corev1.Lease)
if oldLease.Spec.RenewTime.Before(newLease.Spec.RenewTime) {
c.equeue(newLease)
}
},
})
The concern of this approach is, the controller has a default 10 hours resync setting, this resync is not triggered by the renew update event. This may cause misreport of out-of-sync condition. |
I think you should have a separated controller to update this condition. The reconcile logic is not quite the same as what lease did before. |
Got it, do you think we can seprete a controller but still use |
2c0fb11
to
6d81edb
Compare
My understanding is if you make it in the different controller, you would not need a local cache. isn't it? |
6d81edb
to
cb1c709
Compare
d284fc8
to
8218bb3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/approve
/assign @elgnay
Signed-off-by: xuezhaojun <zxue@redhat.com>
8218bb3
to
09fe3b2
Compare
[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 |
/lgtm |
5884bc5
into
open-cluster-management-io:main
Summary
When hub and agent clock out of sync, the managed cluster status will show as 'Unknown' even the agent functions well.
Here we add a new condition to report clock out-of-sync, when we detect the clock of hub and a agent is not synced.
The strategy:
Every time hub find the
renewTime
updated, we compare thenow
withrenewTime
. The 2 values should close to each other, if thenow
is faster thanrenewTime
too much (over a lease duration), we will report clock out-of-sync.depends on: open-cluster-management-io/api#296
Related issue(s)
Fixes #