mirror of https://github.com/k3s-io/k3s
kubeadm/cmd: fix typos, punctuation and capitalization
completion.go: - use single space instead of double space after full stop config.go: - add full stop after output messages - bring a WARNING into a new sentence init.go: - add full stop after output messages - change 'couldn't' to 'could not' - capitalize 'Kubernetes' - reformat a sentence near '[externalca]' join.go: - add full stop after output messages reset.go: - add full stop after output messages - capitalize 'Docker' reset_test.go: - use semi-colon near 'file/dir' - change 'dir' to 'directory' - change 'temp' to 'temporary' token.go: - break sentence into two version.go: - capitalize output string - single-quote the list of output options - fix typo in comment near RunVersion() Signed-off-by: Lubomir I. Ivanov <lubomirivanov@vmware.com>pull/6/head
parent
2d1626028e
commit
4c5f0b04ee
|
@ -48,15 +48,15 @@ var (
|
|||
completionLong = dedent.Dedent(`
|
||||
Output shell completion code for the specified shell (bash or zsh).
|
||||
The shell code must be evalutated to provide interactive
|
||||
completion of kubeadm commands. This can be done by sourcing it from
|
||||
completion of kubeadm commands. This can be done by sourcing it from
|
||||
the .bash_profile.
|
||||
|
||||
Note: this requires the bash-completion framework, which is not installed
|
||||
by default on Mac. This can be installed by using homebrew:
|
||||
by default on Mac. This can be installed by using homebrew:
|
||||
|
||||
$ brew install bash-completion
|
||||
|
||||
Once installed, bash_completion must be evaluated. This can be done by adding the
|
||||
Once installed, bash_completion must be evaluated. This can be done by adding the
|
||||
following line to the .bash_profile
|
||||
|
||||
$ source $(brew --prefix)/etc/bash_completion
|
||||
|
|
|
@ -57,7 +57,7 @@ func NewCmdConfig(out io.Writer) *cobra.Command {
|
|||
RunE: cmdutil.SubCmdRunE("config"),
|
||||
}
|
||||
|
||||
cmd.PersistentFlags().StringVar(&kubeConfigFile, "kubeconfig", "/etc/kubernetes/admin.conf", "The KubeConfig file to use for talking to the cluster")
|
||||
cmd.PersistentFlags().StringVar(&kubeConfigFile, "kubeconfig", "/etc/kubernetes/admin.conf", "The KubeConfig file to use for talking to the cluster.")
|
||||
|
||||
cmd.AddCommand(NewCmdConfigUpload(out, &kubeConfigFile))
|
||||
cmd.AddCommand(NewCmdConfigView(out, &kubeConfigFile))
|
||||
|
@ -69,7 +69,7 @@ func NewCmdConfig(out io.Writer) *cobra.Command {
|
|||
func NewCmdConfigUpload(out io.Writer, kubeConfigFile *string) *cobra.Command {
|
||||
cmd := &cobra.Command{
|
||||
Use: "upload",
|
||||
Short: "Upload configuration about the current state so 'kubeadm upgrade' later can know how to configure the upgraded cluster",
|
||||
Short: "Upload configuration about the current state so 'kubeadm upgrade' later can know how to configure the upgraded cluster.",
|
||||
RunE: cmdutil.SubCmdRunE("upload"),
|
||||
}
|
||||
|
||||
|
@ -82,11 +82,11 @@ func NewCmdConfigUpload(out io.Writer, kubeConfigFile *string) *cobra.Command {
|
|||
func NewCmdConfigView(out io.Writer, kubeConfigFile *string) *cobra.Command {
|
||||
return &cobra.Command{
|
||||
Use: "view",
|
||||
Short: "View the kubeadm configuration stored inside the cluster",
|
||||
Short: "View the kubeadm configuration stored inside the cluster.",
|
||||
Long: fmt.Sprintf(dedent.Dedent(`
|
||||
Using this command, you can view the ConfigMap in the cluster where the configuration for kubeadm is located
|
||||
Using this command, you can view the ConfigMap in the cluster where the configuration for kubeadm is located.
|
||||
|
||||
The configuration is located in the %q namespace in the %q ConfigMap
|
||||
The configuration is located in the %q namespace in the %q ConfigMap.
|
||||
`), metav1.NamespaceSystem, constants.MasterConfigurationConfigMap),
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
client, err := kubeconfigutil.ClientSetFromFile(*kubeConfigFile)
|
||||
|
@ -104,13 +104,13 @@ func NewCmdConfigUploadFromFile(out io.Writer, kubeConfigFile *string) *cobra.Co
|
|||
var cfgPath string
|
||||
cmd := &cobra.Command{
|
||||
Use: "from-file",
|
||||
Short: "Upload a configuration file to the in-cluster ConfigMap for kubeadm configuration",
|
||||
Short: "Upload a configuration file to the in-cluster ConfigMap for kubeadm configuration.",
|
||||
Long: fmt.Sprintf(dedent.Dedent(`
|
||||
Using from-file, you can upload configuration to the ConfigMap in the cluster using the same config file you gave to kubeadm init.
|
||||
If you initialized your cluster using a v1.7.x or lower kubeadm client and used the --config option; you need to run this command with the
|
||||
same config file before upgrading to v1.8 using 'kubeadm upgrade'.
|
||||
|
||||
The configuration is located in the %q namespace in the %q ConfigMap
|
||||
The configuration is located in the %q namespace in the %q ConfigMap.
|
||||
`), metav1.NamespaceSystem, constants.MasterConfigurationConfigMap),
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
if len(cfgPath) == 0 {
|
||||
|
@ -127,7 +127,7 @@ func NewCmdConfigUploadFromFile(out io.Writer, kubeConfigFile *string) *cobra.Co
|
|||
kubeadmutil.CheckErr(err)
|
||||
},
|
||||
}
|
||||
cmd.Flags().StringVar(&cfgPath, "config", "", "Path to kubeadm config file (WARNING: Usage of a configuration file is experimental)")
|
||||
cmd.Flags().StringVar(&cfgPath, "config", "", "Path to a kubeadm config file. WARNING: Usage of a configuration file is experimental.")
|
||||
return cmd
|
||||
}
|
||||
|
||||
|
@ -140,13 +140,13 @@ func NewCmdConfigUploadFromFlags(out io.Writer, kubeConfigFile *string) *cobra.C
|
|||
|
||||
cmd := &cobra.Command{
|
||||
Use: "from-flags",
|
||||
Short: "Create the in-cluster configuration file for the first time from using flags",
|
||||
Short: "Create the in-cluster configuration file for the first time from using flags.",
|
||||
Long: fmt.Sprintf(dedent.Dedent(`
|
||||
Using from-flags, you can upload configuration to the ConfigMap in the cluster using the same flags you'd give to kubeadm init.
|
||||
If you initialized your cluster using a v1.7.x or lower kubeadm client and set some flag; you need to run this command with the
|
||||
same flags before upgrading to v1.8 using 'kubeadm upgrade'.
|
||||
|
||||
The configuration is located in the %q namespace in the %q ConfigMap
|
||||
The configuration is located in the %q namespace in the %q ConfigMap.
|
||||
`), metav1.NamespaceSystem, constants.MasterConfigurationConfigMap),
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
var err error
|
||||
|
|
|
@ -145,27 +145,27 @@ func AddInitConfigFlags(flagSet *flag.FlagSet, cfg *kubeadmapiext.MasterConfigur
|
|||
)
|
||||
flagSet.Int32Var(
|
||||
&cfg.API.BindPort, "apiserver-bind-port", cfg.API.BindPort,
|
||||
"Port for the API Server to bind to",
|
||||
"Port for the API Server to bind to.",
|
||||
)
|
||||
flagSet.StringVar(
|
||||
&cfg.Networking.ServiceSubnet, "service-cidr", cfg.Networking.ServiceSubnet,
|
||||
"Use alternative range of IP address for service VIPs",
|
||||
"Use alternative range of IP address for service VIPs.",
|
||||
)
|
||||
flagSet.StringVar(
|
||||
&cfg.Networking.PodSubnet, "pod-network-cidr", cfg.Networking.PodSubnet,
|
||||
"Specify range of IP addresses for the pod network; if set, the control plane will automatically allocate CIDRs for every node",
|
||||
"Specify range of IP addresses for the pod network; if set, the control plane will automatically allocate CIDRs for every node.",
|
||||
)
|
||||
flagSet.StringVar(
|
||||
&cfg.Networking.DNSDomain, "service-dns-domain", cfg.Networking.DNSDomain,
|
||||
`Use alternative domain for services, e.g. "myorg.internal"`,
|
||||
`Use alternative domain for services, e.g. "myorg.internal".`,
|
||||
)
|
||||
flagSet.StringVar(
|
||||
&cfg.KubernetesVersion, "kubernetes-version", cfg.KubernetesVersion,
|
||||
`Choose a specific Kubernetes version for the control plane`,
|
||||
`Choose a specific Kubernetes version for the control plane.`,
|
||||
)
|
||||
flagSet.StringVar(
|
||||
&cfg.CertificatesDir, "cert-dir", cfg.CertificatesDir,
|
||||
`The path where to save and store the certificates`,
|
||||
`The path where to save and store the certificates.`,
|
||||
)
|
||||
flagSet.StringSliceVar(
|
||||
&cfg.APIServerCertSANs, "apiserver-cert-extra-sans", cfg.APIServerCertSANs,
|
||||
|
@ -173,7 +173,7 @@ func AddInitConfigFlags(flagSet *flag.FlagSet, cfg *kubeadmapiext.MasterConfigur
|
|||
)
|
||||
flagSet.StringVar(
|
||||
&cfg.NodeName, "node-name", cfg.NodeName,
|
||||
`Specify the node name`,
|
||||
`Specify the node name.`,
|
||||
)
|
||||
flagSet.StringVar(
|
||||
&cfg.Token, "token", cfg.Token,
|
||||
|
@ -191,22 +191,22 @@ func AddInitConfigFlags(flagSet *flag.FlagSet, cfg *kubeadmapiext.MasterConfigur
|
|||
func AddInitOtherFlags(flagSet *flag.FlagSet, cfgPath *string, skipPreFlight, skipTokenPrint, dryRun *bool) {
|
||||
flagSet.StringVar(
|
||||
cfgPath, "config", *cfgPath,
|
||||
"Path to kubeadm config file (WARNING: Usage of a configuration file is experimental)",
|
||||
"Path to kubeadm config file. WARNING: Usage of a configuration file is experimental.",
|
||||
)
|
||||
// Note: All flags that are not bound to the cfg object should be whitelisted in cmd/kubeadm/app/apis/kubeadm/validation/validation.go
|
||||
flagSet.BoolVar(
|
||||
skipPreFlight, "skip-preflight-checks", *skipPreFlight,
|
||||
"Skip preflight checks normally run before modifying the system",
|
||||
"Skip preflight checks normally run before modifying the system.",
|
||||
)
|
||||
// Note: All flags that are not bound to the cfg object should be whitelisted in cmd/kubeadm/app/apis/kubeadm/validation/validation.go
|
||||
flagSet.BoolVar(
|
||||
skipTokenPrint, "skip-token-print", *skipTokenPrint,
|
||||
"Skip printing of the default bootstrap token generated by 'kubeadm init'",
|
||||
"Skip printing of the default bootstrap token generated by 'kubeadm init'.",
|
||||
)
|
||||
// Note: All flags that are not bound to the cfg object should be whitelisted in cmd/kubeadm/app/apis/kubeadm/validation/validation.go
|
||||
flagSet.BoolVar(
|
||||
dryRun, "dry-run", *dryRun,
|
||||
"Don't apply any changes; just output what would be done",
|
||||
"Don't apply any changes; just output what would be done.",
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -241,7 +241,7 @@ func NewInit(cfgPath string, cfg *kubeadmapi.MasterConfiguration, skipPreFlight,
|
|||
}
|
||||
|
||||
if !skipPreFlight {
|
||||
fmt.Println("[preflight] Running pre-flight checks")
|
||||
fmt.Println("[preflight] Running pre-flight checks.")
|
||||
|
||||
if err := preflight.RunInitMasterChecks(cfg); err != nil {
|
||||
return nil, err
|
||||
|
@ -250,7 +250,7 @@ func NewInit(cfgPath string, cfg *kubeadmapi.MasterConfiguration, skipPreFlight,
|
|||
// Try to start the kubelet service in case it's inactive
|
||||
preflight.TryStartKubelet()
|
||||
} else {
|
||||
fmt.Println("[preflight] Skipping pre-flight checks")
|
||||
fmt.Println("[preflight] Skipping pre-flight checks.")
|
||||
}
|
||||
|
||||
return &Init{cfg: cfg, skipTokenPrint: skipTokenPrint, dryRun: dryRun}, nil
|
||||
|
@ -276,7 +276,7 @@ func (i *Init) Run(out io.Writer) error {
|
|||
|
||||
k8sVersion, err := version.ParseSemantic(i.cfg.KubernetesVersion)
|
||||
if err != nil {
|
||||
return fmt.Errorf("couldn't parse kubernetes version %q: %v", i.cfg.KubernetesVersion, err)
|
||||
return fmt.Errorf("could not parse Kubernetes version %q: %v", i.cfg.KubernetesVersion, err)
|
||||
}
|
||||
|
||||
// Get directories to write files to; can be faked if we're dry-running
|
||||
|
@ -303,7 +303,7 @@ func (i *Init) Run(out io.Writer) error {
|
|||
}
|
||||
|
||||
} else {
|
||||
fmt.Println("[externalca] No ca.key detected, but all other certificates are available, so using external CA mode. Will not generate certs or kubeconfig.")
|
||||
fmt.Println("[externalca] The file 'ca.key' was not found, yet all other certificates are present. Using external CA mode - certificates or kubeconfig will not be generated.")
|
||||
}
|
||||
|
||||
// Temporarily set cfg.CertificatesDir to the "real value" when writing controlplane manifests
|
||||
|
@ -505,7 +505,7 @@ func getWaiter(dryRun bool, client clientset.Interface) apiclient.Waiter {
|
|||
func waitForAPIAndKubelet(waiter apiclient.Waiter) error {
|
||||
errorChan := make(chan error)
|
||||
|
||||
fmt.Printf("[init] Waiting for the kubelet to boot up the control plane as Static Pods from directory %q\n", kubeadmconstants.GetStaticPodDirectory())
|
||||
fmt.Printf("[init] Waiting for the kubelet to boot up the control plane as Static Pods from directory %q.\n", kubeadmconstants.GetStaticPodDirectory())
|
||||
fmt.Println("[init] This often takes around a minute; or longer if the control plane images have to be pulled.")
|
||||
|
||||
go func(errC chan error, waiter apiclient.Waiter) {
|
||||
|
|
|
@ -119,20 +119,20 @@ func NewCmdJoin(out io.Writer) *cobra.Command {
|
|||
|
||||
cmd.PersistentFlags().StringVar(
|
||||
&cfgPath, "config", cfgPath,
|
||||
"Path to kubeadm config file")
|
||||
"Path to kubeadm config file.")
|
||||
|
||||
cmd.PersistentFlags().StringVar(
|
||||
&cfg.DiscoveryFile, "discovery-file", "",
|
||||
"A file or url from which to load cluster information")
|
||||
"A file or url from which to load cluster information.")
|
||||
cmd.PersistentFlags().StringVar(
|
||||
&cfg.DiscoveryToken, "discovery-token", "",
|
||||
"A token used to validate cluster information fetched from the master")
|
||||
"A token used to validate cluster information fetched from the master.")
|
||||
cmd.PersistentFlags().StringVar(
|
||||
&cfg.NodeName, "node-name", "",
|
||||
"Specify the node name")
|
||||
"Specify the node name.")
|
||||
cmd.PersistentFlags().StringVar(
|
||||
&cfg.TLSBootstrapToken, "tls-bootstrap-token", "",
|
||||
"A token used for TLS bootstrapping")
|
||||
"A token used for TLS bootstrapping.")
|
||||
cmd.PersistentFlags().StringSliceVar(
|
||||
&cfg.DiscoveryTokenCACertHashes, "discovery-token-ca-cert-hash", []string{},
|
||||
"For token-based discovery, validate that the root CA public key matches this hash (format: \"<type>:<value>\").")
|
||||
|
@ -142,11 +142,11 @@ func NewCmdJoin(out io.Writer) *cobra.Command {
|
|||
|
||||
cmd.PersistentFlags().StringVar(
|
||||
&cfg.Token, "token", "",
|
||||
"Use this token for both discovery-token and tls-bootstrap-token")
|
||||
"Use this token for both discovery-token and tls-bootstrap-token.")
|
||||
|
||||
cmd.PersistentFlags().BoolVar(
|
||||
&skipPreFlight, "skip-preflight-checks", false,
|
||||
"Skip preflight checks normally run before modifying the system",
|
||||
"Skip preflight checks normally run before modifying the system.",
|
||||
)
|
||||
|
||||
return cmd
|
||||
|
@ -176,7 +176,7 @@ func NewJoin(cfgPath string, args []string, cfg *kubeadmapi.NodeConfiguration, s
|
|||
}
|
||||
|
||||
if !skipPreFlight {
|
||||
fmt.Println("[preflight] Running pre-flight checks")
|
||||
fmt.Println("[preflight] Running pre-flight checks.")
|
||||
|
||||
// Then continue with the others...
|
||||
if err := preflight.RunJoinNodeChecks(cfg); err != nil {
|
||||
|
@ -186,7 +186,7 @@ func NewJoin(cfgPath string, args []string, cfg *kubeadmapi.NodeConfiguration, s
|
|||
// Try to start the kubelet service in case it's inactive
|
||||
preflight.TryStartKubelet()
|
||||
} else {
|
||||
fmt.Println("[preflight] Skipping pre-flight checks")
|
||||
fmt.Println("[preflight] Skipping pre-flight checks.")
|
||||
}
|
||||
|
||||
return &Join{cfg: cfg}, nil
|
||||
|
|
|
@ -48,7 +48,7 @@ func NewCmdReset(out io.Writer) *cobra.Command {
|
|||
|
||||
cmd.PersistentFlags().BoolVar(
|
||||
&skipPreFlight, "skip-preflight-checks", false,
|
||||
"Skip preflight checks normally run before modifying the system",
|
||||
"Skip preflight checks normally run before modifying the system.",
|
||||
)
|
||||
|
||||
cmd.PersistentFlags().StringVar(
|
||||
|
@ -67,13 +67,13 @@ type Reset struct {
|
|||
// NewReset instantiate Reset struct
|
||||
func NewReset(skipPreFlight bool, certsDir string) (*Reset, error) {
|
||||
if !skipPreFlight {
|
||||
fmt.Println("[preflight] Running pre-flight checks")
|
||||
fmt.Println("[preflight] Running pre-flight checks.")
|
||||
|
||||
if err := preflight.RunRootCheckOnly(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
} else {
|
||||
fmt.Println("[preflight] Skipping pre-flight checks")
|
||||
fmt.Println("[preflight] Skipping pre-flight checks.")
|
||||
}
|
||||
|
||||
return &Reset{
|
||||
|
@ -90,7 +90,7 @@ func (r *Reset) Run(out io.Writer) error {
|
|||
fmt.Println("[reset] WARNING: The kubelet service couldn't be stopped by kubeadm because no supported init system was detected.")
|
||||
fmt.Println("[reset] WARNING: Please ensure kubelet is stopped manually.")
|
||||
} else {
|
||||
fmt.Println("[reset] Stopping the kubelet service")
|
||||
fmt.Println("[reset] Stopping the kubelet service.")
|
||||
if err := initSystem.ServiceStop("kubelet"); err != nil {
|
||||
fmt.Printf("[reset] WARNING: The kubelet service couldn't be stopped by kubeadm: [%v]\n", err)
|
||||
fmt.Println("[reset] WARNING: Please ensure kubelet is stopped manually.")
|
||||
|
@ -107,12 +107,12 @@ func (r *Reset) Run(out io.Writer) error {
|
|||
|
||||
dockerCheck := preflight.ServiceCheck{Service: "docker", CheckIfActive: true}
|
||||
if _, errors := dockerCheck.Check(); len(errors) == 0 {
|
||||
fmt.Println("[reset] Removing kubernetes-managed containers")
|
||||
fmt.Println("[reset] Removing kubernetes-managed containers.")
|
||||
if err := exec.Command("sh", "-c", "docker ps -a --filter name=k8s_ -q | xargs -r docker rm --force --volumes").Run(); err != nil {
|
||||
fmt.Println("[reset] Failed to stop the running containers")
|
||||
fmt.Println("[reset] Failed to stop the running containers.")
|
||||
}
|
||||
} else {
|
||||
fmt.Println("[reset] docker doesn't seem to be running, skipping the removal of running kubernetes containers")
|
||||
fmt.Println("[reset] Docker doesn't seem to be running. Skipping the removal of running Kubernetes containers.")
|
||||
}
|
||||
|
||||
dirsToClean := []string{"/var/lib/kubelet", "/etc/cni/net.d", "/var/lib/dockershim", "/var/run/kubernetes"}
|
||||
|
|
|
@ -28,8 +28,8 @@ import (
|
|||
|
||||
func assertExists(t *testing.T, path string) {
|
||||
if _, err := os.Stat(path); os.IsNotExist(err) {
|
||||
t.Errorf("file/dir does not exist error: %s", err)
|
||||
t.Errorf("file/dir does not exist: %s", path)
|
||||
t.Errorf("file/directory does not exist; error: %s", err)
|
||||
t.Errorf("file/directory does not exist: %s", path)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -143,7 +143,7 @@ func TestConfigDirCleaner(t *testing.T) {
|
|||
// Create a temporary directory for our fake config dir:
|
||||
tmpDir, err := ioutil.TempDir("", "kubeadm-reset-test")
|
||||
if err != nil {
|
||||
t.Errorf("Unable to create temp directory: %s", err)
|
||||
t.Errorf("Unable to create temporary directory: %s", err)
|
||||
}
|
||||
defer os.RemoveAll(tmpDir)
|
||||
|
||||
|
|
|
@ -178,7 +178,7 @@ func NewCmdTokenGenerate(out io.Writer) *cobra.Command {
|
|||
This command will print out a randomly-generated bootstrap token that can be used with
|
||||
the "init" and "join" commands.
|
||||
|
||||
You don't have to use this command in order to generate a token, you can do so
|
||||
You don't have to use this command in order to generate a token. You can do so
|
||||
yourself as long as it's in the format "[a-z0-9]{6}.[a-z0-9]{16}". This
|
||||
command is provided for convenience to generate tokens in that format.
|
||||
|
||||
|
|
|
@ -46,11 +46,11 @@ func NewCmdVersion(out io.Writer) *cobra.Command {
|
|||
kubeadmutil.CheckErr(err)
|
||||
},
|
||||
}
|
||||
cmd.Flags().StringP("output", "o", "", "output format, options available are yaml, json and short")
|
||||
cmd.Flags().StringP("output", "o", "", "Output format; available options are 'yaml', 'json' and 'short'")
|
||||
return cmd
|
||||
}
|
||||
|
||||
// RunVersion provides the version information of kubeadm in format depending on an arguments
|
||||
// RunVersion provides the version information of kubeadm in format depending on arguments
|
||||
// specified in cobra.Command.
|
||||
func RunVersion(out io.Writer, cmd *cobra.Command) error {
|
||||
clientVersion := version.Get()
|
||||
|
|
Loading…
Reference in New Issue