From 098592209cecc54d62cc06499c507da048c0488d Mon Sep 17 00:00:00 2001 From: rakeshgm Date: Mon, 3 Jul 2023 23:09:46 +0530 Subject: [PATCH] handle error when AppSets CRDs are missing We see an error when trying to list AppSets when AppSet CRDs are not installed hence ramen was in an error state and unable to proceed as the namespace was not returned. This is fixed by returning the default namespace when AppSets CRDs are not found. Bug: https://bugzilla.redhat.com/show_bug.cgi?id=2218181 Signed-off-by: rakeshgm --- controllers/drplacementcontrol_controller.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/controllers/drplacementcontrol_controller.go b/controllers/drplacementcontrol_controller.go index 4c1f9d7f6..5a946217e 100644 --- a/controllers/drplacementcontrol_controller.go +++ b/controllers/drplacementcontrol_controller.go @@ -1707,6 +1707,12 @@ func getApplicationDestinationNamespace( ) (string, error) { appSetList := argov1alpha1.ApplicationSetList{} if err := client.List(context.TODO(), &appSetList); err != nil { + // If ApplicationSet CRD is not found in the API server, + // default to Subscription behavior, and return the placement namespace as the target VRG namespace + if meta.IsNoMatchError(err) { + return placement.GetNamespace(), nil + } + return "", fmt.Errorf("ApplicationSet list: %w", err) }