From d404f491c962603d2ce82e26cee3ae35a2f80929 Mon Sep 17 00:00:00 2001 From: Tom Wieczorek Date: Fri, 20 Dec 2024 14:55:18 +0100 Subject: [PATCH 1/3] Compile users.LookupUID via build tags On Windows, there's no numeric UIDs, so using this there is futile. Signed-off-by: Tom Wieczorek --- internal/pkg/users/lookup_other.go | 29 ++++++++ internal/pkg/users/lookup_unix.go | 67 +++++++++++++++++++ .../{users_test.go => lookup_unix_test.go} | 7 +- internal/pkg/users/users.go | 44 ------------ 4 files changed, 97 insertions(+), 50 deletions(-) create mode 100644 internal/pkg/users/lookup_other.go create mode 100644 internal/pkg/users/lookup_unix.go rename internal/pkg/users/{users_test.go => lookup_unix_test.go} (90%) diff --git a/internal/pkg/users/lookup_other.go b/internal/pkg/users/lookup_other.go new file mode 100644 index 000000000000..ec86cfdb7112 --- /dev/null +++ b/internal/pkg/users/lookup_other.go @@ -0,0 +1,29 @@ +//go:build !unix + +/* +Copyright 2024 k0s authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package users + +import ( + "errors" + "fmt" + "runtime" +) + +func LookupUID(string) (int, error) { + return 0, fmt.Errorf("%w on %s", errors.ErrUnsupported, runtime.GOOS) +} diff --git a/internal/pkg/users/lookup_unix.go b/internal/pkg/users/lookup_unix.go new file mode 100644 index 000000000000..4cb1f617c269 --- /dev/null +++ b/internal/pkg/users/lookup_unix.go @@ -0,0 +1,67 @@ +//go:build unix + +/* +Copyright 2024 k0s authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package users + +import ( + "bytes" + "errors" + "fmt" + "os/exec" + "os/user" + "strconv" +) + +// Lookup looks up a user's UID by username. If the user cannot be found, the +// returned error is [ErrNotExist]. If an error is returned, the returned UID +// will be [UnknownUID]. +func LookupUID(name string) (int, error) { + var uid string + + if entry, err := user.Lookup(name); err != nil { + if !errors.Is(err, user.UnknownUserError(name)) { + return UnknownUID, err + } + + err = ErrNotExist + + // fallback to call external `id` in case NSS is used + out, idErr := exec.Command("id", "-u", name).Output() + if idErr != nil { + var exitErr *exec.ExitError + if errors.As(idErr, &exitErr) { + return UnknownUID, fmt.Errorf("%w (%w: %s)", err, idErr, bytes.TrimSpace(exitErr.Stderr)) + } + return UnknownUID, fmt.Errorf("%w (%w)", err, idErr) + } + + uid = string(bytes.TrimSpace(out)) + } else { + uid = entry.Uid + } + + parsedUID, err := strconv.Atoi(uid) + if err != nil { + return UnknownUID, fmt.Errorf("UID %q is not a decimal integer: %w", uid, err) + } + if parsedUID < 0 { + return UnknownUID, fmt.Errorf("UID is negative: %d", parsedUID) + } + + return parsedUID, nil +} diff --git a/internal/pkg/users/users_test.go b/internal/pkg/users/lookup_unix_test.go similarity index 90% rename from internal/pkg/users/users_test.go rename to internal/pkg/users/lookup_unix_test.go index befd9c6d84b8..1bf444bc429c 100644 --- a/internal/pkg/users/users_test.go +++ b/internal/pkg/users/lookup_unix_test.go @@ -18,17 +18,12 @@ package users import ( "os/exec" - "runtime" "testing" "github.com/stretchr/testify/assert" ) -func TestGetUID(t *testing.T) { - if runtime.GOOS == "windows" { - t.Skip("No numeric user IDs on Windows") - } - +func TestLookupUID(t *testing.T) { uid, err := LookupUID("root") if assert.NoError(t, err, "Failed to get UID for root user") { assert.Equal(t, 0, uid, "root's UID is not 0?") diff --git a/internal/pkg/users/users.go b/internal/pkg/users/users.go index e633a9e17fd1..f8927424246d 100644 --- a/internal/pkg/users/users.go +++ b/internal/pkg/users/users.go @@ -17,12 +17,7 @@ limitations under the License. package users import ( - "bytes" "errors" - "fmt" - "os/exec" - "os/user" - "strconv" ) const ( @@ -39,42 +34,3 @@ const ( ) var ErrNotExist = errors.New("user does not exist") - -// Lookup looks up a user's UID by username. If the user cannot be found, the -// returned error is [ErrNotExist]. If an error is returned, the returned UID -// will be [UnknownUID]. -func LookupUID(name string) (int, error) { - var uid string - - if entry, err := user.Lookup(name); err != nil { - if !errors.Is(err, user.UnknownUserError(name)) { - return UnknownUID, err - } - - err = ErrNotExist - - // fallback to call external `id` in case NSS is used - out, idErr := exec.Command("id", "-u", name).Output() - if idErr != nil { - var exitErr *exec.ExitError - if errors.As(idErr, &exitErr) { - return UnknownUID, fmt.Errorf("%w (%w: %s)", err, idErr, bytes.TrimSpace(exitErr.Stderr)) - } - return UnknownUID, fmt.Errorf("%w (%w)", err, idErr) - } - - uid = string(bytes.TrimSpace(out)) - } else { - uid = entry.Uid - } - - parsedUID, err := strconv.Atoi(uid) - if err != nil { - return UnknownUID, fmt.Errorf("UID %q is not a decimal integer: %w", uid, err) - } - if parsedUID < 0 { - return UnknownUID, fmt.Errorf("UID is negative: %d", parsedUID) - } - - return parsedUID, nil -} From 9d89909113507133aedb3bf8f2218310b2ed4a32 Mon Sep 17 00:00:00 2001 From: Tom Wieczorek Date: Sat, 21 Dec 2024 00:52:53 +0100 Subject: [PATCH 2/3] Remove global StatusSocket variable ...and harmonize the status-socket flag in the status sub-command. The shared use of the StatusSocket variable, along with the non-empty default value in the status sub-command, caused the registration order of sub-commands to change the flag value for each sub-command, even if it wasn't set from the command line. This broke the configuration defaulting. Signed-off-by: Tom Wieczorek --- cmd/status/status.go | 3 +-- pkg/config/cli.go | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/cmd/status/status.go b/cmd/status/status.go index f797b6ebd033..e2294b9c483b 100644 --- a/cmd/status/status.go +++ b/cmd/status/status.go @@ -20,7 +20,6 @@ import ( "encoding/json" "fmt" "io" - "path/filepath" "github.com/k0sproject/k0s/pkg/component/status" "github.com/k0sproject/k0s/pkg/config" @@ -56,7 +55,7 @@ func NewStatusCmd() *cobra.Command { } cmd.PersistentFlags().StringVarP(&output, "out", "o", "", "sets type of output to json or yaml") - cmd.PersistentFlags().StringVar(&config.StatusSocket, "status-socket", filepath.Join(config.K0sVars.RunDir, "status.sock"), "Full file path to the socket file.") + cmd.PersistentFlags().String("status-socket", "", "Full file path to the socket file. (default: /status.sock)") cmd.AddCommand(NewStatusSubCmdComponents()) return cmd } diff --git a/pkg/config/cli.go b/pkg/config/cli.go index 2cca62e56b25..da3e735cb590 100644 --- a/pkg/config/cli.go +++ b/pkg/config/cli.go @@ -36,7 +36,6 @@ var ( CfgFile string Debug bool DebugListenOn string - StatusSocket string K0sVars CfgVars workerOpts WorkerOptions Verbose bool @@ -199,7 +198,7 @@ func GetPersistentFlagSet() *pflag.FlagSet { flagset.BoolVarP(&Debug, "debug", "d", false, "Debug logging (default: false)") flagset.BoolVarP(&Verbose, "verbose", "v", false, "Verbose logging (default: false)") flagset.String("data-dir", constant.DataDirDefault, "Data Directory for k0s. DO NOT CHANGE for an existing setup, things will break!") - flagset.StringVar(&StatusSocket, "status-socket", "", "Full file path to the socket file. (default: /status.sock)") + flagset.String("status-socket", "", "Full file path to the socket file. (default: /status.sock)") flagset.StringVar(&DebugListenOn, "debugListenOn", ":6060", "Http listenOn for Debug pprof handler") return flagset } From 07ee5e9fc9b16ff9ebdf8275b998950141713bd3 Mon Sep 17 00:00:00 2001 From: Tom Wieczorek Date: Tue, 24 Dec 2024 15:13:34 +0100 Subject: [PATCH 3/3] Provide several sub-commands only on Linux They won't work on non-Linux systems anyways. Use build flags to add platform-specific sub-commands instead of runtime checks. Also add build tag to files that only make sense on specific platforms. Signed-off-by: Tom Wieczorek --- cmd/backup/backup_windows.go | 36 ----------------- cmd/install/controller.go | 2 + cmd/install/controller_test.go | 2 + cmd/install/install.go | 2 + cmd/install/worker.go | 2 + cmd/reset/reset.go | 2 + cmd/restore/restore_windows.go | 35 ----------------- cmd/root.go | 23 +---------- cmd/root_linux.go | 39 +++++++++++++++++++ .../bridge_other.go => cmd/root_other.go | 10 ++--- cmd/root_test.go | 5 ++- cmd/start/start.go | 2 + cmd/status/status.go | 2 + cmd/stop/stop.go | 2 + internal/pkg/users/lookup_unix_test.go | 2 + pkg/cleanup/cleanup.go | 2 + pkg/cleanup/services.go | 2 + pkg/cleanup/users.go | 2 + pkg/install/linux_openrc.go | 2 + pkg/install/linux_systemd.go | 2 + pkg/install/linux_sysv.go | 2 + pkg/install/linux_upstart.go | 2 + pkg/install/service.go | 2 + pkg/install/users.go | 2 + 24 files changed, 86 insertions(+), 98 deletions(-) delete mode 100644 cmd/backup/backup_windows.go delete mode 100644 cmd/restore/restore_windows.go create mode 100644 cmd/root_linux.go rename pkg/cleanup/bridge_other.go => cmd/root_other.go (79%) diff --git a/cmd/backup/backup_windows.go b/cmd/backup/backup_windows.go deleted file mode 100644 index bd2a43661168..000000000000 --- a/cmd/backup/backup_windows.go +++ /dev/null @@ -1,36 +0,0 @@ -/* -Copyright 2021 k0s authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package backup - -import ( - "errors" - - "github.com/spf13/cobra" -) - -var savePath string - -func NewBackupCmd() *cobra.Command { - return &cobra.Command{ - Use: "backup", - Short: "Back-Up k0s configuration. Not supported on Windows OS", - Args: cobra.NoArgs, - RunE: func(cmd *cobra.Command, args []string) error { - return errors.New("unsupported Operating System for this command") - }, - } -} diff --git a/cmd/install/controller.go b/cmd/install/controller.go index 36e62c01b252..50ad91920a23 100644 --- a/cmd/install/controller.go +++ b/cmd/install/controller.go @@ -1,3 +1,5 @@ +//go:build linux + /* Copyright 2021 k0s authors diff --git a/cmd/install/controller_test.go b/cmd/install/controller_test.go index 0571ff991fb7..c8e9f90d071c 100644 --- a/cmd/install/controller_test.go +++ b/cmd/install/controller_test.go @@ -1,3 +1,5 @@ +//go:build linux + /* Copyright 2024 k0s authors diff --git a/cmd/install/install.go b/cmd/install/install.go index 11bd266faa30..113650d0816f 100644 --- a/cmd/install/install.go +++ b/cmd/install/install.go @@ -1,3 +1,5 @@ +//go:build linux + /* Copyright 2021 k0s authors diff --git a/cmd/install/worker.go b/cmd/install/worker.go index 55c79cb7dc8a..b7206fd9568f 100644 --- a/cmd/install/worker.go +++ b/cmd/install/worker.go @@ -1,3 +1,5 @@ +//go:build linux + /* Copyright 2021 k0s authors diff --git a/cmd/reset/reset.go b/cmd/reset/reset.go index 908c1540f7c5..8fee8ae43f63 100644 --- a/cmd/reset/reset.go +++ b/cmd/reset/reset.go @@ -1,3 +1,5 @@ +//go:build linux + /* Copyright 2021 k0s authors diff --git a/cmd/restore/restore_windows.go b/cmd/restore/restore_windows.go deleted file mode 100644 index a23e2e4cb6f2..000000000000 --- a/cmd/restore/restore_windows.go +++ /dev/null @@ -1,35 +0,0 @@ -/* -Copyright 2021 k0s authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package restore - -import ( - "errors" - - "github.com/spf13/cobra" -) - -var restoredConfigPath string - -func NewRestoreCmd() *cobra.Command { - return &cobra.Command{ - Use: "restore", - Short: "restore k0s state from given backup archive. Not supported in Windows OS", - RunE: func(cmd *cobra.Command, args []string) error { - return errors.New("unsupported Operating System for this command") - }, - } -} diff --git a/cmd/root.go b/cmd/root.go index a4b8f164c4c0..1b220489a65f 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -20,23 +20,15 @@ import ( "errors" "net/http" "os" - "runtime" "github.com/k0sproject/k0s/cmd/airgap" "github.com/k0sproject/k0s/cmd/api" - "github.com/k0sproject/k0s/cmd/backup" configcmd "github.com/k0sproject/k0s/cmd/config" "github.com/k0sproject/k0s/cmd/controller" "github.com/k0sproject/k0s/cmd/ctr" "github.com/k0sproject/k0s/cmd/etcd" - "github.com/k0sproject/k0s/cmd/install" "github.com/k0sproject/k0s/cmd/kubeconfig" "github.com/k0sproject/k0s/cmd/kubectl" - "github.com/k0sproject/k0s/cmd/reset" - "github.com/k0sproject/k0s/cmd/restore" - "github.com/k0sproject/k0s/cmd/start" - "github.com/k0sproject/k0s/cmd/status" - "github.com/k0sproject/k0s/cmd/stop" "github.com/k0sproject/k0s/cmd/sysinfo" "github.com/k0sproject/k0s/cmd/token" "github.com/k0sproject/k0s/cmd/validate" @@ -83,25 +75,12 @@ func NewRootCmd() *cobra.Command { cmd.AddCommand(airgap.NewAirgapCmd()) cmd.AddCommand(api.NewAPICmd()) - cmd.AddCommand(backup.NewBackupCmd()) cmd.AddCommand(controller.NewControllerCmd()) cmd.AddCommand(ctr.NewCtrCommand()) cmd.AddCommand(configcmd.NewConfigCmd()) cmd.AddCommand(etcd.NewEtcdCmd()) - cmd.AddCommand(install.NewInstallCmd()) cmd.AddCommand(kubeconfig.NewKubeConfigCmd()) cmd.AddCommand(kubectl.NewK0sKubectlCmd()) - if runtime.GOOS == "linux" { - // Currently only supported on Linux - cmd.AddCommand(reset.NewResetCmd()) - } - cmd.AddCommand(restore.NewRestoreCmd()) - cmd.AddCommand(start.NewStartCmd()) - if runtime.GOOS == "linux" { - // Currently only supported on Linux - cmd.AddCommand(status.NewStatusCmd()) - } - cmd.AddCommand(stop.NewStopCmd()) cmd.AddCommand(sysinfo.NewSysinfoCmd()) cmd.AddCommand(token.NewTokenCmd()) cmd.AddCommand(validate.NewValidateCmd()) // hidden+deprecated @@ -112,6 +91,8 @@ func NewRootCmd() *cobra.Command { cmd.AddCommand(newDefaultConfigCmd()) // hidden+deprecated cmd.AddCommand(newDocsCmd()) + addPlatformSpecificCommands(cmd) + cmd.DisableAutoGenTag = true longDesc = "k0s - The zero friction Kubernetes - https://k0sproject.io" if build.EulaNotice != "" { diff --git a/cmd/root_linux.go b/cmd/root_linux.go new file mode 100644 index 000000000000..dd018e859c42 --- /dev/null +++ b/cmd/root_linux.go @@ -0,0 +1,39 @@ +/* +Copyright 2024 k0s authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package cmd + +import ( + "github.com/k0sproject/k0s/cmd/backup" + "github.com/k0sproject/k0s/cmd/install" + "github.com/k0sproject/k0s/cmd/reset" + "github.com/k0sproject/k0s/cmd/restore" + "github.com/k0sproject/k0s/cmd/start" + "github.com/k0sproject/k0s/cmd/status" + "github.com/k0sproject/k0s/cmd/stop" + + "github.com/spf13/cobra" +) + +func addPlatformSpecificCommands(root *cobra.Command) { + root.AddCommand(backup.NewBackupCmd()) + root.AddCommand(install.NewInstallCmd()) + root.AddCommand(reset.NewResetCmd()) + root.AddCommand(restore.NewRestoreCmd()) + root.AddCommand(start.NewStartCmd()) + root.AddCommand(status.NewStatusCmd()) + root.AddCommand(stop.NewStopCmd()) +} diff --git a/pkg/cleanup/bridge_other.go b/cmd/root_other.go similarity index 79% rename from pkg/cleanup/bridge_other.go rename to cmd/root_other.go index 215f255e2395..0e69822b2757 100644 --- a/pkg/cleanup/bridge_other.go +++ b/cmd/root_other.go @@ -1,7 +1,7 @@ //go:build !linux /* -Copyright 2021 k0s authors +Copyright 2024 k0s authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -16,8 +16,8 @@ See the License for the specific language governing permissions and limitations under the License. */ -package cleanup +package cmd -func newBridgeStep() Step { - return nil -} +import "github.com/spf13/cobra" + +func addPlatformSpecificCommands(root *cobra.Command) { /* no-op */ } diff --git a/cmd/root_test.go b/cmd/root_test.go index 263c45c80ca8..43fb6b135ff8 100644 --- a/cmd/root_test.go +++ b/cmd/root_test.go @@ -21,6 +21,7 @@ import ( "errors" "fmt" "io" + "runtime" "slices" "strings" "testing" @@ -77,10 +78,12 @@ func TestUnknownSubCommandsAreRejected(t *testing.T) { commandsWithArguments := []string{ "controller", "kubeconfig create", - "restore", "token invalidate", "worker", } + if runtime.GOOS == "linux" { + commandsWithArguments = append(commandsWithArguments, "restore") + } t.Cleanup(func() { if !t.Failed() { assert.Empty(t, commandsWithArguments, "Some sub-commands are listed unnecessarily") diff --git a/cmd/start/start.go b/cmd/start/start.go index c0e511e04bb8..69b65518f9fe 100644 --- a/cmd/start/start.go +++ b/cmd/start/start.go @@ -1,3 +1,5 @@ +//go:build linux + /* Copyright 2021 k0s authors diff --git a/cmd/status/status.go b/cmd/status/status.go index e2294b9c483b..258ab2adffdc 100644 --- a/cmd/status/status.go +++ b/cmd/status/status.go @@ -1,3 +1,5 @@ +//go:build unix + /* Copyright 2021 k0s authors diff --git a/cmd/stop/stop.go b/cmd/stop/stop.go index 69429b9d26c0..fdc1ba7ce587 100644 --- a/cmd/stop/stop.go +++ b/cmd/stop/stop.go @@ -1,3 +1,5 @@ +//go:build linux + /* Copyright 2021 k0s authors diff --git a/internal/pkg/users/lookup_unix_test.go b/internal/pkg/users/lookup_unix_test.go index 1bf444bc429c..a240d173887a 100644 --- a/internal/pkg/users/lookup_unix_test.go +++ b/internal/pkg/users/lookup_unix_test.go @@ -1,3 +1,5 @@ +//go:build unix + /* Copyright 2022 k0s authors diff --git a/pkg/cleanup/cleanup.go b/pkg/cleanup/cleanup.go index c07cbba24321..9d76a2c85ea7 100644 --- a/pkg/cleanup/cleanup.go +++ b/pkg/cleanup/cleanup.go @@ -1,3 +1,5 @@ +//go:build linux + /* Copyright 2021 k0s authors diff --git a/pkg/cleanup/services.go b/pkg/cleanup/services.go index 9f91ddc377ae..834f5348a848 100644 --- a/pkg/cleanup/services.go +++ b/pkg/cleanup/services.go @@ -1,3 +1,5 @@ +//go:build linux + /* Copyright 2021 k0s authors diff --git a/pkg/cleanup/users.go b/pkg/cleanup/users.go index 9bd2b4cf699e..875687618cb5 100644 --- a/pkg/cleanup/users.go +++ b/pkg/cleanup/users.go @@ -1,3 +1,5 @@ +//go:build unix + /* Copyright 2021 k0s authors diff --git a/pkg/install/linux_openrc.go b/pkg/install/linux_openrc.go index 4f3461a8a310..4d9f598d8404 100644 --- a/pkg/install/linux_openrc.go +++ b/pkg/install/linux_openrc.go @@ -1,3 +1,5 @@ +//go:build linux + /* Copyright 2022 k0s authors diff --git a/pkg/install/linux_systemd.go b/pkg/install/linux_systemd.go index 635946a7553a..825cef6587b7 100644 --- a/pkg/install/linux_systemd.go +++ b/pkg/install/linux_systemd.go @@ -1,3 +1,5 @@ +//go:build linux + /* Copyright 2024 k0s authors diff --git a/pkg/install/linux_sysv.go b/pkg/install/linux_sysv.go index 2eebbb7f3669..1189cfaff687 100644 --- a/pkg/install/linux_sysv.go +++ b/pkg/install/linux_sysv.go @@ -1,3 +1,5 @@ +//go:build linux + /* Copyright 2022 k0s authors diff --git a/pkg/install/linux_upstart.go b/pkg/install/linux_upstart.go index 17d18e2257f2..61ea9ca2df81 100644 --- a/pkg/install/linux_upstart.go +++ b/pkg/install/linux_upstart.go @@ -1,3 +1,5 @@ +//go:build linux + /* Copyright 2022 k0s authors diff --git a/pkg/install/service.go b/pkg/install/service.go index c7cccd5d4b1c..283fd5e43c72 100644 --- a/pkg/install/service.go +++ b/pkg/install/service.go @@ -1,3 +1,5 @@ +//go:build linux + /* Copyright 2020 k0s authors diff --git a/pkg/install/users.go b/pkg/install/users.go index 9a85ec83aeaf..ebe83d7689d6 100644 --- a/pkg/install/users.go +++ b/pkg/install/users.go @@ -65,6 +65,8 @@ func DeleteControllerUsers(systemUsers *v1beta1.SystemUser) error { if err := deleteUser(userName); err != nil { errs = append(errs, err) } + } else if !errors.Is(err, users.ErrNotExist) { + errs = append(errs, err) } }