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

[Prepare for go1.20] vclib: Update the unwrap check for UnknownAuthorityError #114763

Closed

Conversation

MadhavJivrajani
Copy link
Contributor

@MadhavJivrajani MadhavJivrajani commented Jan 2, 2023

What type of PR is this?

/kind cleanup

What this PR does / why we need it:

This commit accounts for the introduction of CertificateVerificationError in go1.20 and how govmomi handles it.

This commit also gets rid of the check for the text of the x509.CertificateVerificationError error since we already check if the erorr is that type.

Which issue(s) this PR fixes:

Special notes for your reviewer:

To be merged only after Go has been bumped to 1.20

Does this PR introduce a user-facing change?

NONE

Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:


This commit accounts for the introduction of CertificateVerificationError
in go1.20 and how govmomi handles it.

This commit also gets rid of the check for the text of the
x509.CertificateVerificationError error since we already check
if the erorr is that type.

Signed-off-by: Madhav Jivrajani <madhav.jiv@gmail.com>
@k8s-ci-robot
Copy link
Contributor

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Jan 2, 2023
@k8s-ci-robot
Copy link
Contributor

@MadhavJivrajani: This issue is currently awaiting triage.

If a SIG or subproject determines this is a relevant issue, they will accept it by applying the triage/accepted label and provide further guidance.

The triage/accepted label can be added by org members by writing /triage accepted in a comment.

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.

@k8s-ci-robot k8s-ci-robot added the needs-priority Indicates a PR lacks a `priority/foo` label and requires one. label Jan 2, 2023
Comment on lines -194 to 197
if msg := x509Err.Error(); msg != "x509: certificate signed by unknown authority" {
t.Fatalf("Expected 'signed by unknown authority' error, got: '%s'", msg)
_, ok = verificationErr.Err.(x509.UnknownAuthorityError)
if !ok {
t.Fatalf("Expected to receive a wrapped x509.UnknownAuthorityError, got: '%s' (%#v)", verificationErr.Err.Error(), verificationErr.Err)
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This commit gets rid of the check for the text of the x509.CertificateVerificationError error since we already check if the erorr is that type.

Copy link
Member

Choose a reason for hiding this comment

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

this should be written in a way that works with both go1.20 and go1.19... would something along these lines work with both?

var x509Err x509.UnknownAuthorityError
if !errors.As(urlErr.Err, &x509Err) {
  fatal
}
...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh that's a great idea

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: MadhavJivrajani
Once this PR has been reviewed and has the lgtm label, please assign andrewsykim for approval by writing /assign @andrewsykim in a comment. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found 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 area/cloudprovider sig/cloud-provider Categorizes an issue or PR as relevant to SIG Cloud Provider. and removed do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Jan 2, 2023
@MadhavJivrajani MadhavJivrajani changed the title vclib: Update the unwrap check for UnknownAuthorityError [Prepare for go1.20] vclib: Update the unwrap check for UnknownAuthorityError Jan 2, 2023
@liggitt
Copy link
Member

liggitt commented Jan 2, 2023

xref kubernetes/release#2815

@MadhavJivrajani
Copy link
Contributor Author

/close
Incorporated changes here to unify PRs on account of #114763 (comment): ec223a4

@k8s-ci-robot
Copy link
Contributor

@MadhavJivrajani: Closed this PR.

In response to this:

/close
Incorporated changes here to unify PRs on account of #114763 (comment): ec223a4

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
area/cloudprovider cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. release-note-none Denotes a PR that doesn't merit a release note. sig/cloud-provider Categorizes an issue or PR as relevant to SIG Cloud Provider. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants