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
54ddddaa
Unverified
Commit
54ddddaa
authored
Jun 27, 2018
by
juanvallejo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add help description and examples to wait
parent
c005b9d0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
1 deletion
+27
-1
BUILD
pkg/kubectl/cmd/wait/BUILD
+1
-0
wait.go
pkg/kubectl/cmd/wait/wait.go
+26
-1
No files found.
pkg/kubectl/cmd/wait/BUILD
View file @
54ddddaa
...
...
@@ -6,6 +6,7 @@ go_library(
importpath = "k8s.io/kubernetes/pkg/kubectl/cmd/wait",
visibility = ["//visibility:public"],
deps = [
"//pkg/kubectl/cmd/templates:go_default_library",
"//pkg/kubectl/cmd/util:go_default_library",
"//pkg/kubectl/genericclioptions:go_default_library",
"//pkg/kubectl/genericclioptions/printers:go_default_library",
...
...
pkg/kubectl/cmd/wait/wait.go
View file @
54ddddaa
...
...
@@ -30,12 +30,35 @@ import (
"k8s.io/apimachinery/pkg/util/wait"
"k8s.io/apimachinery/pkg/watch"
"k8s.io/client-go/dynamic"
"k8s.io/kubernetes/pkg/kubectl/cmd/templates"
cmdutil
"k8s.io/kubernetes/pkg/kubectl/cmd/util"
"k8s.io/kubernetes/pkg/kubectl/genericclioptions"
"k8s.io/kubernetes/pkg/kubectl/genericclioptions/printers"
"k8s.io/kubernetes/pkg/kubectl/genericclioptions/resource"
)
var
(
wait_long
=
templates
.
LongDesc
(
`
Experimental: Wait for a specific condition on one or many resources.
The command takes multiple resources and waits until the specified condition
is seen in the Status field of every given resource.
Alternatively, the command can wait for the given set of resources to be deleted
by providing the "delete" keyword as the value to the --for flag.
A successful message will be printed to stdout indicating when the specified
condition has been met. One can use -o option to change to output destination.`
)
wait_example
=
templates
.
Examples
(
`
# Wait for the pod "busybox1" to contain the status condition of type "Ready".
kubectl wait --for=condition=Ready pod/busybox1
# Wait for the pod "busybox1" to be deleted, with a timeout of 60s, after having issued the "delete" command.
kubectl delete pod/busybox1
kubectl wait --for=delete pod/busybox1 --timeout=60s`
)
)
// WaitFlags directly reflect the information that CLI is gathering via flags. They will be converted to Options, which
// reflect the runtime requirements for the command. This structure reduces the transformation to wiring and makes
// the logic itself easy to unit test
...
...
@@ -73,7 +96,9 @@ func NewCmdWait(restClientGetter genericclioptions.RESTClientGetter, streams gen
cmd
:=
&
cobra
.
Command
{
Use
:
"wait resource.group/name [--for=delete|--for condition=available]"
,
DisableFlagsInUseLine
:
true
,
Short
:
"Experimental: Wait for one condition on one or many resources"
,
Short
:
"Experimental: Wait for a specific condition on one or many resources."
,
Long
:
wait_long
,
Example
:
wait_example
,
Run
:
func
(
cmd
*
cobra
.
Command
,
args
[]
string
)
{
o
,
err
:=
flags
.
ToOptions
(
args
)
cmdutil
.
CheckErr
(
err
)
...
...
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