kubernetes-sigs/image-builder

NTP servers configured via DHCP take a long time to start syncing

tommasopozzetti opened this issue · 0 comments

Environment

  • Make target: make build-node-ova-vsphere-ubuntu-2004
  • Run using container image? (Y/N): Y

What steps did you take and what happened?

When using DHCP to set NTP servers for chrony, it takes a long time (around 3 minutes) for the DHCP NTP sources to become selectable. This is likely because we are not using iburst for those servers but that is set for the default NTP pools. The chrony hook for dhclient does add iburst by default for any server discovered via DHCP but the custom hook created for these images that use systemd-networkd instead does not set that arg.

$ cat /etc/dhcp/dhclient-exit-hooks.d/chrony | grep echo
        echo "$server iburst" >> "$SERVERFILE"

$ cat /etc/networkd-dispatcher/routable.d/20-chrony | grep echo
    echo "$json" | jq -r 'select(.NTP !=null) .NTP[]' >> $DHCP_SERVER_FILE

What did you expect to happen?

The NTP servers discovered via DHCP are synced as quickly as the default pools

Anything else you would like to add?

I think this would be as easy as editing the chrony hooks in here to replace

echo "$json" | jq -r 'select(.NTP !=null) .NTP[]' >> $DHCP_SERVER_FILE

with

echo "$json" | jq -r 'select(.NTP !=null) .NTP | map(. + " iburst") | .[]' >> $DHCP_SERVER_FILE

I'd be happy to open a PR for this but I first wanted to check if this would be desirable or if there is any counterargument I'm not thinking about
Thank you!


/kind bug