mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-30 15:05:27 +00:00
kubeadm: avoid CRI detection for phase subcommand when it's --cri-socket flag is not set
This commit is contained in:
parent
6b9035513b
commit
2501a46b80
@ -150,6 +150,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
|
||||
|
@ -221,6 +221,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