From caf7fd95ca2ff50b6fa8aa67736a2fc8e7ed2762 Mon Sep 17 00:00:00 2001 From: Daniel J Walsh Date: Tue, 31 Mar 2020 11:24:22 -0400 Subject: [PATCH] Only default to systemd if built with the systemd buildtag For packages that don't ship with systemd, this changes the default for those distros. Signed-off-by: Daniel J Walsh --- common/pkg/config/default.go | 4 ++-- common/pkg/config/nosystemd.go | 11 +++++++++++ common/pkg/config/systemd.go | 10 ++++++++++ 3 files changed, 23 insertions(+), 2 deletions(-) create mode 100644 common/pkg/config/nosystemd.go create mode 100644 common/pkg/config/systemd.go diff --git a/common/pkg/config/default.go b/common/pkg/config/default.go index d7142333bd..9d3fff710b 100644 --- a/common/pkg/config/default.go +++ b/common/pkg/config/default.go @@ -211,7 +211,7 @@ func defaultConfigFromMemory() (*EngineConfig, error) { if onCgroupsv2, _ := isCgroup2UnifiedMode(); onCgroupsv2 { c.OCIRuntime = "crun" } - c.CgroupManager = SystemdCgroupsManager + c.CgroupManager = defaultCgroupManager() c.StopTimeout = uint(10) c.OCIRuntimes = map[string][]string{ @@ -269,7 +269,7 @@ func defaultConfigFromMemory() (*EngineConfig, error) { c.InfraImage = DefaultInfraImage c.EnablePortReservation = true c.NumLocks = 2048 - c.EventsLogger = "journald" + c.EventsLogger = defaultEventsLogger() c.DetachKeys = DefaultDetachKeys c.SDNotify = false // TODO - ideally we should expose a `type LockType string` along with diff --git a/common/pkg/config/nosystemd.go b/common/pkg/config/nosystemd.go new file mode 100644 index 0000000000..5b82b13895 --- /dev/null +++ b/common/pkg/config/nosystemd.go @@ -0,0 +1,11 @@ +// +build !systemd + +package config + +func defaultCgroupManager() string { + return "cgroupfs" +} + +func defaultEventsLogger() string { + return "file" +} diff --git a/common/pkg/config/systemd.go b/common/pkg/config/systemd.go new file mode 100644 index 0000000000..e02f521926 --- /dev/null +++ b/common/pkg/config/systemd.go @@ -0,0 +1,10 @@ +// +build systemd + +package config + +func defaultCgroupManager() string { + return SystemdCgroupsManager +} +func defaultEventsLogger() string { + return "journald" +}