Skip to content

🐛 Allow lazy restmapper to work with CRDs created at runtime - #2208

Merged
k8s-ci-robot merged 1 commit into
kubernetes-sigs:mainfrom
Fedosin:lazyrestmapper_runtime
Mar 1, 2023
Merged

k8s-ci-robot merged 1 commit into
kubernetes-sigs:mainfrom
Fedosin:lazyrestmapper_runtime

Conversation

@Fedosin

@Fedosin Fedosin commented Feb 22, 2023

Copy link
Copy Markdown
Contributor

Now lazy restmapper fetches all API resources once at start and then caches them. It prevents it from discovery of new CRDs created after the controller has started.
This PR allows lazy restmapper to work with such CRDs.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Feb 22, 2023
@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Feb 22, 2023
@alvaroaleman alvaroaleman changed the title 🐛 Allow lazy restmapper to work with CRDs created in runtime 🐛 Allow lazy restmapper to work with CRDs created at runtime Feb 22, 2023
Comment thread pkg/client/apiutil/lazyrestmapper_test.go Outdated

m.apiGroups = apiGroups
// It will make 2 API calls to /api and /apis respectively.
apiGroups, err := m.client.ServerGroups()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Shouldn't we cache this and only re-fetch if the cached serverGroups don't have the requested groupName?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I returned caching here again. Now we just update it when nothing was found.

@Fedosin
Fedosin force-pushed the lazyrestmapper_runtime branch from 1dbd5e9 to 5941f84 Compare February 22, 2023 21:00
Comment thread pkg/client/apiutil/lazyrestmapper.go Outdated
Comment thread pkg/client/apiutil/lazyrestmapper.go Outdated
Now lazy restmapper fetches all API resources once at start and then
caches them. It prevents it from discovery of new CRDs created after
the controller has started.
This commit allows lazy restmapper to work with such CRDs.
@Fedosin
Fedosin force-pushed the lazyrestmapper_runtime branch from 5941f84 to e95db6c Compare February 24, 2023 14:48
@Fedosin

Fedosin commented Feb 25, 2023

Copy link
Copy Markdown
Contributor Author

/test pull-controller-runtime-test

1 similar comment
@Fedosin

Fedosin commented Feb 26, 2023

Copy link
Copy Markdown
Contributor Author

/test pull-controller-runtime-test

@vincepri

vincepri commented Mar 1, 2023

Copy link
Copy Markdown
Member

/lgtm
/assign @sbueringer

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Mar 1, 2023
@vincepri

vincepri commented Mar 1, 2023

Copy link
Copy Markdown
Member

/cherry-pick release-0.14

@k8s-infra-cherrypick-robot

Copy link
Copy Markdown

@vincepri: once the present PR merges, I will cherry-pick it on top of release-0.14 in a new PR and assign it to you.

Details

In response to this:

/cherry-pick release-0.14

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@sbueringer

Copy link
Copy Markdown
Member

Thx for the fix!

/approve

@k8s-ci-robot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Fedosin, sbueringer

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

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

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 1, 2023
@k8s-ci-robot
k8s-ci-robot merged commit e2d8821 into kubernetes-sigs:main Mar 1, 2023
@k8s-infra-cherrypick-robot

Copy link
Copy Markdown

@vincepri: #2208 failed to apply on top of branch "release-0.14":

Applying: Allow lazy restmapper to work with CRDs created in runtime
Using index info to reconstruct a base tree...
M	pkg/client/apiutil/lazyrestmapper_test.go
Falling back to patching base and 3-way merge...
Auto-merging pkg/client/apiutil/lazyrestmapper_test.go
CONFLICT (content): Merge conflict in pkg/client/apiutil/lazyrestmapper_test.go
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0001 Allow lazy restmapper to work with CRDs created in runtime
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".

Details

In response to this:

/cherry-pick release-0.14

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

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. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants