Skip to content

Commit a3615ce

Browse files
committed
document the "create" option to the "kubeclt wait" command.
Signed-off-by: Ryan Winter <[email protected]>
1 parent e35bd86 commit a3615ce

File tree

1 file changed

+10
-6
lines changed
  • staging/src/k8s.io/kubectl/pkg/cmd/wait

1 file changed

+10
-6
lines changed

staging/src/k8s.io/kubectl/pkg/cmd/wait/wait.go

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ var (
5151
The command takes multiple resources and waits until the specified condition
5252
is seen in the Status field of every given resource.
5353
54-
Alternatively, the command can wait for the given set of resources to be deleted
55-
by providing the "delete" keyword as the value to the --for flag.
54+
Alternatively, the command can wait for the given set of resources to be created or
55+
deleted by providing the "create" or "delete" keyword as the value to the --for flag.
5656
5757
A successful message will be printed to stdout indicating when the specified
5858
condition has been met. You can use -o option to change to output destination.`))
@@ -73,6 +73,10 @@ var (
7373
# Wait for the service "loadbalancer" to have ingress
7474
kubectl wait --for=jsonpath='{.status.loadBalancer.ingress}' service/loadbalancer
7575
76+
# Wait for the secret "busybox1" to be created, with a timeout of 30s
77+
kubectl create secret generic busybox1
78+
kubectl wait --for=create secret/busybox1 --timeout=30s
79+
7680
# Wait for the pod "busybox1" to be deleted, with a timeout of 60s, after having issued the "delete" command
7781
kubectl delete pod/busybox1
7882
kubectl wait --for=delete pod/busybox1 --timeout=60s`))
@@ -119,7 +123,7 @@ func NewCmdWait(restClientGetter genericclioptions.RESTClientGetter, streams gen
119123
flags := NewWaitFlags(restClientGetter, streams)
120124

121125
cmd := &cobra.Command{
122-
Use: "wait ([-f FILENAME] | resource.group/resource.name | resource.group [(-l label | --all)]) [--for=delete|--for condition=available|--for=jsonpath='{}'[=value]]",
126+
Use: "wait ([-f FILENAME] | resource.group/resource.name | resource.group [(-l label | --all)]) [--for=create|--for=delete|--for condition=available|--for=jsonpath='{}'[=value]]",
123127
Short: i18n.T("Experimental: Wait for a specific condition on one or many resources"),
124128
Long: waitLong,
125129
Example: waitExample,
@@ -143,8 +147,8 @@ func (flags *WaitFlags) AddFlags(cmd *cobra.Command) {
143147
flags.PrintFlags.AddFlags(cmd)
144148
flags.ResourceBuilderFlags.AddFlags(cmd.Flags())
145149

146-
cmd.Flags().DurationVar(&flags.Timeout, "timeout", flags.Timeout, "The length of time to wait before giving up. Zero means check once and don't wait, negative means wait for a week.")
147-
cmd.Flags().StringVar(&flags.ForCondition, "for", flags.ForCondition, "The condition to wait on: [delete|condition=condition-name[=condition-value]|jsonpath='{JSONPath expression}'=[JSONPath value]]. The default condition-value is true. Condition values are compared after Unicode simple case folding, which is a more general form of case-insensitivity.")
150+
cmd.Flags().DurationVar(&flags.Timeout, "timeout", flags.Timeout, "The length of time to wait before giving up. Zero means check once and don't wait, negative means wait for a week.")
151+
cmd.Flags().StringVar(&flags.ForCondition, "for", flags.ForCondition, "The condition to wait on: [create|delete|condition=condition-name[=condition-value]|jsonpath='{JSONPath expression}'=[JSONPath value]]. The default condition-value is true. Condition values are compared after Unicode simple case folding, which is a more general form of case-insensitivity.")
148152
}
149153

150154
// ToOptions converts from CLI inputs to runtime inputs
@@ -356,7 +360,7 @@ func (o *WaitOptions) RunWait() error {
356360
return nil
357361
}
358362
if err == nil {
359-
return fmt.Errorf("%v unsatisified for unknown reason", finalObject)
363+
return fmt.Errorf("%v unsatisfied for unknown reason", finalObject)
360364
}
361365
return err
362366
}

0 commit comments

Comments
 (0)