Skip to content

Commit

Permalink
fix: remove type casting check from mgmtv3 controller
Browse files Browse the repository at this point in the history
Signed-off-by: Carlos Salas <carlos.salas@suse.com>
  • Loading branch information
salasberryfin committed Feb 26, 2024
1 parent 463bf77 commit 8ace0a1
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions internal/controllers/import_controller_v3.go
Original file line number Diff line number Diff line change
Expand Up @@ -316,13 +316,7 @@ func (r *CAPIImportManagementV3Reconciler) reconcileNormal(ctx context.Context,
func (r *CAPIImportManagementV3Reconciler) rancherClusterToCapiCluster(ctx context.Context, clusterPredicate predicate.Funcs) handler.MapFunc {
log := log.FromContext(ctx)

return func(_ context.Context, o client.Object) []ctrl.Request {
cluster, ok := o.(*managementv3.Cluster)
if !ok {
log.Error(nil, fmt.Sprintf("Expected a rancher cluster but got a %T", o))
return nil
}

return func(_ context.Context, cluster client.Object) []ctrl.Request {
labels := cluster.GetLabels()
if _, ok := labels[capiClusterOwner]; !ok {
log.Error(fmt.Errorf("missing label %s", capiClusterOwner), "getting rancher cluster labels")
Expand Down

0 comments on commit 8ace0a1

Please sign in to comment.