From f54cf000fd25765ffb16dbc955cdb64591a9370b Mon Sep 17 00:00:00 2001 From: justinsb Date: Sun, 26 Sep 2021 10:21:42 -0400 Subject: [PATCH] GCE: use chrony on Ubuntu + GCE Ubuntu on GCE has systemd-timesyncd masked, and recommends (and preconfigures) chrony instead. --- nodeup/pkg/model/context.go | 5 +++++ nodeup/pkg/model/ntp.go | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/nodeup/pkg/model/context.go b/nodeup/pkg/model/context.go index e5fa2e3fe7..c8d3229b1d 100644 --- a/nodeup/pkg/model/context.go +++ b/nodeup/pkg/model/context.go @@ -668,3 +668,8 @@ func (c *NodeupModelContext) InstallNvidiaRuntime() bool { fi.BoolValue(c.NodeupConfig.NvidiaGPU.Enabled) && c.GPUVendor == architectures.GPUVendorNvidia } + +// RunningOnGCE returns true if we are running on GCE +func (c *NodeupModelContext) RunningOnGCE() bool { + return kops.CloudProviderID(c.Cluster.Spec.CloudProvider) == kops.CloudProviderGCE +} diff --git a/nodeup/pkg/model/ntp.go b/nodeup/pkg/model/ntp.go index 7a0f2ecd34..3abe33c794 100644 --- a/nodeup/pkg/model/ntp.go +++ b/nodeup/pkg/model/ntp.go @@ -59,7 +59,8 @@ func (b *NTPBuilder) Build(c *fi.ModelBuilderContext) error { } if b.Distribution.IsDebianFamily() { - if b.Distribution.IsUbuntu() { + // Ubuntu recommends systemd-timesyncd, but on ubuntu on GCE systemd-timesyncd is blocked (in favor of chrony) + if b.Distribution.IsUbuntu() && !b.RunningOnGCE() { if ntpHost != "" { c.AddTask(b.buildTimesyncdConf("/etc/systemd/timesyncd.conf", ntpHost)) }