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

ntp: rancher, rke2-server rke2-agent need to wait for time sync #373

Merged
merged 2 commits into from
Dec 27, 2022

Conversation

tjjh89017
Copy link
Contributor

@tjjh89017 tjjh89017 commented Oct 25, 2022

use time-sync.target
wait for 3 min to sync time
if time sync took more 3 min, skip it and start rancherd, rke2-server and rke2-agent directly.

issue: harvester/harvester#2860

Signed-off-by: Date Huang date.huang@suse.com

@Vicente-Cheng
Copy link
Contributor

Just curious, does the 180 seconds is enough for time sync?

Could we have some way to check the time is synced with the NTP server?

@tjjh89017
Copy link
Contributor Author

Just curious, does the 180 seconds is enough for time sync?

Could we have some way to check the time is synced with the NTP server?

systemd-time-wait-sync.service will help us determine whether the time is synced.
But it cannot determine the NTP server is unreachable or time is still syncing.
So I setup 3 min timeout.
If NTP server is reachable, it will cost less than 1min to sync in my testing env.

@Vicente-Cheng
Copy link
Contributor

Vicente-Cheng commented Dec 15, 2022

Just curious, does the 180 seconds is enough for time sync?
Could we have some way to check the time is synced with the NTP server?

systemd-time-wait-sync.service will help us determine whether the time is synced. But it cannot determine the NTP server is unreachable or time is still syncing. So I setup 3 min timeout. If NTP server is reachable, it will cost less than 1min to sync in my testing env.

OK, that makes sense to me. Just some nit on the above comments.

Copy link
Contributor

@Vicente-Cheng Vicente-Cheng left a comment

Choose a reason for hiding this comment

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

LGTM, test fresh installation with #375. Thanks!

Date Huang added 2 commits December 27, 2022 13:24
use time-sync.target
wait for 3 min to sync time
if time sync took more 3 min, skip it and start rancherd,
rke2-server and rke2-agent directly.

Signed-off-by: Date Huang <date.huang@suse.com>
Signed-off-by: Date Huang <date.huang@suse.com>
Copy link
Member

@starbops starbops left a comment

Choose a reason for hiding this comment

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

LGTM and tested with a fresh install in a virtualized environment. Checked with the following command to see if the services are actually waiting for the time synced.

journalctl -b -u systemd-timesyncd.service -u systemd-time-wait-sync.service -u time-sync.target -u rancherd.service -u rke2-server.service -u rke2-agent.service

Thanks!

Copy link
Member

@bk201 bk201 left a comment

Choose a reason for hiding this comment

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

LGTM

@bk201 bk201 merged commit cb666a0 into harvester:master Dec 27, 2022
@bk201
Copy link
Member

bk201 commented Dec 27, 2022

Please help backport the PR to the v1.1 branch, thanks.

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