mirror of https://github.com/k3s-io/k3s
Merge pull request #53139 from neolit123/kubeadm-cmd-typos
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. Fix kubeadm command related typos, punctuation and capitalization **What this PR does / why we need it**: This PR deals with a numerous fixes of small punctuation, capitalization and wording typos in the kubeadm/app/cmd namespace. It cleans the output shown to the user in stdout. **Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: fixes # /approve no-issue **Special notes for your reviewer**: I can easily amend, remove or squash certain changes, so if you think there is a need for that - please, let me know. Lubomir I. Ivanov (VMWare)pull/6/head
commit
2124c73d60
|
@ -57,7 +57,7 @@ func NewCmdConfig(out io.Writer) *cobra.Command {
|
||||||
RunE: cmdutil.SubCmdRunE("config"),
|
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(NewCmdConfigUpload(out, &kubeConfigFile))
|
||||||
cmd.AddCommand(NewCmdConfigView(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 {
|
func NewCmdConfigUpload(out io.Writer, kubeConfigFile *string) *cobra.Command {
|
||||||
cmd := &cobra.Command{
|
cmd := &cobra.Command{
|
||||||
Use: "upload",
|
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"),
|
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 {
|
func NewCmdConfigView(out io.Writer, kubeConfigFile *string) *cobra.Command {
|
||||||
return &cobra.Command{
|
return &cobra.Command{
|
||||||
Use: "view",
|
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(`
|
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),
|
`), metav1.NamespaceSystem, constants.MasterConfigurationConfigMap),
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
client, err := kubeconfigutil.ClientSetFromFile(*kubeConfigFile)
|
client, err := kubeconfigutil.ClientSetFromFile(*kubeConfigFile)
|
||||||
|
@ -104,13 +104,13 @@ func NewCmdConfigUploadFromFile(out io.Writer, kubeConfigFile *string) *cobra.Co
|
||||||
var cfgPath string
|
var cfgPath string
|
||||||
cmd := &cobra.Command{
|
cmd := &cobra.Command{
|
||||||
Use: "from-file",
|
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(`
|
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.
|
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
|
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'.
|
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),
|
`), metav1.NamespaceSystem, constants.MasterConfigurationConfigMap),
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
if len(cfgPath) == 0 {
|
if len(cfgPath) == 0 {
|
||||||
|
@ -127,7 +127,7 @@ func NewCmdConfigUploadFromFile(out io.Writer, kubeConfigFile *string) *cobra.Co
|
||||||
kubeadmutil.CheckErr(err)
|
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
|
return cmd
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -140,13 +140,13 @@ func NewCmdConfigUploadFromFlags(out io.Writer, kubeConfigFile *string) *cobra.C
|
||||||
|
|
||||||
cmd := &cobra.Command{
|
cmd := &cobra.Command{
|
||||||
Use: "from-flags",
|
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(`
|
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.
|
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
|
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'.
|
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),
|
`), metav1.NamespaceSystem, constants.MasterConfigurationConfigMap),
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
var err error
|
var err error
|
||||||
|
|
|
@ -145,27 +145,27 @@ func AddInitConfigFlags(flagSet *flag.FlagSet, cfg *kubeadmapiext.MasterConfigur
|
||||||
)
|
)
|
||||||
flagSet.Int32Var(
|
flagSet.Int32Var(
|
||||||
&cfg.API.BindPort, "apiserver-bind-port", cfg.API.BindPort,
|
&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(
|
flagSet.StringVar(
|
||||||
&cfg.Networking.ServiceSubnet, "service-cidr", cfg.Networking.ServiceSubnet,
|
&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(
|
flagSet.StringVar(
|
||||||
&cfg.Networking.PodSubnet, "pod-network-cidr", cfg.Networking.PodSubnet,
|
&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(
|
flagSet.StringVar(
|
||||||
&cfg.Networking.DNSDomain, "service-dns-domain", cfg.Networking.DNSDomain,
|
&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(
|
flagSet.StringVar(
|
||||||
&cfg.KubernetesVersion, "kubernetes-version", cfg.KubernetesVersion,
|
&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(
|
flagSet.StringVar(
|
||||||
&cfg.CertificatesDir, "cert-dir", cfg.CertificatesDir,
|
&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(
|
flagSet.StringSliceVar(
|
||||||
&cfg.APIServerCertSANs, "apiserver-cert-extra-sans", cfg.APIServerCertSANs,
|
&cfg.APIServerCertSANs, "apiserver-cert-extra-sans", cfg.APIServerCertSANs,
|
||||||
|
@ -173,7 +173,7 @@ func AddInitConfigFlags(flagSet *flag.FlagSet, cfg *kubeadmapiext.MasterConfigur
|
||||||
)
|
)
|
||||||
flagSet.StringVar(
|
flagSet.StringVar(
|
||||||
&cfg.NodeName, "node-name", cfg.NodeName,
|
&cfg.NodeName, "node-name", cfg.NodeName,
|
||||||
`Specify the node name`,
|
`Specify the node name.`,
|
||||||
)
|
)
|
||||||
flagSet.StringVar(
|
flagSet.StringVar(
|
||||||
&cfg.Token, "token", cfg.Token,
|
&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) {
|
func AddInitOtherFlags(flagSet *flag.FlagSet, cfgPath *string, skipPreFlight, skipTokenPrint, dryRun *bool) {
|
||||||
flagSet.StringVar(
|
flagSet.StringVar(
|
||||||
cfgPath, "config", *cfgPath,
|
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
|
// 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(
|
flagSet.BoolVar(
|
||||||
skipPreFlight, "skip-preflight-checks", *skipPreFlight,
|
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
|
// 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(
|
flagSet.BoolVar(
|
||||||
skipTokenPrint, "skip-token-print", *skipTokenPrint,
|
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
|
// 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(
|
flagSet.BoolVar(
|
||||||
dryRun, "dry-run", *dryRun,
|
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 {
|
if !skipPreFlight {
|
||||||
fmt.Println("[preflight] Running pre-flight checks")
|
fmt.Println("[preflight] Running pre-flight checks.")
|
||||||
|
|
||||||
if err := preflight.RunInitMasterChecks(cfg); err != nil {
|
if err := preflight.RunInitMasterChecks(cfg); err != nil {
|
||||||
return nil, err
|
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
|
// Try to start the kubelet service in case it's inactive
|
||||||
preflight.TryStartKubelet()
|
preflight.TryStartKubelet()
|
||||||
} else {
|
} else {
|
||||||
fmt.Println("[preflight] Skipping pre-flight checks")
|
fmt.Println("[preflight] Skipping pre-flight checks.")
|
||||||
}
|
}
|
||||||
|
|
||||||
return &Init{cfg: cfg, skipTokenPrint: skipTokenPrint, dryRun: dryRun}, nil
|
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)
|
k8sVersion, err := version.ParseSemantic(i.cfg.KubernetesVersion)
|
||||||
if err != nil {
|
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
|
// 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 {
|
} 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
|
// 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 {
|
func waitForAPIAndKubelet(waiter apiclient.Waiter) error {
|
||||||
errorChan := make(chan 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.")
|
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) {
|
go func(errC chan error, waiter apiclient.Waiter) {
|
||||||
|
|
|
@ -119,20 +119,20 @@ func NewCmdJoin(out io.Writer) *cobra.Command {
|
||||||
|
|
||||||
cmd.PersistentFlags().StringVar(
|
cmd.PersistentFlags().StringVar(
|
||||||
&cfgPath, "config", cfgPath,
|
&cfgPath, "config", cfgPath,
|
||||||
"Path to kubeadm config file")
|
"Path to kubeadm config file.")
|
||||||
|
|
||||||
cmd.PersistentFlags().StringVar(
|
cmd.PersistentFlags().StringVar(
|
||||||
&cfg.DiscoveryFile, "discovery-file", "",
|
&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(
|
cmd.PersistentFlags().StringVar(
|
||||||
&cfg.DiscoveryToken, "discovery-token", "",
|
&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(
|
cmd.PersistentFlags().StringVar(
|
||||||
&cfg.NodeName, "node-name", "",
|
&cfg.NodeName, "node-name", "",
|
||||||
"Specify the node name")
|
"Specify the node name.")
|
||||||
cmd.PersistentFlags().StringVar(
|
cmd.PersistentFlags().StringVar(
|
||||||
&cfg.TLSBootstrapToken, "tls-bootstrap-token", "",
|
&cfg.TLSBootstrapToken, "tls-bootstrap-token", "",
|
||||||
"A token used for TLS bootstrapping")
|
"A token used for TLS bootstrapping.")
|
||||||
cmd.PersistentFlags().StringSliceVar(
|
cmd.PersistentFlags().StringSliceVar(
|
||||||
&cfg.DiscoveryTokenCACertHashes, "discovery-token-ca-cert-hash", []string{},
|
&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>\").")
|
"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(
|
cmd.PersistentFlags().StringVar(
|
||||||
&cfg.Token, "token", "",
|
&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(
|
cmd.PersistentFlags().BoolVar(
|
||||||
&skipPreFlight, "skip-preflight-checks", false,
|
&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
|
return cmd
|
||||||
|
@ -176,7 +176,7 @@ func NewJoin(cfgPath string, args []string, cfg *kubeadmapi.NodeConfiguration, s
|
||||||
}
|
}
|
||||||
|
|
||||||
if !skipPreFlight {
|
if !skipPreFlight {
|
||||||
fmt.Println("[preflight] Running pre-flight checks")
|
fmt.Println("[preflight] Running pre-flight checks.")
|
||||||
|
|
||||||
// Then continue with the others...
|
// Then continue with the others...
|
||||||
if err := preflight.RunJoinNodeChecks(cfg); err != nil {
|
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
|
// Try to start the kubelet service in case it's inactive
|
||||||
preflight.TryStartKubelet()
|
preflight.TryStartKubelet()
|
||||||
} else {
|
} else {
|
||||||
fmt.Println("[preflight] Skipping pre-flight checks")
|
fmt.Println("[preflight] Skipping pre-flight checks.")
|
||||||
}
|
}
|
||||||
|
|
||||||
return &Join{cfg: cfg}, nil
|
return &Join{cfg: cfg}, nil
|
||||||
|
|
|
@ -48,7 +48,7 @@ func NewCmdReset(out io.Writer) *cobra.Command {
|
||||||
|
|
||||||
cmd.PersistentFlags().BoolVar(
|
cmd.PersistentFlags().BoolVar(
|
||||||
&skipPreFlight, "skip-preflight-checks", false,
|
&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(
|
cmd.PersistentFlags().StringVar(
|
||||||
|
@ -67,13 +67,13 @@ type Reset struct {
|
||||||
// NewReset instantiate Reset struct
|
// NewReset instantiate Reset struct
|
||||||
func NewReset(skipPreFlight bool, certsDir string) (*Reset, error) {
|
func NewReset(skipPreFlight bool, certsDir string) (*Reset, error) {
|
||||||
if !skipPreFlight {
|
if !skipPreFlight {
|
||||||
fmt.Println("[preflight] Running pre-flight checks")
|
fmt.Println("[preflight] Running pre-flight checks.")
|
||||||
|
|
||||||
if err := preflight.RunRootCheckOnly(); err != nil {
|
if err := preflight.RunRootCheckOnly(); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
fmt.Println("[preflight] Skipping pre-flight checks")
|
fmt.Println("[preflight] Skipping pre-flight checks.")
|
||||||
}
|
}
|
||||||
|
|
||||||
return &Reset{
|
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: 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.")
|
fmt.Println("[reset] WARNING: Please ensure kubelet is stopped manually.")
|
||||||
} else {
|
} else {
|
||||||
fmt.Println("[reset] Stopping the kubelet service")
|
fmt.Println("[reset] Stopping the kubelet service.")
|
||||||
if err := initSystem.ServiceStop("kubelet"); err != nil {
|
if err := initSystem.ServiceStop("kubelet"); err != nil {
|
||||||
fmt.Printf("[reset] WARNING: The kubelet service couldn't be stopped by kubeadm: [%v]\n", err)
|
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.")
|
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}
|
dockerCheck := preflight.ServiceCheck{Service: "docker", CheckIfActive: true}
|
||||||
if _, errors := dockerCheck.Check(); len(errors) == 0 {
|
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 {
|
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 {
|
} 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"}
|
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) {
|
func assertExists(t *testing.T, path string) {
|
||||||
if _, err := os.Stat(path); os.IsNotExist(err) {
|
if _, err := os.Stat(path); os.IsNotExist(err) {
|
||||||
t.Errorf("file/dir does not exist error: %s", err)
|
t.Errorf("file/directory does not exist; error: %s", err)
|
||||||
t.Errorf("file/dir does not exist: %s", path)
|
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:
|
// Create a temporary directory for our fake config dir:
|
||||||
tmpDir, err := ioutil.TempDir("", "kubeadm-reset-test")
|
tmpDir, err := ioutil.TempDir("", "kubeadm-reset-test")
|
||||||
if err != nil {
|
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)
|
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
|
This command will print out a randomly-generated bootstrap token that can be used with
|
||||||
the "init" and "join" commands.
|
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
|
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.
|
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)
|
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
|
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.
|
// specified in cobra.Command.
|
||||||
func RunVersion(out io.Writer, cmd *cobra.Command) error {
|
func RunVersion(out io.Writer, cmd *cobra.Command) error {
|
||||||
clientVersion := version.Get()
|
clientVersion := version.Get()
|
||||||
|
|
Loading…
Reference in New Issue