-
Notifications
You must be signed in to change notification settings - Fork 69
SANDBOX-808: update kube & openshift dependencies to 4.17 #1146
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 3 commits
a9ffa09
979d7cf
9f1ee47
3050ffc
62b414c
51a1313
3b38922
cf558fc
7cc9516
6465379
34fb03c
0f9d8d5
d4fa4ed
8970ac4
0ae2f5e
506102f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,7 +16,6 @@ | |
"k8s.io/apimachinery/pkg/runtime" | ||
"k8s.io/apimachinery/pkg/types" | ||
ctrl "sigs.k8s.io/controller-runtime" | ||
"sigs.k8s.io/controller-runtime/pkg/builder" | ||
runtimeclient "sigs.k8s.io/controller-runtime/pkg/client" | ||
"sigs.k8s.io/controller-runtime/pkg/handler" | ||
"sigs.k8s.io/controller-runtime/pkg/log" | ||
|
@@ -49,9 +48,9 @@ | |
// Watch SpaceBindingRequests in all member clusters and all namespaces. | ||
for _, memberCluster := range memberClusters { | ||
b = b.WatchesRawSource( | ||
source.Kind(memberCluster.Cache, &toolchainv1alpha1.SpaceBindingRequest{}), | ||
&handler.EnqueueRequestForObject{}, | ||
builder.WithPredicates(predicate.GenerationChangedPredicate{})) | ||
source.Kind[runtimeclient.Object](memberCluster.Cache, &toolchainv1alpha1.SpaceBindingRequest{}, | ||
&handler.EnqueueRequestForObject{}, | ||
predicate.GenerationChangedPredicate{})) | ||
Comment on lines
+51
to
+53
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Btw, there are typed versions of the handlers and predicates, so you can use it: source.Kind(memberCluster.Cache, &toolchainv1alpha1.SpaceBindingRequest{},
&handler.TypedEnqueueRequestForObject[*toolchainv1alpha1.SpaceBindingRequest]{},
predicate.TypedGenerationChangedPredicate[*toolchainv1alpha1.SpaceBindingRequest]{})) but I'm not sure if it makes any sense in this particular case There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think I tried that way when I saw that we needed to refactor the code. It gives this error:
|
||
} | ||
return b.Complete(r) | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
probably not really related to this particular case since the mapper is generic, but there a function
that takes the type provided in the
source.Kind
function and use it as the generics to provide the same type down to the mapper and predicate. This can be very useful in the mappers and predicates that are specific to resource kind like this one:host-operator/controllers/usersignup/mapper.go
Lines 15 to 18 in 2d3af3b
or this one:
host-operator/controllers/spaceprovisionerconfig/mapper.go
Lines 28 to 33 in 2d3af3b
and there will be a few more
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mean replacing
EnqueueRequestsFromMapFunc
withTypedEnqueueRequestsFromMapFunc
on those calls and refactoring the code?