Skip to content

Commit

Permalink
fix: update nodeClassRef.apiVersion refs to group (#1408)
Browse files Browse the repository at this point in the history
  • Loading branch information
jmdeal committed Jul 11, 2024
1 parent c691dd4 commit 195f896
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions pkg/operator/operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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 {
Expand Down
6 changes: 3 additions & 3 deletions pkg/utils/nodeclaim/nodeclaim.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
6 changes: 3 additions & 3 deletions pkg/utils/nodepool/nodepool.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 195f896

Please sign in to comment.