Skip to content

Commit

Permalink
ClusterToObjectsMapper: replace runtime.Object parameter with
Browse files Browse the repository at this point in the history
client.ObjectList

Signed-off-by: Stefan Büringer buringerst@vmware.com
  • Loading branch information
sbueringer committed Oct 5, 2021
1 parent e25f0e3 commit 62cebab
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
6 changes: 1 addition & 5 deletions util/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -483,11 +483,7 @@ func (o MachinesByCreationTimestamp) Less(i, j int) bool {
// ClusterToObjectsMapper returns a mapper function that gets a cluster and lists all objects for the object passed in
// and returns a list of requests.
// NB: The objects are required to have `clusterv1.ClusterLabelName` applied.
func ClusterToObjectsMapper(c client.Client, ro runtime.Object, scheme *runtime.Scheme) (handler.MapFunc, error) {
if _, ok := ro.(metav1.ListInterface); !ok {
return nil, errors.Errorf("expected a metav1.ListInterface, got %T instead", ro)
}

func ClusterToObjectsMapper(c client.Client, ro client.ObjectList, scheme *runtime.Scheme) (handler.MapFunc, error) {
gvk, err := apiutil.GVKForObject(ro, scheme)
if err != nil {
return nil, err
Expand Down
2 changes: 1 addition & 1 deletion util/util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -600,7 +600,7 @@ func TestClusterToObjectsMapper(t *testing.T) {
table := []struct {
name string
objects []client.Object
input runtime.Object
input client.ObjectList
output []ctrl.Request
expectError bool
}{
Expand Down

0 comments on commit 62cebab

Please sign in to comment.