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

fix: add type meta when saving them to cache and reference indexer #4663

Merged
merged 4 commits into from
Sep 13, 2023

Conversation

randmonkey
Copy link
Contributor

@randmonkey randmonkey commented Sep 13, 2023

What this PR does / why we need it:

The PR sets type meta for objects when adding them to cache stores and reference indexers, and fetching objects referred by when the object gets deleted. This PR is added because cache indexers to store reference relations needs object kind(GVK) for indexing, and this comes from TypeMeta of the k8s resource.
If we do not set the TypeMeta, the object kind of objects are always empty so we could not find them correctly in reference indexers.
It also adds logs when setting or deleting reference relations between objects.
Which issue this PR fixes:

fixes #3201

Special notes for your reviewer:

PR Readiness Checklist:

Complete these before marking the PR as ready to review:

  • the CHANGELOG.md release notes have been updated to reflect any significant (and particularly user-facing) changes introduced by this PR

@randmonkey randmonkey requested a review from a team as a code owner September 13, 2023 16:02
@codecov
Copy link

codecov bot commented Sep 13, 2023

Codecov Report

Patch coverage: 59.7% and project coverage change: +0.1% 🎉

Comparison is base (832a7aa) 67.8% compared to head (e4637f3) 67.9%.
Report is 4 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##            main   #4663     +/-   ##
=======================================
+ Coverage   67.8%   67.9%   +0.1%     
=======================================
  Files        164     164             
  Lines      19130   19281    +151     
=======================================
+ Hits       12972   13095    +123     
- Misses      5388    5418     +30     
+ Partials     770     768      -2     
Files Changed Coverage Δ
internal/admission/utils.go 0.0% <ø> (ø)
...ion/validation/consumers/credentials/validation.go 32.9% <ø> (ø)
internal/admission/validation/gateway/httproute.go 70.0% <ø> (ø)
internal/admission/validation/ingress/ingress.go 0.0% <ø> (ø)
internal/admission/validator.go 37.9% <0.0%> (ø)
internal/dataplane/kongstate/kongstate.go 73.7% <ø> (ø)
internal/controllers/reference/reference.go 50.5% <44.4%> (+17.2%) ⬆️
...trollers/configuration/zz_generated_controllers.go 34.6% <50.0%> (+1.0%) ⬆️
internal/store/store.go 61.8% <56.4%> (+<0.1%) ⬆️
internal/controllers/gateway/gateway_controller.go 57.3% <100.0%> (+1.4%) ⬆️
... and 4 more

... and 4 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@randmonkey randmonkey added the bug Something isn't working label Sep 13, 2023
@randmonkey randmonkey added this to the KIC v2.12.0 milestone Sep 13, 2023
@randmonkey randmonkey added the area/maintenance Cleanup, refactoring, and other maintenance improvements that don't change functionality. label Sep 13, 2023
@randmonkey randmonkey self-assigned this Sep 13, 2023
Copy link
Contributor

@rainest rainest left a comment

Choose a reason for hiding this comment

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

referrer and referent are hard to distinguish in logs on a quick glance, but whatever.

For posterity, there's a workaround for this problem that doesn't require specifying the type in the template, but no obvious reason to use it over the template values at this point.

@rainest rainest merged commit 663ed21 into main Sep 13, 2023
49 checks passed
@rainest rainest deleted the fix/add_type_meta branch September 13, 2023 20:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/maintenance Cleanup, refactoring, and other maintenance improvements that don't change functionality. bug Something isn't working size/L
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Emit debug controller logs when (un)subscribing to referenced Secrets
2 participants