mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-31 16:46:54 +00:00
Fix error handling issue in kubeadm upgrade
The error was unintentionally set inside the scope of the if statement, hiding possible errors.
This commit is contained in:
@@ -25,6 +25,7 @@ import (
|
||||
"github.com/spf13/cobra"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
"k8s.io/apimachinery/pkg/util/version"
|
||||
client "k8s.io/client-go/kubernetes"
|
||||
"k8s.io/klog"
|
||||
kubeadmapi "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm"
|
||||
"k8s.io/kubernetes/cmd/kubeadm/app/cmd/options"
|
||||
@@ -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)
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, "couldn't create a Kubernetes client from file %q", flags.kubeConfigPath)
|
||||
}
|
||||
|
Reference in New Issue
Block a user