Skip to content

Fix partial meta request determination logic #1322

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

Merged
merged 2 commits into from
Jun 21, 2022

Conversation

ncdc
Copy link
Member

@ncdc ncdc commented Jun 21, 2022

Summary

The accept header can have multiple clauses, but we were only supporting
one. The Kubernetes metadataSharedInformerFactory generates requests
with the accept header having multiple clauses, and our previous logic
didn't handle them correctly, leading to thinking the request was not
for partial metadata, when in fact it was supposed to be.

Related issue(s)

Discovered while working on #1061

The accept header can have multiple clauses, but we were only supporting
one. The Kubernetes metadataSharedInformerFactory generates requests
with the accept header having multiple clauses, and our previous logic
didn't handle them correctly, leading to thinking the request was not
for partial metadata, when in fact it was supposed to be.

Signed-off-by: Andy Goldstein <[email protected]>
@openshift-ci openshift-ci bot requested review from stevekuznetsov and sttts June 21, 2022 14:54
@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 21, 2022
@sttts
Copy link
Member

sttts commented Jun 21, 2022

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Jun 21, 2022
@ncdc ncdc added this to the v0.6.0 milestone Jun 21, 2022
@ncdc
Copy link
Member Author

ncdc commented Jun 21, 2022

/retest

@ncdc
Copy link
Member Author

ncdc commented Jun 21, 2022

e2e-shared-server failure is #1324

@ncdc
Copy link
Member Author

ncdc commented Jun 21, 2022

Hit #1324 again

@ncdc
Copy link
Member Author

ncdc commented Jun 21, 2022

/hold

@openshift-ci openshift-ci bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jun 21, 2022
@ncdc
Copy link
Member Author

ncdc commented Jun 21, 2022

This PR introduces a weird bug with APIBinding deletion & finalizers on CRs.

@openshift-ci openshift-ci bot removed the lgtm Indicates that a PR is ready to be merged. label Jun 21, 2022
@ncdc
Copy link
Member Author

ncdc commented Jun 21, 2022

/unhold

@openshift-ci openshift-ci bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jun 21, 2022
@ncdc
Copy link
Member Author

ncdc commented Jun 21, 2022

@stevekuznetsov ready for another review

Fixing isPartialMetadataRequest led to the discovery of a bug in the
apiBindingAwareCRDLister's Get() method. The apibinding deletor uses the
partial metadata client to list resources to check for remaining data
(i.e. CRs with finalizers). Without the fix to
isPartialMetadataRequest, the metadata client was sending an Accept
header that led us to say it was *not* a partial metadata request. As
such, the apiBindingAwareCRDLister would proceed to getForFullData when
looking up a CRD, meaning it would find a CRD via an APIBinding, which
is what we want in this case.

With the fix, however, now the deletor's metadata client requests are
correctly interpreted as partial metadata requests. The
apiBindingAwareCRDLister's logic was finding the first CRD matching the
group and resource, which is less and less likely to find the correct
CRD as the number of workspaces, bindings, and CRDs grows.

The solution is to update the special handling of partial metadata
requests when trying to get the correct CRD. We want to handle
the following cases (in order of priority):

1. System CRD
2. CRD via identity (which could be for a specific cluster, or wildcard
- doesn't matter)
3. Wildcard
  a. For partial metadata
  b. Non partial metadata
4. In a specific cluster - check APIBindings first, then local CRDs

Signed-off-by: Andy Goldstein <[email protected]>
@ncdc ncdc force-pushed the fix-partial-metadata-check branch from b9374b4 to 28d0d2b Compare June 21, 2022 21:11
@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Jun 21, 2022
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jun 21, 2022

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ncdc, stevekuznetsov

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:
  • OWNERS [ncdc,stevekuznetsov]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot merged commit ba43524 into kcp-dev:main Jun 21, 2022
@ncdc ncdc deleted the fix-partial-metadata-check branch July 29, 2022 14:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants