-
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
SANDBOX-808: update kube & openshift dependencies to 4.17 #1146
Conversation
106e06b
to
a9ffa09
Compare
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.
Looks good
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.
Looks good 👍
I would love to use the generic functions to propagate the object type into the specific predicates & mappers. This can be done as a separate task though - in a separate PR, let's just create a story for it.
source.Kind[runtimeclient.Object](memberCluster.Cache, &toolchainv1alpha1.SpaceBindingRequest{}, | ||
&handler.EnqueueRequestForObject{}, | ||
predicate.GenerationChangedPredicate{})) |
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.
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 comment
The 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:
type predicate.TypedGenerationChangedPredicate[*v1alpha1.SpaceBindingRequest] of predicate.TypedGenerationChangedPredicate[*toolchainv1alpha1.SpaceBindingRequest]{} does not match predicate.TypedPredicate[T] (cannot infer T)compilerCannotInferTypeArgs
b = b.WatchesRawSource(source.Kind[runtimeclient.Object](memberCluster.Cache, &toolchainv1alpha1.UserAccount{}, | ||
handler.EnqueueRequestsFromMapFunc(mapper.MapByResourceName(r.Namespace)), | ||
) | ||
)) |
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
handler.TypedEnqueueRequestsFromMapFunc
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
func MapBannedUserToUserSignup(cl runtimeclient.Client) func(ctx context.Context, object runtimeclient.Object) []reconcile.Request { | |
var logger = ctrl.Log.WithName("BannedUserToUserSignupMapper") | |
return func(ctx context.Context, obj runtimeclient.Object) []reconcile.Request { | |
if bu, ok := obj.(*toolchainv1alpha1.BannedUser); ok { |
or this one:
host-operator/controllers/spaceprovisionerconfig/mapper.go
Lines 28 to 33 in 2d3af3b
func MapToolchainStatusToSpaceProvisionerConfigs(cl runtimeclient.Client) func(context.Context, runtimeclient.Object) []reconcile.Request { | |
return func(ctx context.Context, obj runtimeclient.Object) []reconcile.Request { | |
if _, ok := obj.(*toolchainv1alpha1.ToolchainStatus); !ok { | |
return nil | |
} |
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
with TypedEnqueueRequestsFromMapFunc
on those calls and refactoring the code?
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: alexeykazakov, fbm3307, MatousJobanek, ranakan19, rsoaresd The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
@MatousJobanek thank you so much! https://issues.redhat.com/browse/SANDBOX-1022 |
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1146 +/- ##
=======================================
Coverage 79.68% 79.68%
=======================================
Files 82 82
Lines 8245 8245
=======================================
Hits 6570 6570
Misses 1479 1479
Partials 196 196
🚀 New features to boost your workflow:
|
Description
Update dependencies
Note
Operator SDK will be updated in the next set of PRs along with toolchain-cicd and operators update
Issue ticket number and link
SANDBOX-808
Note
snyk reports a lot of vulnerabilities regarding go 1.22. From snyk's source, it seems all FPs. For more info, check this Slack thread