-
Notifications
You must be signed in to change notification settings - Fork 40.1k
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
Fix error handling issue in kubeadm upgrade diff #80648
Conversation
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) |
There was a problem hiding this comment.
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
/cc neolit123 |
/retest |
1 similar comment
/retest |
There was a problem hiding this 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
thanks @odinuge |
[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 |
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?:
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: