token.go (kubernetes-1.18.14) | : | token.go (kubernetes-1.18.15) | ||
---|---|---|---|---|
skipping to change at line 95 | skipping to change at line 95 | |||
// cobra will print usage information, but still exit cleanly. | // cobra will print usage information, but still exit cleanly. | |||
// We want to return an error code in these cases so that the | // We want to return an error code in these cases so that the | |||
// user knows that their command was invalid. | // user knows that their command was invalid. | |||
RunE: cmdutil.SubCmdRunE("token"), | RunE: cmdutil.SubCmdRunE("token"), | |||
} | } | |||
options.AddKubeConfigFlag(tokenCmd.PersistentFlags(), &kubeConfigFile) | options.AddKubeConfigFlag(tokenCmd.PersistentFlags(), &kubeConfigFile) | |||
tokenCmd.PersistentFlags().BoolVar(&dryRun, | tokenCmd.PersistentFlags().BoolVar(&dryRun, | |||
options.DryRun, dryRun, "Whether to enable dry-run mode or not") | options.DryRun, dryRun, "Whether to enable dry-run mode or not") | |||
cfg := &kubeadmapiv1beta2.InitConfiguration{} | cfg := cmdutil.DefaultInitConfiguration() | |||
// Default values for the cobra help text | // Default values for the cobra help text | |||
kubeadmscheme.Scheme.Default(cfg) | kubeadmscheme.Scheme.Default(cfg) | |||
var cfgPath string | var cfgPath string | |||
var printJoinCommand bool | var printJoinCommand bool | |||
var certificateKey string | var certificateKey string | |||
bto := options.NewBootstrapTokenOptions() | bto := options.NewBootstrapTokenOptions() | |||
createCmd := &cobra.Command{ | createCmd := &cobra.Command{ | |||
skipping to change at line 245 | skipping to change at line 245 | |||
clusterCfg := &kubeadmapiv1beta2.ClusterConfiguration{ | clusterCfg := &kubeadmapiv1beta2.ClusterConfiguration{ | |||
// KubernetesVersion is not used, but we set this explicitly to a void | // KubernetesVersion is not used, but we set this explicitly to a void | |||
// the lookup of the version from the internet when executing Loa dOrDefaultInitConfiguration | // the lookup of the version from the internet when executing Loa dOrDefaultInitConfiguration | |||
KubernetesVersion: kubeadmconstants.CurrentKubernetesVersion.Stri ng(), | KubernetesVersion: kubeadmconstants.CurrentKubernetesVersion.Stri ng(), | |||
} | } | |||
kubeadmscheme.Scheme.Default(clusterCfg) | kubeadmscheme.Scheme.Default(clusterCfg) | |||
// This call returns the ready-to-use configuration based on the configur ation file that might or might not exist and the default cfg populated by flags | // This call returns the ready-to-use configuration based on the configur ation file that might or might not exist and the default cfg populated by flags | |||
klog.V(1).Infoln("[token] loading configurations") | klog.V(1).Infoln("[token] loading configurations") | |||
// In fact, we don't do any CRI ops at all. | ||||
// This is just to force skipping the CRI detection. | ||||
// Ref: https://github.com/kubernetes/kubeadm/issues/1559 | ||||
initCfg.NodeRegistration.CRISocket = kubeadmconstants.DefaultDockerCRISoc | ||||
ket | ||||
internalcfg, err := configutil.LoadOrDefaultInitConfiguration(cfgPath, in itCfg, clusterCfg) | internalcfg, err := configutil.LoadOrDefaultInitConfiguration(cfgPath, in itCfg, clusterCfg) | |||
if err != nil { | if err != nil { | |||
return err | return err | |||
} | } | |||
klog.V(1).Infoln("[token] creating token") | klog.V(1).Infoln("[token] creating token") | |||
if err := tokenphase.CreateNewTokens(client, internalcfg.BootstrapTokens) ; err != nil { | if err := tokenphase.CreateNewTokens(client, internalcfg.BootstrapTokens) ; err != nil { | |||
return err | return err | |||
} | } | |||
End of changes. 2 change blocks. | ||||
7 lines changed or deleted | 1 lines changed or added |