Skip to content

Commit

Permalink
filter deploymenttargets by environment
Browse files Browse the repository at this point in the history
  • Loading branch information
eedorenko committed Nov 21, 2024
1 parent 2201d81 commit 46f8148
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions controllers/schedulingpolicy_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,9 @@ func (r *SchedulingPolicyReconciler) Reconcile(ctx context.Context, req ctrl.Req
return r.manageFailure(ctx, reqLogger, schedulingPolicy, err, "Failed to list ClusterTypes")
}

// fetch the list if deployment targets in the namespace
// fetch the list if deployment targets in the namespace with environment field equal to the namespace name
deploymentTargets := &schedulerv1alpha1.DeploymentTargetList{}
err = r.List(ctx, deploymentTargets, client.InNamespace(req.Namespace))
err = r.List(ctx, deploymentTargets, client.InNamespace(req.Namespace), client.MatchingFields{"environment": req.Namespace})
if err != nil {
return r.manageFailure(ctx, reqLogger, schedulingPolicy, err, "Failed to list DeploymentTargets")
}
Expand Down

0 comments on commit 46f8148

Please # to comment.