package util
import "k8s.io/kubernetes/cmd/kubeadm/app/cmd/util"
Index ¶
- Variables
- func AddCRISocketFlag(flagSet *pflag.FlagSet, criSocket *string)
- func Examples(s string) string
- func GetJoinControlPlaneCommand(kubeConfigFile, token, key string, skipTokenPrint, skipCertificateKeyPrint bool) (string, error)
- func GetJoinWorkerCommand(kubeConfigFile, token string, skipTokenPrint bool) (string, error)
- func GetKubeConfigPath(file string) string
- func InteractivelyConfirmAction(action, question string, r io.Reader) error
- func LongDesc(s string) string
- func RequireSubcommand(c *cobra.Command)
- func TypeMismatchErr(opt, rType string) error
- func ValidateExactArgNumber(args []string, supportedArgs []string) error
- func ValueFromFlagsOrConfig(flagSet *pflag.FlagSet, name string, cfgValue interface{}, flagValue interface{}) interface{}
Variables ¶
var ( // AlphaDisclaimer to be places at the end of description of commands in alpha release AlphaDisclaimer = ` Alpha Disclaimer: this command is currently alpha. ` )
ErrorSubcommandRequired is an error returned when a parent command cannot be executed. It starts with a new line so that it's separated from previous information like a Help() screen.
Functions ¶
func AddCRISocketFlag ¶
AddCRISocketFlag adds the cri-socket flag to the supplied flagSet
func Examples ¶
Examples is designed to help with producing examples for command line usage. Its behavior is mimicking a similar kubectl function in the following ways: - Beginning and trailing space characters (including empty lines), are stripped from the output. - All lines of text are stripped of beginning and trailing spaces (thus loosing indentation) and are then double-space indented.
func GetJoinControlPlaneCommand ¶
func GetJoinControlPlaneCommand(kubeConfigFile, token, key string, skipTokenPrint, skipCertificateKeyPrint bool) (string, error)
GetJoinControlPlaneCommand returns the kubeadm join command for a given token and Kubernetes cluster (the current cluster in the kubeconfig file)
func GetJoinWorkerCommand ¶
GetJoinWorkerCommand returns the kubeadm join command for a given token and Kubernetes cluster (the current cluster in the kubeconfig file)
func GetKubeConfigPath ¶
GetKubeConfigPath can be used to search for a kubeconfig in standard locations if and empty string is passed to the function. If a non-empty string is passed the function returns the same string.
func InteractivelyConfirmAction ¶
InteractivelyConfirmAction asks the user whether they _really_ want to take the action.
func LongDesc ¶
LongDesc is designed to help with producing better long command line descriptions in code. Its behavior is somewhat inspired by the same function of kubectl, which uses Markdown for the input message. This one is not Markdown compliant, but it covers the needs of kubeadm. In particular: - Beginning and trailing space characters (including empty lines), are stripped from the output. - Consecutive non-empty lines of text are joined with spaces to form paragraphs. - Paragraphs are blocks of text divided by one or more empty lines or lines consisting only of "space" characters. - Paragraphs are spaced by precisely one empty line in the output. - A line break can be forced by adding a couple of empty spaces at the end of a text line. - All indentation is removed. The resulting output is not indented.
func RequireSubcommand ¶
RequireSubcommand can be used to set an empty Run function and NoArgs on a Cobra command. This handles a case where a subcommand must be specified for a parent command 'c'. If no subcommand is specified the CLI exist with an error.
func TypeMismatchErr ¶
TypeMismatchErr return an error which indicates how the type is mismatched.
func ValidateExactArgNumber ¶
ValidateExactArgNumber validates that the required top-level arguments are specified
func ValueFromFlagsOrConfig ¶
func ValueFromFlagsOrConfig(flagSet *pflag.FlagSet, name string, cfgValue interface{}, flagValue interface{}) interface{}
ValueFromFlagsOrConfig checks if the "name" flag has been set. If yes, it returns the value of the flag, otherwise it returns the value from config.
Source Files ¶
cmdutil.go documentation.go join.go
- Version
- v1.33.0-alpha.1
- Published
- Feb 5, 2025
- Platform
- js/wasm
- Imports
- 18 packages
- Last checked
- 3 minutes ago –
Tools for package owners.