diff --git a/pkg/kubectl/cmd/cp.go b/pkg/kubectl/cmd/cp.go index a0bac76c39f..d5e6c18cd8d 100644 --- a/pkg/kubectl/cmd/cp.go +++ b/pkg/kubectl/cmd/cp.go @@ -35,14 +35,15 @@ import ( var ( cp_example = templates.Examples(i18n.T(` - # !!!Important Note!!! - # Requires that the 'tar' binary is present in your container - # image. If 'tar' is not present, 'kubectl cp' will fail. + # !!!Important Note!!! + # Requires that the 'tar' binary is present in your container + # image. If 'tar' is not present, 'kubectl cp' will fail. - # Copy /tmp/foo_dir local directory to /tmp/bar_dir in a remote pod in the default namespace + + # Copy /tmp/foo_dir local directory to /tmp/bar_dir in a remote pod in the default namespace kubectl cp /tmp/foo_dir :/tmp/bar_dir - # Copy /tmp/foo local file to /tmp/bar in a remote pod in a specific container + # Copy /tmp/foo local file to /tmp/bar in a remote pod in a specific container kubectl cp /tmp/foo :/tmp/bar -c # Copy /tmp/foo local file to /tmp/bar in a remote pod in namespace @@ -52,8 +53,8 @@ var ( kubectl cp /:/tmp/foo /tmp/bar`)) cpUsageStr = dedent.Dedent(` - expected 'cp [-c container]'. - is: + expected 'cp [-c container]'. + is: [namespace/]pod-name:/file/path for a remote file /file/path for a local file`) ) diff --git a/pkg/kubectl/cmd/create.go b/pkg/kubectl/cmd/create.go index bfec15bc8c6..8112a6b7fe2 100644 --- a/pkg/kubectl/cmd/create.go +++ b/pkg/kubectl/cmd/create.go @@ -40,7 +40,7 @@ type CreateOptions struct { var ( create_long = templates.LongDesc(i18n.T(` - Create a resource by filename or stdin. + Create a resource from a file or from stdin. JSON and YAML formats are accepted.`)) @@ -60,7 +60,7 @@ func NewCmdCreate(f cmdutil.Factory, out, errOut io.Writer) *cobra.Command { cmd := &cobra.Command{ Use: "create -f FILENAME", - Short: i18n.T("Create a resource by filename or stdin"), + Short: i18n.T("Create a resource from a file or from stdin."), Long: create_long, Example: create_example, Run: func(cmd *cobra.Command, args []string) { diff --git a/pkg/kubectl/cmd/create_deployment.go b/pkg/kubectl/cmd/create_deployment.go index b3393788e67..b7033d41f0e 100644 --- a/pkg/kubectl/cmd/create_deployment.go +++ b/pkg/kubectl/cmd/create_deployment.go @@ -38,7 +38,9 @@ var ( kubectl create deployment my-dep --image=busybox`)) ) -// NewCmdCreateDeployment is a macro command to create a new deployment +// NewCmdCreateDeployment is a macro command to create a new deployment. +// This command is better known to users as `kubectl create deployment`. +// Note that this command overlaps significantly with the `kubectl run` command. func NewCmdCreateDeployment(f cmdutil.Factory, cmdOut, cmdErr io.Writer) *cobra.Command { cmd := &cobra.Command{ Use: "deployment NAME --image=image [--dry-run]", diff --git a/pkg/kubectl/doc.go b/pkg/kubectl/doc.go index df45d44691b..52afc49f19f 100644 --- a/pkg/kubectl/doc.go +++ b/pkg/kubectl/doc.go @@ -14,7 +14,8 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Package kubectl is a set of libraries that are used by the kubectl command line tool. -// They are separated out into a library to support unit testing. Most functionality should -// be included in this package, and the main kubectl should really just be an entry point. +// Package kubectl provides the functions used by the kubectl command line tool +// under k8s.io/kubernetes/cmd. The functions are kept in this package to better +// support unit testing. The main() method for kubectl is only an entry point +// and should contain no functionality. package kubectl // import "k8s.io/kubernetes/pkg/kubectl" diff --git a/pkg/kubectl/generate.go b/pkg/kubectl/generate.go index 07c437cdd47..083f15584a9 100644 --- a/pkg/kubectl/generate.go +++ b/pkg/kubectl/generate.go @@ -35,7 +35,9 @@ type GeneratorParam struct { Required bool } -// Generator is an interface for things that can generate API objects from input parameters. +// Generator is an interface for things that can generate API objects from input +// parameters. One example is the "expose" generator that is capable of exposing +// new replication controllers and services, among other things. type Generator interface { // Generate creates an API object given a set of parameters Generate(params map[string]interface{}) (runtime.Object, error) diff --git a/pkg/kubectl/kubectl.go b/pkg/kubectl/kubectl.go index d22953adbfa..2cf9425eb8e 100644 --- a/pkg/kubectl/kubectl.go +++ b/pkg/kubectl/kubectl.go @@ -212,7 +212,10 @@ func parseFileSource(source string) (keyName, filePath string, err error) { } } -// parseLiteralSource parses the source key=val pair +// parseLiteralSource parses the source key=val pair into its component pieces. +// This functionality is distinguished from strings.SplitN(source, "=", 2) since +// it returns an error in the case of empty keys, values, or a missing equals +// sign. func parseLiteralSource(source string) (keyName, value string, err error) { // leading equal is invalid if strings.Index(source, "=") == 0 { diff --git a/pkg/kubectl/proxy_server.go b/pkg/kubectl/proxy_server.go index 8ae65004759..ce60727b4b8 100644 --- a/pkg/kubectl/proxy_server.go +++ b/pkg/kubectl/proxy_server.go @@ -108,7 +108,8 @@ func (f *FilterServer) accept(method, path, host string) bool { return false } -// Make a copy of f which passes requests along to the new delegate. +// HandlerFor makes a shallow copy of f which passes its requests along to the +// new delegate. func (f *FilterServer) HandlerFor(delegate http.Handler) *FilterServer { f2 := *f f2.delegate = delegate diff --git a/pkg/kubectl/stop.go b/pkg/kubectl/stop.go index 1a8db59b5f9..4fcb9415fc8 100644 --- a/pkg/kubectl/stop.go +++ b/pkg/kubectl/stop.go @@ -46,11 +46,12 @@ const ( Timeout = time.Minute * 5 ) -// A Reaper handles terminating an object as gracefully as possible. -// timeout is how long we'll wait for the termination to be successful -// gracePeriod is time given to an API object for it to delete itself cleanly, -// e.g., pod shutdown. It may or may not be supported by the API object. +// A Reaper terminates an object as gracefully as possible. type Reaper interface { + // Stop a given object within a namespace. timeout is how long we'll + // wait for the termination to be successful. gracePeriod is time given + // to an API object for it to delete itself cleanly (e.g., pod + // shutdown). It may or may not be supported by the API object. Stop(namespace, name string, timeout time.Duration, gracePeriod *metav1.DeleteOptions) error }