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

@odinuge odinuge 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.
@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. kind/bug Categorizes issue or PR as related to a bug. sig/cluster-lifecycle Categorizes an issue or PR as relevant to SIG Cluster Lifecycle. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels Jul 26, 2019
@@ -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)
Copy link
Member Author

Choose a reason for hiding this comment

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

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
Copy link
Member Author

odinuge commented Jul 26, 2019

/cc neolit123

@k8s-ci-robot k8s-ci-robot requested a review from neolit123 July 26, 2019 17:03
@odinuge
Copy link
Member Author

odinuge commented Jul 26, 2019

/retest

1 similar comment
@odinuge
Copy link
Member Author

odinuge commented Jul 26, 2019

/retest

Copy link
Member

@neolit123 neolit123 left a comment

Choose a reason for hiding this comment

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

/lgtm
/approve
/priority backlog

@k8s-ci-robot k8s-ci-robot added priority/backlog Higher priority than priority/awaiting-more-evidence. lgtm "Looks good to me", indicates that a PR is ready to be merged. and removed needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels Jul 26, 2019
@neolit123
Copy link
Member

thanks @odinuge

@k8s-ci-robot
Copy link
Contributor

[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 added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 26, 2019
@k8s-ci-robot k8s-ci-robot merged commit 9bae1bc into kubernetes:master Jul 27, 2019
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. area/kubeadm cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/bug Categorizes issue or PR as related to a bug. lgtm "Looks good to me", indicates that a PR is ready to be merged. priority/backlog Higher priority than priority/awaiting-more-evidence. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/cluster-lifecycle Categorizes an issue or PR as relevant to SIG Cluster Lifecycle. 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