From 9b69b5cb46e07ced84e5f02de30e625e70548794 Mon Sep 17 00:00:00 2001 From: zer0def Date: Sat, 18 Nov 2023 22:11:26 +0100 Subject: [PATCH] rgw: correctly handle mgr-proxied rgw cli commands in multus scenarios Due to multi-site Ceph object resources (realms, zonegroups, zones) reconciliation CLI commands being proxied through CephCluster's Mgr pods in Multus-based scenarios, return codes were being additionally wrapped by K8S' command streams and weren't adequately handled in-code, causing reconciliation of CephObject(Realm|ZoneGroup|Zone) resources to fail, as an exit code of 0, instead of the expected syscall.ENOENT (2) was returned. Fixes #12833 Signed-off-by: zer0def --- pkg/util/exec/error.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pkg/util/exec/error.go b/pkg/util/exec/error.go index 55cebc599..88f355ccc 100644 --- a/pkg/util/exec/error.go +++ b/pkg/util/exec/error.go @@ -19,6 +19,7 @@ package exec import ( "fmt" + kexec "k8s.io/client-go/util/exec" "os/exec" "syscall" ) @@ -41,12 +42,12 @@ func ExitStatus(err error) (int, bool) { if ok { return waitStatus.ExitStatus(), true } - + case kexec.CodeExitError: + return int(e.ExitStatus()), true case *CephCLIError: return ExitStatus(e.err) case syscall.Errno: return int(e), true - } return 0, false }