From 89f7062431b85984d30d2348ea118056b512278f Mon Sep 17 00:00:00 2001 From: Brad Davidson Date: Tue, 17 Jan 2023 20:11:50 +0000 Subject: [PATCH] Add build tag to disable cri-dockerd Signed-off-by: Brad Davidson --- pkg/agent/cridockerd/config_linux.go | 4 ++-- pkg/agent/cridockerd/config_windows.go | 4 ++-- pkg/agent/cridockerd/cridockerd.go | 3 +++ pkg/agent/cridockerd/nocridockerd.go | 15 +++++++++++++++ 4 files changed, 22 insertions(+), 4 deletions(-) create mode 100644 pkg/agent/cridockerd/nocridockerd.go diff --git a/pkg/agent/cridockerd/config_linux.go b/pkg/agent/cridockerd/config_linux.go index efe347e573..541500fbc5 100644 --- a/pkg/agent/cridockerd/config_linux.go +++ b/pkg/agent/cridockerd/config_linux.go @@ -1,5 +1,5 @@ -//go:build linux -// +build linux +//go:build linux && !no_cri_dockerd +// +build linux,!no_cri_dockerd package cridockerd diff --git a/pkg/agent/cridockerd/config_windows.go b/pkg/agent/cridockerd/config_windows.go index 057481b41e..3630c26eae 100644 --- a/pkg/agent/cridockerd/config_windows.go +++ b/pkg/agent/cridockerd/config_windows.go @@ -1,5 +1,5 @@ -//go:build windows -// +build windows +//go:build windows && !no_cri_dockerd +// +build windows,!no_cri_dockerd package cridockerd diff --git a/pkg/agent/cridockerd/cridockerd.go b/pkg/agent/cridockerd/cridockerd.go index f170008322..433250b395 100644 --- a/pkg/agent/cridockerd/cridockerd.go +++ b/pkg/agent/cridockerd/cridockerd.go @@ -1,3 +1,6 @@ +//go:build !no_cri_dockerd +// +build !no_cri_dockerd + package cridockerd import ( diff --git a/pkg/agent/cridockerd/nocridockerd.go b/pkg/agent/cridockerd/nocridockerd.go new file mode 100644 index 0000000000..ba244743e3 --- /dev/null +++ b/pkg/agent/cridockerd/nocridockerd.go @@ -0,0 +1,15 @@ +//go:build no_cri_dockerd +// +build no_cri_dockerd + +package cridockerd + +import ( + "context" + "errors" + + "github.com/k3s-io/k3s/pkg/daemons/config" +) + +func Run(ctx context.Context, cfg *config.Node) error { + return errors.New("cri-dockerd disabled at build time") +}