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

feat: add FillID method for Service, Route and Consumer #299

Merged
merged 3 commits into from
Apr 24, 2023
Merged

Conversation

czeslavo
Copy link
Contributor

@czeslavo czeslavo commented Mar 23, 2023

Adds FillID methods for Service, Route, and Consumer entities to allow setting deterministic IDs for entities based on their unique properties.

For now, it is only implemented for Service, Route and Consumer as that's what's needed on Kubernetes Ingress Controller side to generate stable IDs for analytics in Konnect.

Part of Kong/kubernetes-ingress-controller#3906.

@CLAassistant
Copy link

CLAassistant commented Mar 23, 2023

CLA assistant check
All committers have signed the CLA.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

kong/ids.go Outdated Show resolved Hide resolved
@codecov-commenter
Copy link

codecov-commenter commented Apr 3, 2023

Codecov Report

Patch coverage: 60.00% and project coverage change: +0.09 🎉

Comparison is base (be56889) 52.73% compared to head (85f81c5) 52.82%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #299      +/-   ##
==========================================
+ Coverage   52.73%   52.82%   +0.09%     
==========================================
  Files          68       69       +1     
  Lines        5012     5077      +65     
==========================================
+ Hits         2643     2682      +39     
- Misses       1798     1817      +19     
- Partials      571      578       +7     
Flag Coverage Δ
2.1.4 36.18% <60.00%> (+0.30%) ⬆️
2.2.1.3 46.70% <60.00%> (+0.17%) ⬆️
2.2.2 36.18% <60.00%> (+0.30%) ⬆️
2.3.3 36.34% <60.00%> (+0.30%) ⬆️
2.3.3.4 47.37% <60.00%> (+0.16%) ⬆️
2.4.1 36.41% <60.00%> (+0.30%) ⬆️
2.4.1.3 47.44% <60.00%> (+0.16%) ⬆️
2.5.1.2 47.44% <60.00%> (+0.16%) ⬆️
2.5.2 36.41% <60.00%> (+0.30%) ⬆️
2.6.1 36.41% <60.00%> (+0.30%) ⬆️
2.6.1.0 47.44% <60.00%> (+0.16%) ⬆️
2.7.2 36.41% <60.00%> (+0.30%) ⬆️
2.7.2.0 48.98% <60.00%> (+0.14%) ⬆️
2.8.3 36.41% <60.00%> (+0.30%) ⬆️
2.8.4.0 48.98% <60.00%> (+0.14%) ⬆️
3.0.2 35.86% <60.00%> (+0.31%) ⬆️
3.0.2.0 49.43% <60.00%> (+0.13%) ⬆️
3.1.1 37.36% <60.00%> (+0.29%) ⬆️
3.1.1.3 51.03% <60.00%> (+0.11%) ⬆️
3.2.2 37.42% <60.00%> (+0.29%) ⬆️
3.2.2.1 51.03% <60.00%> (+0.11%) ⬆️
community 37.97% <60.00%> (+0.28%) ⬆️
enterprise 51.58% <60.00%> (+0.10%) ⬆️
enterprise-nightly 51.03% <60.00%> (+0.11%) ⬆️
integration 52.82% <60.00%> (+0.09%) ⬆️
nightly 37.42% <60.00%> (+0.29%) ⬆️

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

Impacted Files Coverage Δ
kong/ids.go 60.00% <60.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

kong/ids.go Outdated Show resolved Hide resolved
@czeslavo
Copy link
Contributor Author

Looks like the integration tests are blocked by TestFillPluginDefaults failing consistently (not related to the code this PR introduces), #316 should fix it. Apart from that, it's ready for review.

@czeslavo czeslavo marked this pull request as ready for review April 19, 2023 16:59
@czeslavo czeslavo requested a review from a team as a code owner April 19, 2023 16:59
@czeslavo czeslavo requested review from mmorel-35 and a team and removed request for mmorel-35 April 19, 2023 16:59
@czeslavo czeslavo self-assigned this Apr 19, 2023
@czeslavo czeslavo added the enhancement New feature or request label Apr 19, 2023
@czeslavo czeslavo requested a review from mmorel-35 April 19, 2023 17:00
kong/ids.go Outdated Show resolved Hide resolved
kong/ids.go Outdated Show resolved Hide resolved
kong/ids.go Outdated Show resolved Hide resolved
kong/ids.go Outdated Show resolved Hide resolved
kong/ids_test.go Outdated Show resolved Hide resolved
kong/ids_test.go Outdated Show resolved Hide resolved
kong/ids.go Outdated Show resolved Hide resolved
kong/ids.go Outdated Show resolved Hide resolved
kong/ids.go Outdated Show resolved Hide resolved
kong/ids.go Outdated Show resolved Hide resolved
kong/ids.go Outdated Show resolved Hide resolved
@czeslavo czeslavo changed the title feat: add FillEntityID function feat: add FillID method for Service, Route and Consumer Apr 20, 2023
@czeslavo
Copy link
Contributor Author

@mmorel-35 I hope I addressed all your suggestions, PTAL.

@mmorel-35
Copy link
Contributor

mmorel-35 commented Apr 20, 2023

Would you also need to do it for plugins ?
In that case it the buildIDFor() could take as parameter the concatenation of the plugin name with the the ID of the referenced entity (Consumer, Route or Service) or just the name of the plugin when it's a global one.
I would personally add a character separator between the referenced ID and the plugin name but it might not be absolutely necessary

kong/ids_test.go Outdated Show resolved Hide resolved
@czeslavo
Copy link
Contributor Author

Would you also need to do it for plugins ? In that case it the buildIDFor() could take as parameter the concatenation of the plugin name with the the ID of the referenced entity (Consumer, Route or Service) or just the name of the plugin when it's a global one. I would personally add a character separator between the referenced ID and the plugin name but it might not be absolutely necessary

I'd rather leave it until it's going to be needed. As I mentioned in the description, we only need this function to work for Service, Route, and Consumer.

@czeslavo czeslavo requested a review from mmorel-35 April 21, 2023 09:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants