mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-21 10:51:29 +00:00
Merge pull request #114455 from SataQiu/fix-kubeadm-2022121302
kubeadm: fix the bug that kubeadm always do CRI detection even if it is not required by phase subcommand
This commit is contained in:
commit
03bfbdd8aa
@ -149,6 +149,11 @@ func newCmdInit(out io.Writer, initOptions *initOptions) *cobra.Command {
|
||||
// sets the data builder function, that will be used by the runner
|
||||
// both when running the entire workflow or single phases
|
||||
initRunner.SetDataInitializer(func(cmd *cobra.Command, args []string) (workflow.RunData, error) {
|
||||
if cmd.Flags().Lookup(options.NodeCRISocket) == nil {
|
||||
// avoid CRI detection
|
||||
// assume that the command execution does not depend on CRISocket when --cri-socket flag is not set
|
||||
initOptions.externalInitCfg.NodeRegistration.CRISocket = kubeadmconstants.UnknownCRISocket
|
||||
}
|
||||
data, err := newInitData(cmd, args, initOptions, out)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -220,6 +220,11 @@ func newCmdJoin(out io.Writer, joinOptions *joinOptions) *cobra.Command {
|
||||
// sets the data builder function, that will be used by the runner
|
||||
// both when running the entire workflow or single phases
|
||||
joinRunner.SetDataInitializer(func(cmd *cobra.Command, args []string) (workflow.RunData, error) {
|
||||
if cmd.Flags().Lookup(options.NodeCRISocket) == nil {
|
||||
// avoid CRI detection
|
||||
// assume that the command execution does not depend on CRISocket when --cri-socket flag is not set
|
||||
joinOptions.externalcfg.NodeRegistration.CRISocket = kubeadmconstants.UnknownCRISocket
|
||||
}
|
||||
data, err := newJoinData(cmd, args, joinOptions, out, kubeadmconstants.GetAdminKubeConfigPath())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -46,6 +46,7 @@ func NewPreflightPhase() workflow.Phase {
|
||||
Run: runPreflight,
|
||||
InheritFlags: []string{
|
||||
options.CfgPath,
|
||||
options.NodeCRISocket,
|
||||
options.IgnorePreflightErrors,
|
||||
options.DryRun,
|
||||
},
|
||||
|
@ -36,7 +36,6 @@ func NewUploadCertsPhase() workflow.Phase {
|
||||
Run: runUploadCerts,
|
||||
InheritFlags: []string{
|
||||
options.CfgPath,
|
||||
options.NodeCRISocket,
|
||||
options.KubeconfigPath,
|
||||
options.UploadCerts,
|
||||
options.CertificateKey,
|
||||
|
@ -96,6 +96,7 @@ func NewUploadConfigPhase() workflow.Phase {
|
||||
func getUploadConfigPhaseFlags() []string {
|
||||
return []string{
|
||||
options.CfgPath,
|
||||
options.NodeCRISocket,
|
||||
options.KubeconfigPath,
|
||||
options.DryRun,
|
||||
}
|
||||
|
@ -203,6 +203,11 @@ func newCmdReset(in io.Reader, out io.Writer, resetOptions *resetOptions) *cobra
|
||||
// sets the data builder function, that will be used by the runner
|
||||
// both when running the entire workflow or single phases
|
||||
resetRunner.SetDataInitializer(func(cmd *cobra.Command, args []string) (workflow.RunData, error) {
|
||||
if cmd.Flags().Lookup(options.NodeCRISocket) == nil {
|
||||
// avoid CRI detection
|
||||
// assume that the command execution does not depend on CRISocket when --cri-socket flag is not set
|
||||
resetOptions.criSocketPath = kubeadmconstants.UnknownCRISocket
|
||||
}
|
||||
return newResetData(cmd, resetOptions, in, out)
|
||||
})
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user