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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃悰 Fix panic for lazy dynamicRESTMapper #1891

Conversation

FillZpp
Copy link
Contributor

@FillZpp FillZpp commented May 9, 2022

Signed-off-by: FillZpp FillZpp.pub@gmail.com

Fix panic for lazy dynamicRESTMapper to make setStaticMapper successfully once, which means if dynamicRESTMapper fails to setStaticMapper, it will do it once again in next init.

fixes #1712

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label May 9, 2022
@k8s-ci-robot k8s-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label May 9, 2022
@FillZpp
Copy link
Contributor Author

FillZpp commented May 9, 2022

/cc @alvaroaleman @siliconbrain

@k8s-ci-robot
Copy link
Contributor

@FillZpp: GitHub didn't allow me to request PR reviews from the following users: siliconbrain.

Note that only kubernetes-sigs members and repo collaborators can review this PR, and authors cannot review their own PRs.

In response to this:

/cc @alvaroaleman @siliconbrain

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.

Copy link
Contributor

@siliconbrain siliconbrain left a comment

Choose a reason for hiding this comment

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

lgtm, thanks @FillZpp!

var failedOnce bool
mockErr := fmt.Errorf("mock failed once")
mapper, err = NewDynamicRESTMapper(cfg, WithLazyDiscovery, WithCustomMapper(func() (meta.RESTMapper, error) {
// Make newMapper failed once
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// Make newMapper failed once
// Make newMapper fail once

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done, thanks.

@k8s-ci-robot
Copy link
Contributor

@siliconbrain: changing LGTM is restricted to collaborators

In response to this:

lgtm, thanks @FillZpp!

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.

Signed-off-by: FillZpp <FillZpp.pub@gmail.com>
@FillZpp FillZpp force-pushed the fix-panic-for-lazy-dynamicRESTMapper branch from 8bdad41 to 04f281d Compare May 9, 2022 06:57
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: alvaroaleman, FillZpp, siliconbrain

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:

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 lgtm "Looks good to me", indicates that a PR is ready to be merged. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels May 9, 2022
@alvaroaleman
Copy link
Member

/retest-required

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/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Panic from dynamicRESTMapper when using lazy initialization
4 participants