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

Implement NTP source info messages to the controller #3968

Merged
merged 9 commits into from
Jun 25, 2024
1 change: 1 addition & 0 deletions docs/CONFIG-PROPERTIES.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
| timer.metric.diskscan.interval | integer in seconds | 300 | how frequently device should scan the disk for metrics |
| timer.location.cloud.interval | integer in seconds | 1 hour | how frequently device reports geographic location information to controller |
| timer.location.app.interval | integer in seconds | 20 | how frequently device reports geographic location information to applications (to local profile server and to other apps via meta-data server) |
| timer.ntpsources.interval | integer in seconds | 10 minutes | how frequently device forcibly reports information about NTP sources to which EVE has established a connection for the NTP synchronization. Requests are also sent to the controller if the list of NTP peers or NTP peer fields, such as mode, state, have changed. |
| timer.send.timeout | timer in seconds | 120 | time for each http/send |
| timer.dial.timeout | timer in seconds | 10 | maximum time allowed to establish connection |
| timer.reboot.no.network | integer in seconds | 7 days | reboot after no cloud connectivity |
Expand Down
17 changes: 16 additions & 1 deletion docs/DEVICE-CONNECTIVITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -278,13 +278,28 @@ Note that proxying of application traffic has to be configured on the applicatio

## Network Time Protocol (NTP)

EVE always tries to keep its clock synchronized by embedding a NTP Client that synchronizes
EVE always tries to keep its clock synchronized using NTP daemon (chronyd) that synchronizes
the system's clock since the boot time.
This is especially important on the very first boot to ensure that all device certificates
are generated with valid timestamps. EVE will first try to use NTP servers either received
from DHCP servers or statically configured in the network override configuration used for
bootstrapping (see the next section for more info on the network bootstrapping process).
If no NTP server is provided by DHCP or config, EVE will try to use `pool.ntp.org` by default.
Every 5 min (see [pkg/pillar/scripts/device-steps.sh](../pkg/pillar/scripts/device-steps.sh)
for details) EVE fetches NTP server configuration and restarts NTP daemon if
configuration has been changed.

Also EVE periodically sends information about NTP sources to the controller. NTP sources
are peers to which EVE has established a connection for the NTP synchronization. The
reporting period is defied as a runtime configuration property `timer.ntpsources.interval`
and described in [CONFIG-PROPERTIES.md](CONFIG-PROPERTIES.md). NTP sources updates are also
sent regardless of the specified interval if the list of NTP peers or NTP peer fields,
such as mode, state, have changed.

NTP sources reports consist of fields which are well described on the following resources:

- <https://www.ntp.org/documentation/4.2.8-series/ntpq>, "Peer Variables" section
- <https://chrony-project.org/doc/4.5/chronyc.html>, "Time sources" section

For more info on clock synchronization, refer to [CLOCK-SYNCHRONIZATION.md](CLOCK-SYNCHRONIZATION.md).

Expand Down
2 changes: 1 addition & 1 deletion pkg/pillar/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ ENV BUILD_PKGS patch
ENV PKGS alpine-baselayout musl-utils libtasn1-progs pciutils yajl xz bash iptables ip6tables iproute2 dhcpcd \
coreutils dmidecode libbz2 libuuid ipset curl radvd ethtool util-linux e2fsprogs libcrypto1.1 xorriso \
qemu-img jq e2fsprogs-extra keyutils ca-certificates ip6tables-openrc iptables-openrc ipset-openrc hdparm \
libintl libtirpc libblkid zlib rsync
libintl libtirpc libblkid zlib rsync chrony
RUN eve-alpine-deploy.sh

SHELL ["/bin/ash", "-eo", "pipefail", "-c"]
Expand Down
1 change: 1 addition & 0 deletions pkg/pillar/cmd/zedagent/handleconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ type getconfigContext struct {
locationCloudTickerHandle interface{}
locationAppTickerHandle interface{}
localProfileTickerHandle interface{}
ntpSourcesTickerHandle interface{}
pubDevicePortConfig pubsub.Publication
pubPhysicalIOAdapters pubsub.Publication
devicePortConfig types.DevicePortConfig
Expand Down
8 changes: 6 additions & 2 deletions pkg/pillar/cmd/zedagent/handlemetrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,12 @@ func metricsAndInfoTimerTask(ctx *zedagentContext, handleChannel chan interface{

locConfig := ctx.getconfigCtx.sideController.locConfig
if locConfig != nil {
// Publish all info by timer only for LOC
triggerPublishAllInfo(ctx, LOCDest)
// Publish all info by timer only for LOC. LOC is
// always special due its volatile nature, so set
// @ForceSend to be sure request will be send
// regardless of any checks applied to a request
// (check handlentp.go for details).
triggerPublishAllInfo(ctx, LOCDest|ForceSend)
}

case <-stillRunning.C:
Expand Down
Loading
Loading