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:
Odin Ugedal
2019-07-26 18:51:29 +02:00
parent ee84c95bdb
commit 2522e782dd

View File

@@ -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)
}