mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-28 05:57:25 +00:00
kubectl: rewrite docstrings in several files
Fixing inaccuracies and clarifying in the case of ambiguities.
This commit is contained in:
parent
d29560d89a
commit
f9913c4948
@ -35,14 +35,15 @@ import (
|
|||||||
|
|
||||||
var (
|
var (
|
||||||
cp_example = templates.Examples(i18n.T(`
|
cp_example = templates.Examples(i18n.T(`
|
||||||
# !!!Important Note!!!
|
# !!!Important Note!!!
|
||||||
# Requires that the 'tar' binary is present in your container
|
# Requires that the 'tar' binary is present in your container
|
||||||
# image. If 'tar' is not present, 'kubectl cp' will fail.
|
# 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 <some-pod>:/tmp/bar_dir
|
kubectl cp /tmp/foo_dir <some-pod>:/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 <some-pod>:/tmp/bar -c <specific-container>
|
kubectl cp /tmp/foo <some-pod>:/tmp/bar -c <specific-container>
|
||||||
|
|
||||||
# Copy /tmp/foo local file to /tmp/bar in a remote pod in namespace <some-namespace>
|
# Copy /tmp/foo local file to /tmp/bar in a remote pod in namespace <some-namespace>
|
||||||
@ -52,8 +53,8 @@ var (
|
|||||||
kubectl cp <some-namespace>/<some-pod>:/tmp/foo /tmp/bar`))
|
kubectl cp <some-namespace>/<some-pod>:/tmp/foo /tmp/bar`))
|
||||||
|
|
||||||
cpUsageStr = dedent.Dedent(`
|
cpUsageStr = dedent.Dedent(`
|
||||||
expected 'cp <file-spec-src> <file-spec-dest> [-c container]'.
|
expected 'cp <file-spec-src> <file-spec-dest> [-c container]'.
|
||||||
<file-spec> is:
|
<file-spec> is:
|
||||||
[namespace/]pod-name:/file/path for a remote file
|
[namespace/]pod-name:/file/path for a remote file
|
||||||
/file/path for a local file`)
|
/file/path for a local file`)
|
||||||
)
|
)
|
||||||
|
@ -40,7 +40,7 @@ type CreateOptions struct {
|
|||||||
|
|
||||||
var (
|
var (
|
||||||
create_long = templates.LongDesc(i18n.T(`
|
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.`))
|
JSON and YAML formats are accepted.`))
|
||||||
|
|
||||||
@ -60,7 +60,7 @@ func NewCmdCreate(f cmdutil.Factory, out, errOut io.Writer) *cobra.Command {
|
|||||||
|
|
||||||
cmd := &cobra.Command{
|
cmd := &cobra.Command{
|
||||||
Use: "create -f FILENAME",
|
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,
|
Long: create_long,
|
||||||
Example: create_example,
|
Example: create_example,
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
|
@ -38,7 +38,9 @@ var (
|
|||||||
kubectl create deployment my-dep --image=busybox`))
|
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 {
|
func NewCmdCreateDeployment(f cmdutil.Factory, cmdOut, cmdErr io.Writer) *cobra.Command {
|
||||||
cmd := &cobra.Command{
|
cmd := &cobra.Command{
|
||||||
Use: "deployment NAME --image=image [--dry-run]",
|
Use: "deployment NAME --image=image [--dry-run]",
|
||||||
|
@ -14,7 +14,8 @@ See the License for the specific language governing permissions and
|
|||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Package kubectl is a set of libraries that are used by the kubectl command line tool.
|
// Package kubectl provides the functions used by the kubectl command line tool
|
||||||
// They are separated out into a library to support unit testing. Most functionality should
|
// under k8s.io/kubernetes/cmd. The functions are kept in this package to better
|
||||||
// be included in this package, and the main kubectl should really just be an entry point.
|
// 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"
|
package kubectl // import "k8s.io/kubernetes/pkg/kubectl"
|
||||||
|
@ -35,7 +35,9 @@ type GeneratorParam struct {
|
|||||||
Required bool
|
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 {
|
type Generator interface {
|
||||||
// Generate creates an API object given a set of parameters
|
// Generate creates an API object given a set of parameters
|
||||||
Generate(params map[string]interface{}) (runtime.Object, error)
|
Generate(params map[string]interface{}) (runtime.Object, error)
|
||||||
|
@ -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) {
|
func parseLiteralSource(source string) (keyName, value string, err error) {
|
||||||
// leading equal is invalid
|
// leading equal is invalid
|
||||||
if strings.Index(source, "=") == 0 {
|
if strings.Index(source, "=") == 0 {
|
||||||
|
@ -108,7 +108,8 @@ func (f *FilterServer) accept(method, path, host string) bool {
|
|||||||
return false
|
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 {
|
func (f *FilterServer) HandlerFor(delegate http.Handler) *FilterServer {
|
||||||
f2 := *f
|
f2 := *f
|
||||||
f2.delegate = delegate
|
f2.delegate = delegate
|
||||||
|
@ -46,11 +46,12 @@ const (
|
|||||||
Timeout = time.Minute * 5
|
Timeout = time.Minute * 5
|
||||||
)
|
)
|
||||||
|
|
||||||
// A Reaper handles terminating an object as gracefully as possible.
|
// A Reaper terminates 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.
|
|
||||||
type Reaper interface {
|
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
|
Stop(namespace, name string, timeout time.Duration, gracePeriod *metav1.DeleteOptions) error
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user