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

refactor: api machinary #396

Merged
merged 14 commits into from
Feb 28, 2024
Merged

refactor: api machinary #396

merged 14 commits into from
Feb 28, 2024

Conversation

KevFan
Copy link
Contributor

@KevFan KevFan commented Jan 17, 2024

Part of #203

This is a general refactoring to enable the relocation of common and useful functions to https://github.com/Kuadrant/gateway-api-machinery/tree/main. It also takes into account the generic interfaces suggested by the current state of https://github.com/Kuadrant/gateway-api-machinery.

The primary objective of this pull request is to consolidate all functionalities into a single library package within the Kuadrant Operator. Eventually, we plan to move the entire contents of this package to the gateway-api-machinery repository, replacing the usage of this package with the gateway-api-machinery library, as the current implementation is outdated.

Currently, this pull request may not be the ideal refactoring, as several functions were refactored into this library package to address issues such as cyclic imports. However, this PR is likely to be the first of many refactors as we determine what should truly exist in the gateway-api-machinery library versus the Kuadrant Operator."

@KevFan KevFan added kind/enhancement New feature or request size/large labels Jan 17, 2024
@KevFan KevFan self-assigned this Jan 17, 2024
Copy link

codecov bot commented Jan 17, 2024

Codecov Report

Merging #396 (b011707) into main (93d2265) will decrease coverage by 1.42%.
The diff coverage is 88.88%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #396      +/-   ##
==========================================
- Coverage   81.78%   80.36%   -1.42%     
==========================================
  Files          54       64      +10     
  Lines        4452     4492      +40     
==========================================
- Hits         3641     3610      -31     
- Misses        537      593      +56     
- Partials      274      289      +15     
Flag Coverage Δ
integration 71.46% <81.94%> (-1.90%) ⬇️
unit 30.03% <48.05%> (+1.27%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
api/v1beta1 (u) 71.42% <100.00%> (ø)
api/v1beta2 (u) 91.42% <100.00%> (+0.51%) ⬆️
pkg/common (u) 88.82% <100.00%> (-1.06%) ⬇️
pkg/istio (u) 73.91% <ø> (-1.25%) ⬇️
pkg/log (u) 94.73% <ø> (ø)
pkg/reconcilers (u) 64.04% <ø> (-16.95%) ⬇️
pkg/rlptools (u) 79.45% <100.00%> (ø)
controllers (i) 77.08% <90.24%> (-2.18%) ⬇️
Files Coverage Δ
api/v1alpha1/dnspolicy_types.go 81.81% <100.00%> (+0.76%) ⬆️
api/v1alpha1/tlspolicy_types.go 74.35% <100.00%> (+2.93%) ⬆️
api/v1beta1/kuadrant_types.go 71.42% <100.00%> (ø)
api/v1beta2/authpolicy_types.go 90.47% <100.00%> (+0.64%) ⬆️
api/v1beta2/ratelimitpolicy_types.go 89.09% <100.00%> (+0.85%) ⬆️
api/v1beta2/route_selectors.go 100.00% <100.00%> (ø)
controllers/authpolicy_authconfig.go 85.06% <100.00%> (ø)
...ontrollers/authpolicy_istio_authorizationpolicy.go 87.31% <100.00%> (ø)
controllers/dns_helper.go 84.53% <100.00%> (ø)
controllers/dnshealthcheckprobe_eventmapper.go 68.18% <100.00%> (ø)
... and 40 more

... and 2 files with indirect coverage changes

@KevFan KevFan changed the title [WIP] refactor: api machainary [WIP] refactor: api machinary Jan 17, 2024
@KevFan KevFan marked this pull request as ready for review January 17, 2024 16:08
@KevFan KevFan requested a review from a team as a code owner January 17, 2024 16:08
@KevFan KevFan changed the title [WIP] refactor: api machinary refactor: api machinary Jan 17, 2024
@alexsnaps alexsnaps added this to the v0.7.0 milestone Jan 22, 2024
Copy link
Member

@adam-cattermole adam-cattermole left a comment

Choose a reason for hiding this comment

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

There's a lot of changes so would appreciate another review but I think this looks pretty good now, nice work!

Copy link
Contributor

@eguzki eguzki left a comment

Choose a reason for hiding this comment

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

I say we go with this 💯

Currently, this pull request may not be the ideal refactoring, as several functions were refactored into this library package to address issues such as cyclic imports. However, this PR is likely to be the first of many refactors as we determine what should truly exist in the gateway-api-machinery library versus the Kuadrant Operator."

I have the same feeling. And I do not think this PR adds more mess, on the contrary, I think that the packages have been organized in a neat way.

@eguzki
Copy link
Contributor

eguzki commented Feb 21, 2024

I also have to anticipate that with the WIP topology implementation approaches (at least 2 I am aware of), some references (back refs and direct back refs) between resources will vanish, making some code refactored here useless.

@guicassolato guicassolato mentioned this pull request Feb 26, 2024
42 tasks
@KevFan
Copy link
Contributor Author

KevFan commented Feb 28, 2024

Merging this as this has multiple approvals now and have been rebased from main with changes for DNSPolicy and TLSPolicy. All comments are addressed and tests are passing so I think this is safe to merge as is

@KevFan KevFan merged commit e51ddaf into Kuadrant:main Feb 28, 2024
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement New feature or request size/large
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

6 participants