mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-02 09:47:06 +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"
|
"github.com/spf13/cobra"
|
||||||
corev1 "k8s.io/api/core/v1"
|
corev1 "k8s.io/api/core/v1"
|
||||||
"k8s.io/apimachinery/pkg/util/version"
|
"k8s.io/apimachinery/pkg/util/version"
|
||||||
|
client "k8s.io/client-go/kubernetes"
|
||||||
"k8s.io/klog"
|
"k8s.io/klog"
|
||||||
kubeadmapi "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm"
|
kubeadmapi "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm"
|
||||||
"k8s.io/kubernetes/cmd/kubeadm/app/cmd/options"
|
"k8s.io/kubernetes/cmd/kubeadm/app/cmd/options"
|
||||||
@@ -86,7 +87,8 @@ func runDiff(flags *diffFlags, args []string) error {
|
|||||||
if flags.cfgPath != "" {
|
if flags.cfgPath != "" {
|
||||||
cfg, err = configutil.LoadInitConfigurationFromFile(flags.cfgPath)
|
cfg, err = configutil.LoadInitConfigurationFromFile(flags.cfgPath)
|
||||||
} else {
|
} else {
|
||||||
client, err := kubeconfigutil.ClientSetFromFile(flags.kubeConfigPath)
|
var client *client.Clientset
|
||||||
|
client, err = kubeconfigutil.ClientSetFromFile(flags.kubeConfigPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrapf(err, "couldn't create a Kubernetes client from file %q", flags.kubeConfigPath)
|
return errors.Wrapf(err, "couldn't create a Kubernetes client from file %q", flags.kubeConfigPath)
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user