From 1cfc8ff7741584e9be15013b86e3651c1fe28580 Mon Sep 17 00:00:00 2001 From: Tom Wieczorek Date: Thu, 7 Nov 2024 10:10:49 +0100 Subject: [PATCH] Don't try to compile CPLB on darwin The unix build tag includes darwin, but CPLB only compiles on Linux. Use the linux build tag for the implementation instead, and use the current windows stub for anything that isn't linux. Signed-off-by: Tom Wieczorek --- .../controller/{cplb_unix.go => cplb_linux.go} | 2 -- .../controller/{cplb_windows.go => cplb_other.go} | 14 +++++++++----- 2 files changed, 9 insertions(+), 7 deletions(-) rename pkg/component/controller/{cplb_unix.go => cplb_linux.go} (99%) rename pkg/component/controller/{cplb_windows.go => cplb_other.go} (72%) diff --git a/pkg/component/controller/cplb_unix.go b/pkg/component/controller/cplb_linux.go similarity index 99% rename from pkg/component/controller/cplb_unix.go rename to pkg/component/controller/cplb_linux.go index b56bfdc699c4..9f7f1f28a1ad 100644 --- a/pkg/component/controller/cplb_unix.go +++ b/pkg/component/controller/cplb_linux.go @@ -1,5 +1,3 @@ -//go:build unix - /* Copyright 2024 k0s authors diff --git a/pkg/component/controller/cplb_windows.go b/pkg/component/controller/cplb_other.go similarity index 72% rename from pkg/component/controller/cplb_windows.go rename to pkg/component/controller/cplb_other.go index 93f023251030..48698989424f 100644 --- a/pkg/component/controller/cplb_windows.go +++ b/pkg/component/controller/cplb_other.go @@ -1,3 +1,5 @@ +//go:build !linux + /* Copyright 2024 k0s authors @@ -19,6 +21,8 @@ package controller import ( "context" "errors" + "fmt" + "runtime" k0sAPI "github.com/k0sproject/k0s/pkg/apis/k0s/v1beta1" "github.com/k0sproject/k0s/pkg/config" @@ -35,14 +39,14 @@ type Keepalived struct { KubeConfigPath string } -func (k *Keepalived) Init(_ context.Context) error { - return errors.New("CPLB is not supported on Windows") +func (k *Keepalived) Init(context.Context) error { + return fmt.Errorf("%w: CPLB is not supported on %s", errors.ErrUnsupported, runtime.GOOS) } -func (k *Keepalived) Start(_ context.Context) error { - return errors.New("CPLB is not supported on Windows") +func (k *Keepalived) Start(context.Context) error { + return fmt.Errorf("%w: CPLB is not supported on %s", errors.ErrUnsupported, runtime.GOOS) } func (k *Keepalived) Stop() error { - return errors.New("CPLB is not supported on Windows") + return fmt.Errorf("%w: CPLB is not supported on %s", errors.ErrUnsupported, runtime.GOOS) }