Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
f9913c49
Commit
f9913c49
authored
May 25, 2017
by
Alexander Campbell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kubectl: rewrite docstrings in several files
Fixing inaccuracies and clarifying in the case of ambiguities.
parent
d29560d8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
31 additions
and
20 deletions
+31
-20
cp.go
pkg/kubectl/cmd/cp.go
+8
-7
create.go
pkg/kubectl/cmd/create.go
+2
-2
create_deployment.go
pkg/kubectl/cmd/create_deployment.go
+3
-1
doc.go
pkg/kubectl/doc.go
+4
-3
generate.go
pkg/kubectl/generate.go
+3
-1
kubectl.go
pkg/kubectl/kubectl.go
+4
-1
proxy_server.go
pkg/kubectl/proxy_server.go
+2
-1
stop.go
pkg/kubectl/stop.go
+5
-4
No files found.
pkg/kubectl/cmd/cp.go
View file @
f9913c49
...
@@ -35,14 +35,15 @@ import (
...
@@ -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 (
...
@@ -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`
)
)
)
...
...
pkg/kubectl/cmd/create.go
View file @
f9913c49
...
@@ -40,7 +40,7 @@ type CreateOptions struct {
...
@@ -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 {
...
@@ -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
)
{
...
...
pkg/kubectl/cmd/create_deployment.go
View file @
f9913c49
...
@@ -38,7 +38,9 @@ var (
...
@@ -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]"
,
...
...
pkg/kubectl/doc.go
View file @
f9913c49
...
@@ -14,7 +14,8 @@ See the License for the specific language governing permissions and
...
@@ -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"
pkg/kubectl/generate.go
View file @
f9913c49
...
@@ -35,7 +35,9 @@ type GeneratorParam struct {
...
@@ -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
)
...
...
pkg/kubectl/kubectl.go
View file @
f9913c49
...
@@ -212,7 +212,10 @@ func parseFileSource(source string) (keyName, filePath string, err 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
{
...
...
pkg/kubectl/proxy_server.go
View file @
f9913c49
...
@@ -108,7 +108,8 @@ func (f *FilterServer) accept(method, path, host string) bool {
...
@@ -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
...
...
pkg/kubectl/stop.go
View file @
f9913c49
...
@@ -46,11 +46,12 @@ const (
...
@@ -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
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment