Skip to content
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

Sotw add limitador reconcile #887

Merged
merged 3 commits into from
Oct 11, 2024

Conversation

Boomatang
Copy link
Contributor

Introduces the reconcile function for the limitador resource.

@Boomatang Boomatang self-assigned this Sep 30, 2024
@Boomatang Boomatang force-pushed the sotw/ADD/limitador/reconcile branch 2 times, most recently from 5a0e969 to bbe6229 Compare October 7, 2024 10:53
@KevFan
Copy link
Contributor

KevFan commented Oct 8, 2024

Since #909 got merged to add placeholders, do we want to add this change to https://github.com/Kuadrant/kuadrant-operator/blob/main/controllers/limitador_reconciler.go instead? Although this would mean that the reconcile code will be added to the workflow and the scope of this PR will be expanded to remove the logic in the kuadrant controller 🤔

@Boomatang
Copy link
Contributor Author

@KevFan Yes, I can do that bit of the rename. The point about the removing the logic from the kuadrant controller being part of this PR is not need. There is no updating of the resources only creating. If both methods are in place, one will get the update first while the other will get a version out of date error. Which they both can handle. The PR for removing the work is already opened, #888. Once this would be merged that can be merged, (would require a rebase to pass test)

This sets up the subscription for events on kuadrant and limitador
resources. The reconcile only is preformed if the limitador resource
does not exist.

Signed-off-by: Jim Fitzpatrick <[email protected]>
Signed-off-by: Jim Fitzpatrick <[email protected]>
@Boomatang Boomatang force-pushed the sotw/ADD/limitador/reconcile branch from bbe6229 to 366be33 Compare October 9, 2024 16:00
Comment on lines 61 to 71
aobjs := lo.FilterMap(topology.Objects().Objects().Items(), func(item machinery.Object, _ int) (machinery.Object, bool) {
if item.GroupVersionKind().Kind == v1beta1.LimitadorGroupKind.Kind {
return item, true
}
return nil, false
})

if len(aobjs) > 0 {
logger.Info("limitador resource already exists, no need to create", "status", "skipping")
return nil
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: aobjs being authorino objects? So this should be lobjs instead? 🤔

Suggested change
aobjs := lo.FilterMap(topology.Objects().Objects().Items(), func(item machinery.Object, _ int) (machinery.Object, bool) {
if item.GroupVersionKind().Kind == v1beta1.LimitadorGroupKind.Kind {
return item, true
}
return nil, false
})
if len(aobjs) > 0 {
logger.Info("limitador resource already exists, no need to create", "status", "skipping")
return nil
}
lobjs := lo.FilterMap(topology.Objects().Objects().Items(), func(item machinery.Object, _ int) (machinery.Object, bool) {
if item.GroupVersionKind().Kind == v1beta1.LimitadorGroupKind.Kind {
return item, true
}
return nil, false
})
if len(lobjs) > 0 {
logger.Info("limitador resource already exists, no need to create", "status", "skipping")
return nil
}

Signed-off-by: Jim Fitzpatrick <[email protected]>
@Boomatang Boomatang merged commit c0438c3 into Kuadrant:main Oct 11, 2024
24 checks passed
@Boomatang Boomatang deleted the sotw/ADD/limitador/reconcile branch October 11, 2024 11:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants