mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-24 20:24:09 +00:00
Merge pull request #74869 from neolit123/fix-reset-fetch
kubeadm-reset: fetch init config only if client is non-nil
This commit is contained in:
commit
3b4a9e4e71
@ -63,19 +63,18 @@ func NewCmdReset(in io.Reader, out io.Writer) *cobra.Command {
|
||||
ignorePreflightErrorsSet, err := validation.ValidateIgnorePreflightErrors(ignorePreflightErrors)
|
||||
kubeadmutil.CheckErr(err)
|
||||
|
||||
if _, err := os.Stat(kubeConfigFile); !os.IsNotExist(err) {
|
||||
client, err = getClientset(kubeConfigFile, false)
|
||||
kubeadmutil.CheckErr(err)
|
||||
var cfg *kubeadmapi.InitConfiguration
|
||||
client, err = getClientset(kubeConfigFile, false)
|
||||
if err == nil {
|
||||
klog.V(1).Infof("[reset] loaded client set from kubeconfig file: %s", kubeConfigFile)
|
||||
cfg, err = configutil.FetchInitConfigurationFromCluster(client, os.Stdout, "reset", false)
|
||||
if err != nil {
|
||||
klog.Warningf("[reset] Unable to fetch the kubeadm-config ConfigMap from cluster: %v", err)
|
||||
}
|
||||
} else {
|
||||
klog.V(1).Infof("[reset] could not get client set from missing kubeconfig file: %s", kubeConfigFile)
|
||||
}
|
||||
|
||||
cfg, err := configutil.FetchInitConfigurationFromCluster(client, os.Stdout, "reset", false)
|
||||
if err != nil {
|
||||
klog.Warningf("[reset] Unable to fetch the kubeadm-config ConfigMap from cluster: %v", err)
|
||||
}
|
||||
|
||||
if criSocketPath == "" {
|
||||
criSocketPath, err = resetDetectCRISocket(cfg)
|
||||
kubeadmutil.CheckErr(err)
|
||||
|
Loading…
Reference in New Issue
Block a user