Skip to content

Commit

Permalink
handle error when AppSets CRDs are missing
Browse files Browse the repository at this point in the history
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 <rakeshgm@redhat.com>
  • Loading branch information
rakeshgm authored and ShyamsundarR committed Jul 4, 2023
1 parent 941a630 commit 0985922
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions controllers/drplacementcontrol_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down

0 comments on commit 0985922

Please sign in to comment.