diff --git a/pkg/operator/operator.go b/pkg/operator/operator.go index 0577dc9188..50a7533733 100644 --- a/pkg/operator/operator.go +++ b/pkg/operator/operator.go @@ -200,7 +200,7 @@ func NewOperator() (context.Context, *Operator) { lo.Must0(mgr.GetFieldIndexer().IndexField(ctx, &v1.NodeClaim{}, "status.providerID", func(o client.Object) []string { return []string{o.(*v1.NodeClaim).Status.ProviderID} }), "failed to setup nodeclaim provider id indexer") - lo.Must0(mgr.GetFieldIndexer().IndexField(ctx, &v1.NodeClaim{}, "spec.nodeClassRef.apiVersion", func(o client.Object) []string { + lo.Must0(mgr.GetFieldIndexer().IndexField(ctx, &v1.NodeClaim{}, "spec.nodeClassRef.group", func(o client.Object) []string { return []string{o.(*v1.NodeClaim).Spec.NodeClassRef.Group} }), "failed to setup nodeclaim nodeclassref apiversion indexer") lo.Must0(mgr.GetFieldIndexer().IndexField(ctx, &v1.NodeClaim{}, "spec.nodeClassRef.kind", func(o client.Object) []string { @@ -209,7 +209,7 @@ func NewOperator() (context.Context, *Operator) { lo.Must0(mgr.GetFieldIndexer().IndexField(ctx, &v1.NodeClaim{}, "spec.nodeClassRef.name", func(o client.Object) []string { return []string{o.(*v1.NodeClaim).Spec.NodeClassRef.Name} }), "failed to setup nodeclaim nodeclassref name indexer") - lo.Must0(mgr.GetFieldIndexer().IndexField(ctx, &v1.NodePool{}, "spec.template.spec.nodeClassRef.apiVersion", func(o client.Object) []string { + lo.Must0(mgr.GetFieldIndexer().IndexField(ctx, &v1.NodePool{}, "spec.template.spec.nodeClassRef.group", func(o client.Object) []string { return []string{o.(*v1.NodePool).Spec.Template.Spec.NodeClassRef.Group} }), "failed to setup nodepool nodeclassref apiversion indexer") lo.Must0(mgr.GetFieldIndexer().IndexField(ctx, &v1.NodePool{}, "spec.template.spec.nodeClassRef.kind", func(o client.Object) []string { diff --git a/pkg/utils/nodeclaim/nodeclaim.go b/pkg/utils/nodeclaim/nodeclaim.go index c03a8b46c6..02d326df7b 100644 --- a/pkg/utils/nodeclaim/nodeclaim.go +++ b/pkg/utils/nodeclaim/nodeclaim.go @@ -95,9 +95,9 @@ func NodeClassEventHandler(c client.Client) handler.EventHandler { return handler.EnqueueRequestsFromMapFunc(func(ctx context.Context, o client.Object) (requests []reconcile.Request) { nodeClaimList := &v1.NodeClaimList{} if err := c.List(ctx, nodeClaimList, client.MatchingFields{ - "spec.nodeClassRef.apiVersion": object.GVK(o).GroupVersion().String(), - "spec.nodeClassRef.kind": object.GVK(o).Kind, - "spec.nodeClassRef.name": o.GetName(), + "spec.nodeClassRef.group": object.GVK(o).Group, + "spec.nodeClassRef.kind": object.GVK(o).Kind, + "spec.nodeClassRef.name": o.GetName(), }); err != nil { return requests } diff --git a/pkg/utils/nodepool/nodepool.go b/pkg/utils/nodepool/nodepool.go index dcb496aff3..e6e51de3bd 100644 --- a/pkg/utils/nodepool/nodepool.go +++ b/pkg/utils/nodepool/nodepool.go @@ -35,9 +35,9 @@ func NodeClassEventHandler(c client.Client) handler.EventHandler { return handler.EnqueueRequestsFromMapFunc(func(ctx context.Context, o client.Object) (requests []reconcile.Request) { nodePoolList := &v1.NodePoolList{} if err := c.List(ctx, nodePoolList, client.MatchingFields{ - "spec.template.spec.nodeClassRef.apiVersion": object.GVK(o).GroupVersion().String(), - "spec.template.spec.nodeClassRef.kind": object.GVK(o).Kind, - "spec.template.spec.nodeClassRef.name": o.GetName(), + "spec.template.spec.nodeClassRef.group": object.GVK(o).Group, + "spec.template.spec.nodeClassRef.kind": object.GVK(o).Kind, + "spec.template.spec.nodeClassRef.name": o.GetName(), }); err != nil { return requests }