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 error handling issue in kubeadm upgrade diff #80648

Merged
merged 1 commit into from Jul 27, 2019

Conversation

@odinuge
Copy link
Member

commented Jul 26, 2019

What type of PR is this?
/kind bug

What this PR does / why we need it:

This fixes possible null pointer panic if an error is returned, but not checked. This was introduced in #80025, so the code is only in the master branch (and v1.16.0-alpha.1).

The error was unintentionally set inside the scope of the if statement,
hiding possible errors.

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:
/sig cluster-lifecycle

Does this PR introduce a user-facing change?:

Fix error handling and potential go null pointer exception in kubeadm upgrade diff

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


The error was unintentionally set inside the scope of the if statement,
hiding possible errors.
@@ -86,7 +87,8 @@ func runDiff(flags *diffFlags, args []string) error {
if flags.cfgPath != "" {
cfg, err = configutil.LoadInitConfigurationFromFile(flags.cfgPath)
} else {
client, err := kubeconfigutil.ClientSetFromFile(flags.kubeConfigPath)
var client *client.Clientset
client, err = kubeconfigutil.ClientSetFromFile(flags.kubeConfigPath)

This comment has been minimized.

Copy link
@odinuge

odinuge Jul 26, 2019

Author Member

For reference, this is not the error I am talking about (this is just where the new err is/was declared). The error not previously handled is the one on line 95 https://github.com/kubernetes/kubernetes/pull/80648/files#diff-a6dcbd409dc17bd39fbe918f4bf5ee5fR95

@odinuge

This comment has been minimized.

Copy link
Member Author

commented Jul 26, 2019

/cc neolit123

@k8s-ci-robot k8s-ci-robot requested a review from neolit123 Jul 26, 2019
@odinuge

This comment has been minimized.

Copy link
Member Author

commented Jul 26, 2019

/retest

1 similar comment
@odinuge

This comment has been minimized.

Copy link
Member Author

commented Jul 26, 2019

/retest

Copy link
Member

left a comment

/lgtm
/approve
/priority backlog

@neolit123

This comment has been minimized.

Copy link
Member

commented Jul 26, 2019

thanks @odinuge

@k8s-ci-robot

This comment has been minimized.

Copy link
Contributor

commented Jul 26, 2019

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: neolit123, odinuge

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 merged commit 9bae1bc into kubernetes:master Jul 27, 2019
23 checks passed
23 checks passed
cla/linuxfoundation odinuge authorized
Details
pull-kubernetes-bazel-build Job succeeded.
Details
pull-kubernetes-bazel-test Job succeeded.
Details
pull-kubernetes-conformance-image-test Skipped.
pull-kubernetes-cross Skipped.
pull-kubernetes-dependencies Job succeeded.
Details
pull-kubernetes-e2e-gce Job succeeded.
Details
pull-kubernetes-e2e-gce-100-performance Job succeeded.
Details
pull-kubernetes-e2e-gce-csi-serial Skipped.
pull-kubernetes-e2e-gce-device-plugin-gpu Job succeeded.
Details
pull-kubernetes-e2e-gce-iscsi Skipped.
pull-kubernetes-e2e-gce-iscsi-serial Skipped.
pull-kubernetes-e2e-gce-storage-slow Skipped.
pull-kubernetes-godeps Skipped.
pull-kubernetes-integration Job succeeded.
Details
pull-kubernetes-kubemark-e2e-gce-big Job succeeded.
Details
pull-kubernetes-local-e2e Skipped.
pull-kubernetes-node-e2e Job succeeded.
Details
pull-kubernetes-node-e2e-containerd Job succeeded.
Details
pull-kubernetes-typecheck Job succeeded.
Details
pull-kubernetes-verify Job succeeded.
Details
pull-publishing-bot-validate Skipped.
tide In merge pool.
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.