mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-29 14:37:00 +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)
|
ignorePreflightErrorsSet, err := validation.ValidateIgnorePreflightErrors(ignorePreflightErrors)
|
||||||
kubeadmutil.CheckErr(err)
|
kubeadmutil.CheckErr(err)
|
||||||
|
|
||||||
if _, err := os.Stat(kubeConfigFile); !os.IsNotExist(err) {
|
var cfg *kubeadmapi.InitConfiguration
|
||||||
client, err = getClientset(kubeConfigFile, false)
|
client, err = getClientset(kubeConfigFile, false)
|
||||||
kubeadmutil.CheckErr(err)
|
if err == nil {
|
||||||
klog.V(1).Infof("[reset] loaded client set from kubeconfig file: %s", kubeConfigFile)
|
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 {
|
} else {
|
||||||
klog.V(1).Infof("[reset] could not get client set from missing kubeconfig file: %s", kubeConfigFile)
|
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 == "" {
|
if criSocketPath == "" {
|
||||||
criSocketPath, err = resetDetectCRISocket(cfg)
|
criSocketPath, err = resetDetectCRISocket(cfg)
|
||||||
kubeadmutil.CheckErr(err)
|
kubeadmutil.CheckErr(err)
|
||||||
|
Loading…
Reference in New Issue
Block a user