Skip to content

Commit

Permalink
modify type assertion in newOverridePolicyFunc
Browse files Browse the repository at this point in the history
Signed-off-by: wuyingjun <[email protected]>
  • Loading branch information
wuyingjun-lucky committed Dec 18, 2023
1 parent 21b2842 commit 68f45b4
Showing 1 changed file with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -170,13 +170,11 @@ func (c *ClusterResourceBindingController) SetupWithManager(mgr controllerruntim

func (c *ClusterResourceBindingController) newOverridePolicyFunc() handler.MapFunc {
return func(ctx context.Context, a client.Object) []reconcile.Request {
var overrideRS []policyv1alpha1.ResourceSelector
switch t := a.(type) {
case *policyv1alpha1.ClusterOverridePolicy:
overrideRS = t.Spec.ResourceSelectors
default:
clusterOverridePolicy, ok := a.(*policyv1alpha1.ClusterOverridePolicy)
if !ok {
return nil
}
overrideRS := clusterOverridePolicy.Spec.ResourceSelectors

bindingList := &workv1alpha2.ClusterResourceBindingList{}
if err := c.Client.List(context.TODO(), bindingList); err != nil {
Expand Down

0 comments on commit 68f45b4

Please sign in to comment.