mirror of https://github.com/knative/client.git
fix: usage message of wait flag
This commit is contained in:
parent
e0cc636c24
commit
b97e2ca8ff
|
|
@ -44,7 +44,7 @@ kn service create NAME --image IMAGE [flags]
|
|||
```
|
||||
--annotation stringArray Service annotation to set. name=value; you may provide this flag any number of times to set multiple annotations. To unset, specify the annotation name followed by a "-" (e.g., name-).
|
||||
--arg stringArray Add argument to the container command. Example: --arg myArg1 --arg --myArg2 --arg myArg3=3. You can use this flag multiple times.
|
||||
--async DEPRECATED: please use --no-wait instead. Create service and don't wait for it to become ready.
|
||||
--async DEPRECATED: please use --no-wait instead. Create service and don't wait for it to be ready.
|
||||
--autoscale-window string Duration to look back for making auto-scaling decisions. The service is scaled to zero if no request was received in during that time. (eg: 10s)
|
||||
--cmd string Specify command to be used as entrypoint instead of default one. Example: --cmd /app/start or --cmd /app/start --arg myArg to pass aditional arguments.
|
||||
--concurrency-limit int Hard Limit of concurrent requests to be processed by a single replica.
|
||||
|
|
@ -63,7 +63,7 @@ kn service create NAME --image IMAGE [flags]
|
|||
--mount stringArray Mount a ConfigMap (prefix cm: or config-map:), a Secret (prefix secret: or sc:), or an existing Volume (without any prefix) on the specified directory. Example: --mount /mydir=cm:myconfigmap, --mount /mydir=secret:mysecret, or --mount /mydir=myvolume. When a configmap or a secret is specified, a corresponding volume is automatically generated. You can use this flag multiple times. For unmounting a directory, append "-", e.g. --mount /mydir-, which also removes any auto-generated volume.
|
||||
-n, --namespace string Specify the namespace to operate in.
|
||||
--no-lock-to-digest Do not keep the running image for the service constant when not explicitly specifying the image. (--no-lock-to-digest pulls the image tag afresh with each new revision)
|
||||
--no-wait Create service and don't wait for it to become ready.
|
||||
--no-wait Create service and don't wait for it to be ready.
|
||||
-p, --port int32 The port where application listens on.
|
||||
--pull-secret string Image pull secret to set. An empty argument ("") clears the pull secret. The referenced secret must exist in the service's namespace.
|
||||
--requests-cpu string The requested CPU (e.g., 250m).
|
||||
|
|
|
|||
|
|
@ -24,11 +24,11 @@ kn service delete NAME [flags]
|
|||
### Options
|
||||
|
||||
```
|
||||
--async DEPRECATED: please use --no-wait instead. Delete service and don't wait for it to become ready.
|
||||
--async DEPRECATED: please use --no-wait instead. Delete service and don't wait for it to be deleted.
|
||||
-h, --help help for delete
|
||||
-n, --namespace string Specify the namespace to operate in.
|
||||
--no-wait Delete service and don't wait for it to become ready.
|
||||
--wait-timeout int Seconds to wait before giving up on waiting for service to be ready. (default 600)
|
||||
--no-wait Delete service and don't wait for it to be deleted.
|
||||
--wait-timeout int Seconds to wait before giving up on waiting for service to be deleted. (default 600)
|
||||
```
|
||||
|
||||
### Options inherited from parent commands
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ kn service update NAME [flags]
|
|||
```
|
||||
--annotation stringArray Service annotation to set. name=value; you may provide this flag any number of times to set multiple annotations. To unset, specify the annotation name followed by a "-" (e.g., name-).
|
||||
--arg stringArray Add argument to the container command. Example: --arg myArg1 --arg --myArg2 --arg myArg3=3. You can use this flag multiple times.
|
||||
--async DEPRECATED: please use --no-wait instead. Update service and don't wait for it to become ready.
|
||||
--async DEPRECATED: please use --no-wait instead. Update service and don't wait for it to be ready.
|
||||
--autoscale-window string Duration to look back for making auto-scaling decisions. The service is scaled to zero if no request was received in during that time. (eg: 10s)
|
||||
--cmd string Specify command to be used as entrypoint instead of default one. Example: --cmd /app/start or --cmd /app/start --arg myArg to pass aditional arguments.
|
||||
--concurrency-limit int Hard Limit of concurrent requests to be processed by a single replica.
|
||||
|
|
@ -58,7 +58,7 @@ kn service update NAME [flags]
|
|||
--mount stringArray Mount a ConfigMap (prefix cm: or config-map:), a Secret (prefix secret: or sc:), or an existing Volume (without any prefix) on the specified directory. Example: --mount /mydir=cm:myconfigmap, --mount /mydir=secret:mysecret, or --mount /mydir=myvolume. When a configmap or a secret is specified, a corresponding volume is automatically generated. You can use this flag multiple times. For unmounting a directory, append "-", e.g. --mount /mydir-, which also removes any auto-generated volume.
|
||||
-n, --namespace string Specify the namespace to operate in.
|
||||
--no-lock-to-digest Do not keep the running image for the service constant when not explicitly specifying the image. (--no-lock-to-digest pulls the image tag afresh with each new revision)
|
||||
--no-wait Update service and don't wait for it to become ready.
|
||||
--no-wait Update service and don't wait for it to be ready.
|
||||
-p, --port int32 The port where application listens on.
|
||||
--pull-secret string Image pull secret to set. An empty argument ("") clears the pull secret. The referenced secret must exist in the service's namespace.
|
||||
--requests-cpu string The requested CPU (e.g., 250m).
|
||||
|
|
|
|||
|
|
@ -114,7 +114,7 @@ func NewServiceCreateCommand(p *commands.KnParams) *cobra.Command {
|
|||
}
|
||||
commands.AddNamespaceFlags(serviceCreateCommand.Flags(), false)
|
||||
editFlags.AddCreateFlags(serviceCreateCommand)
|
||||
waitFlags.AddConditionWaitFlags(serviceCreateCommand, commands.WaitDefaultTimeout, "Create", "service")
|
||||
waitFlags.AddConditionWaitFlags(serviceCreateCommand, commands.WaitDefaultTimeout, "Create", "service", "ready")
|
||||
return serviceCreateCommand
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -67,6 +67,6 @@ func NewServiceDeleteCommand(p *commands.KnParams) *cobra.Command {
|
|||
},
|
||||
}
|
||||
commands.AddNamespaceFlags(serviceDeleteCommand.Flags(), false)
|
||||
waitFlags.AddConditionWaitFlags(serviceDeleteCommand, commands.WaitDefaultTimeout, "Delete", "service")
|
||||
waitFlags.AddConditionWaitFlags(serviceDeleteCommand, commands.WaitDefaultTimeout, "Delete", "service", "deleted")
|
||||
return serviceDeleteCommand
|
||||
}
|
||||
|
|
|
|||
|
|
@ -136,7 +136,7 @@ func NewServiceUpdateCommand(p *commands.KnParams) *cobra.Command {
|
|||
|
||||
commands.AddNamespaceFlags(serviceUpdateCommand.Flags(), false)
|
||||
editFlags.AddUpdateFlags(serviceUpdateCommand)
|
||||
waitFlags.AddConditionWaitFlags(serviceUpdateCommand, commands.WaitDefaultTimeout, "Update", "service")
|
||||
waitFlags.AddConditionWaitFlags(serviceUpdateCommand, commands.WaitDefaultTimeout, "Update", "service", "ready")
|
||||
trafficFlags.Add(serviceUpdateCommand)
|
||||
return serviceUpdateCommand
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,12 +39,12 @@ type WaitFlags struct {
|
|||
// Add flags which influence the sync/async behaviour when creating or updating
|
||||
// resources. Set `waitDefault` argument if the default behaviour is synchronous.
|
||||
// Use `what` for describing what is waited for.
|
||||
func (p *WaitFlags) AddConditionWaitFlags(command *cobra.Command, waitTimeoutDefault int, action string, what string) {
|
||||
waitUsage := fmt.Sprintf("%s %s and don't wait for it to become ready.", action, what)
|
||||
func (p *WaitFlags) AddConditionWaitFlags(command *cobra.Command, waitTimeoutDefault int, action, what, until string) {
|
||||
waitUsage := fmt.Sprintf("%s %s and don't wait for it to be %s.", action, what, until)
|
||||
//TODO: deprecated flag should be removed in next release
|
||||
command.Flags().BoolVar(&p.Async, "async", false, "DEPRECATED: please use --no-wait instead. "+waitUsage)
|
||||
command.Flags().BoolVar(&p.NoWait, "no-wait", false, waitUsage)
|
||||
|
||||
timeoutUsage := fmt.Sprintf("Seconds to wait before giving up on waiting for %s to be ready.", what)
|
||||
timeoutUsage := fmt.Sprintf("Seconds to wait before giving up on waiting for %s to be %s.", what, until)
|
||||
command.Flags().IntVar(&p.TimeoutInSeconds, "wait-timeout", waitTimeoutDefault, timeoutUsage)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ func TestAddWaitForReadyDeprecatedFlags(t *testing.T) {
|
|||
|
||||
flags := &WaitFlags{}
|
||||
cmd := cobra.Command{}
|
||||
flags.AddConditionWaitFlags(&cmd, 60, "Create", "service")
|
||||
flags.AddConditionWaitFlags(&cmd, 60, "Create", "service", "ready")
|
||||
|
||||
err := cmd.ParseFlags(tc.args)
|
||||
if err != nil && !tc.isParseErrorExpected {
|
||||
|
|
@ -76,7 +76,7 @@ func TestAddWaitForReadyFlags(t *testing.T) {
|
|||
|
||||
flags := &WaitFlags{}
|
||||
cmd := cobra.Command{}
|
||||
flags.AddConditionWaitFlags(&cmd, 60, "Create", "service")
|
||||
flags.AddConditionWaitFlags(&cmd, 60, "Create", "service", "ready")
|
||||
|
||||
err := cmd.ParseFlags(tc.args)
|
||||
if err != nil && !tc.isParseErrorExpected {
|
||||
|
|
@ -101,7 +101,7 @@ func TestAddWaitUsageMessage(t *testing.T) {
|
|||
|
||||
flags := &WaitFlags{}
|
||||
cmd := cobra.Command{}
|
||||
flags.AddConditionWaitFlags(&cmd, 60, "bla", "blub")
|
||||
flags.AddConditionWaitFlags(&cmd, 60, "bla", "blub", "deleted")
|
||||
if !strings.Contains(cmd.UsageString(), "blub") {
|
||||
t.Error("no type returned in usage")
|
||||
}
|
||||
|
|
@ -111,4 +111,7 @@ func TestAddWaitUsageMessage(t *testing.T) {
|
|||
if !strings.Contains(cmd.UsageString(), "60") {
|
||||
t.Error("default timeout not contained")
|
||||
}
|
||||
if !strings.Contains(cmd.UsageString(), "deleted") {
|
||||
t.Error("wrong until message")
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue