cmdutil.go (kubernetes-1.18.14) | : | cmdutil.go (kubernetes-1.18.15) | ||
---|---|---|---|---|
skipping to change at line 26 | skipping to change at line 26 | |||
package util | package util | |||
import ( | import ( | |||
"github.com/pkg/errors" | "github.com/pkg/errors" | |||
"github.com/spf13/cobra" | "github.com/spf13/cobra" | |||
"github.com/spf13/pflag" | "github.com/spf13/pflag" | |||
"k8s.io/client-go/tools/clientcmd" | "k8s.io/client-go/tools/clientcmd" | |||
"k8s.io/klog" | "k8s.io/klog" | |||
kubeadmapiv1beta2 "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1beta2 " | ||||
"k8s.io/kubernetes/cmd/kubeadm/app/cmd/options" | "k8s.io/kubernetes/cmd/kubeadm/app/cmd/options" | |||
kubeadmconstants "k8s.io/kubernetes/cmd/kubeadm/app/constants" | kubeadmconstants "k8s.io/kubernetes/cmd/kubeadm/app/constants" | |||
) | ) | |||
// SubCmdRunE returns a function that handles a case where a subcommand must be specified | // SubCmdRunE returns a function that handles a case where a subcommand must be specified | |||
// Without this callback, if a user runs just the command without a subcommand, | // Without this callback, if a user runs just the command without a subcommand, | |||
// or with an invalid subcommand, cobra will print usage information, but still exit cleanly. | // or with an invalid subcommand, 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. | |||
func SubCmdRunE(name string) func(*cobra.Command, []string) error { | func SubCmdRunE(name string) func(*cobra.Command, []string) error { | |||
skipping to change at line 90 | skipping to change at line 91 | |||
return file | return file | |||
} | } | |||
// AddCRISocketFlag adds the cri-socket flag to the supplied flagSet | // AddCRISocketFlag adds the cri-socket flag to the supplied flagSet | |||
func AddCRISocketFlag(flagSet *pflag.FlagSet, criSocket *string) { | func AddCRISocketFlag(flagSet *pflag.FlagSet, criSocket *string) { | |||
flagSet.StringVar( | flagSet.StringVar( | |||
criSocket, options.NodeCRISocket, *criSocket, | criSocket, options.NodeCRISocket, *criSocket, | |||
"Path to the CRI socket to connect. If empty kubeadm will try to auto-detect this value; use this option only if you have more than one CRI insta lled or if you have non-standard CRI socket.", | "Path to the CRI socket to connect. If empty kubeadm will try to auto-detect this value; use this option only if you have more than one CRI insta lled or if you have non-standard CRI socket.", | |||
) | ) | |||
} | } | |||
// DefaultInitConfiguration return default InitConfiguration. Avoid running the | ||||
CRI auto-detection | ||||
// code as we don't need it. | ||||
func DefaultInitConfiguration() *kubeadmapiv1beta2.InitConfiguration { | ||||
initCfg := &kubeadmapiv1beta2.InitConfiguration{ | ||||
NodeRegistration: kubeadmapiv1beta2.NodeRegistrationOptions{ | ||||
CRISocket: kubeadmconstants.UnknownCRISocket, // avoid CR | ||||
I detection | ||||
}, | ||||
} | ||||
return initCfg | ||||
} | ||||
End of changes. 2 change blocks. | ||||
0 lines changed or deleted | 1 lines changed or added |