mirror of https://github.com/knative/client.git
Rename `--extra-containers` to `--containers` (#1499)
and make `--extra-containers deprecated`
This commit is contained in:
parent
d8d0ee1e6e
commit
db3bcbc6b0
|
|
@ -22,7 +22,7 @@ kn container add NAME
|
||||||
# Add command can be chained by standard Unix pipe symbol '|' and passed to 'service add|update|apply' commands
|
# Add command can be chained by standard Unix pipe symbol '|' and passed to 'service add|update|apply' commands
|
||||||
kn container add sidecar --image docker.io/example/sidecar:first | \
|
kn container add sidecar --image docker.io/example/sidecar:first | \
|
||||||
kn container add second --image docker.io/example/sidecar:second | \
|
kn container add second --image docker.io/example/sidecar:second | \
|
||||||
kn service create myksvc --image docker.io/example/my-app:latest --extra-containers -
|
kn service create myksvc --image docker.io/example/my-app:latest --containers -
|
||||||
```
|
```
|
||||||
|
|
||||||
### Options
|
### Options
|
||||||
|
|
@ -30,11 +30,12 @@ kn container add NAME
|
||||||
```
|
```
|
||||||
--arg stringArray Add argument to the container command. Example: --arg myArg1 --arg --myArg2 --arg myArg3=3. You can use this flag multiple times.
|
--arg stringArray Add argument to the container command. Example: --arg myArg1 --arg --myArg2 --arg myArg3=3. You can use this flag multiple times.
|
||||||
--cmd stringArray Specify command to be used as entrypoint instead of default one. Example: --cmd /app/start or --cmd sh --cmd /app/start.sh or --cmd /app/start --arg myArg to pass additional arguments.
|
--cmd stringArray Specify command to be used as entrypoint instead of default one. Example: --cmd /app/start or --cmd sh --cmd /app/start.sh or --cmd /app/start --arg myArg to pass additional arguments.
|
||||||
|
--containers string Specify path to file including definition for additional containers, alternatively use '-' to read from stdin. Example: --containers ./containers.yaml or --containers -.
|
||||||
-e, --env stringArray Environment variable to set. NAME=value; you may provide this flag any number of times to set multiple environment variables. To unset, specify the environment variable name followed by a "-" (e.g., NAME-).
|
-e, --env stringArray Environment variable to set. NAME=value; you may provide this flag any number of times to set multiple environment variables. To unset, specify the environment variable name followed by a "-" (e.g., NAME-).
|
||||||
--env-file string Path to a file containing environment variables (e.g. --env-file=/home/knative/service1/env).
|
--env-file string Path to a file containing environment variables (e.g. --env-file=/home/knative/service1/env).
|
||||||
--env-from stringArray Add environment variables from a ConfigMap (prefix cm: or config-map:) or a Secret (prefix secret:). Example: --env-from cm:myconfigmap or --env-from secret:mysecret. You can use this flag multiple times. To unset a ConfigMap/Secret reference, append "-" to the name, e.g. --env-from cm:myconfigmap-.
|
--env-from stringArray Add environment variables from a ConfigMap (prefix cm: or config-map:) or a Secret (prefix secret:). Example: --env-from cm:myconfigmap or --env-from secret:mysecret. You can use this flag multiple times. To unset a ConfigMap/Secret reference, append "-" to the name, e.g. --env-from cm:myconfigmap-.
|
||||||
--env-value-from stringArray Add environment variable from a value of key in ConfigMap (prefix cm: or config-map:) or a Secret (prefix sc: or secret:). Example: --env-value-from NAME=cm:myconfigmap:key or --env-value-from NAME=secret:mysecret:key. You can use this flag multiple times. To unset a value from a ConfigMap/Secret key reference, append "-" to the key, e.g. --env-value-from ENV-.
|
--env-value-from stringArray Add environment variable from a value of key in ConfigMap (prefix cm: or config-map:) or a Secret (prefix sc: or secret:). Example: --env-value-from NAME=cm:myconfigmap:key or --env-value-from NAME=secret:mysecret:key. You can use this flag multiple times. To unset a value from a ConfigMap/Secret key reference, append "-" to the key, e.g. --env-value-from ENV-.
|
||||||
--extra-containers string Specify path to file including definition for additional containers, alternatively use '-' to read from stdin. Example: --extra-containers ./containers.yaml or --extra-containers -.
|
--extra-containers string Deprecated, use --containers instead.
|
||||||
-h, --help help for add
|
-h, --help help for add
|
||||||
--image string Image to run.
|
--image string Image to run.
|
||||||
--limit strings The resource requirement limits for this Service. For example, 'cpu=100m,memory=256Mi'. You can use this flag multiple times. To unset a resource limit, append "-" to the resource name, e.g. '--limit memory-'.
|
--limit strings The resource requirement limits for this Service. For example, 'cpu=100m,memory=256Mi'. You can use this flag multiple times. To unset a resource limit, append "-" to the resource name, e.g. '--limit memory-'.
|
||||||
|
|
|
||||||
|
|
@ -39,11 +39,12 @@ kn service apply s0 --filename my-svc.yml
|
||||||
--concurrency-limit int Hard Limit of concurrent requests to be processed by a single replica.
|
--concurrency-limit int Hard Limit of concurrent requests to be processed by a single replica.
|
||||||
--concurrency-target int Deprecated, use --scale-target instead.
|
--concurrency-target int Deprecated, use --scale-target instead.
|
||||||
--concurrency-utilization int Deprecated, use --scale-utilization instead. (default 70)
|
--concurrency-utilization int Deprecated, use --scale-utilization instead. (default 70)
|
||||||
|
--containers string Specify path to file including definition for additional containers, alternatively use '-' to read from stdin. Example: --containers ./containers.yaml or --containers -.
|
||||||
-e, --env stringArray Environment variable to set. NAME=value; you may provide this flag any number of times to set multiple environment variables. To unset, specify the environment variable name followed by a "-" (e.g., NAME-).
|
-e, --env stringArray Environment variable to set. NAME=value; you may provide this flag any number of times to set multiple environment variables. To unset, specify the environment variable name followed by a "-" (e.g., NAME-).
|
||||||
--env-file string Path to a file containing environment variables (e.g. --env-file=/home/knative/service1/env).
|
--env-file string Path to a file containing environment variables (e.g. --env-file=/home/knative/service1/env).
|
||||||
--env-from stringArray Add environment variables from a ConfigMap (prefix cm: or config-map:) or a Secret (prefix secret:). Example: --env-from cm:myconfigmap or --env-from secret:mysecret. You can use this flag multiple times. To unset a ConfigMap/Secret reference, append "-" to the name, e.g. --env-from cm:myconfigmap-.
|
--env-from stringArray Add environment variables from a ConfigMap (prefix cm: or config-map:) or a Secret (prefix secret:). Example: --env-from cm:myconfigmap or --env-from secret:mysecret. You can use this flag multiple times. To unset a ConfigMap/Secret reference, append "-" to the name, e.g. --env-from cm:myconfigmap-.
|
||||||
--env-value-from stringArray Add environment variable from a value of key in ConfigMap (prefix cm: or config-map:) or a Secret (prefix sc: or secret:). Example: --env-value-from NAME=cm:myconfigmap:key or --env-value-from NAME=secret:mysecret:key. You can use this flag multiple times. To unset a value from a ConfigMap/Secret key reference, append "-" to the key, e.g. --env-value-from ENV-.
|
--env-value-from stringArray Add environment variable from a value of key in ConfigMap (prefix cm: or config-map:) or a Secret (prefix sc: or secret:). Example: --env-value-from NAME=cm:myconfigmap:key or --env-value-from NAME=secret:mysecret:key. You can use this flag multiple times. To unset a value from a ConfigMap/Secret key reference, append "-" to the key, e.g. --env-value-from ENV-.
|
||||||
--extra-containers string Specify path to file including definition for additional containers, alternatively use '-' to read from stdin. Example: --extra-containers ./containers.yaml or --extra-containers -.
|
--extra-containers string Deprecated, use --containers instead.
|
||||||
-f, --filename string Create a service from file. The created service can be further modified by combining with other options. For example, -f /path/to/file --env NAME=value adds also an environment variable.
|
-f, --filename string Create a service from file. The created service can be further modified by combining with other options. For example, -f /path/to/file --env NAME=value adds also an environment variable.
|
||||||
--force Create service forcefully, replaces existing service if any.
|
--force Create service forcefully, replaces existing service if any.
|
||||||
-h, --help help for apply
|
-h, --help help for apply
|
||||||
|
|
|
||||||
|
|
@ -64,11 +64,12 @@ kn service create NAME --image IMAGE
|
||||||
--concurrency-limit int Hard Limit of concurrent requests to be processed by a single replica.
|
--concurrency-limit int Hard Limit of concurrent requests to be processed by a single replica.
|
||||||
--concurrency-target int Deprecated, use --scale-target instead.
|
--concurrency-target int Deprecated, use --scale-target instead.
|
||||||
--concurrency-utilization int Deprecated, use --scale-utilization instead. (default 70)
|
--concurrency-utilization int Deprecated, use --scale-utilization instead. (default 70)
|
||||||
|
--containers string Specify path to file including definition for additional containers, alternatively use '-' to read from stdin. Example: --containers ./containers.yaml or --containers -.
|
||||||
-e, --env stringArray Environment variable to set. NAME=value; you may provide this flag any number of times to set multiple environment variables. To unset, specify the environment variable name followed by a "-" (e.g., NAME-).
|
-e, --env stringArray Environment variable to set. NAME=value; you may provide this flag any number of times to set multiple environment variables. To unset, specify the environment variable name followed by a "-" (e.g., NAME-).
|
||||||
--env-file string Path to a file containing environment variables (e.g. --env-file=/home/knative/service1/env).
|
--env-file string Path to a file containing environment variables (e.g. --env-file=/home/knative/service1/env).
|
||||||
--env-from stringArray Add environment variables from a ConfigMap (prefix cm: or config-map:) or a Secret (prefix secret:). Example: --env-from cm:myconfigmap or --env-from secret:mysecret. You can use this flag multiple times. To unset a ConfigMap/Secret reference, append "-" to the name, e.g. --env-from cm:myconfigmap-.
|
--env-from stringArray Add environment variables from a ConfigMap (prefix cm: or config-map:) or a Secret (prefix secret:). Example: --env-from cm:myconfigmap or --env-from secret:mysecret. You can use this flag multiple times. To unset a ConfigMap/Secret reference, append "-" to the name, e.g. --env-from cm:myconfigmap-.
|
||||||
--env-value-from stringArray Add environment variable from a value of key in ConfigMap (prefix cm: or config-map:) or a Secret (prefix sc: or secret:). Example: --env-value-from NAME=cm:myconfigmap:key or --env-value-from NAME=secret:mysecret:key. You can use this flag multiple times. To unset a value from a ConfigMap/Secret key reference, append "-" to the key, e.g. --env-value-from ENV-.
|
--env-value-from stringArray Add environment variable from a value of key in ConfigMap (prefix cm: or config-map:) or a Secret (prefix sc: or secret:). Example: --env-value-from NAME=cm:myconfigmap:key or --env-value-from NAME=secret:mysecret:key. You can use this flag multiple times. To unset a value from a ConfigMap/Secret key reference, append "-" to the key, e.g. --env-value-from ENV-.
|
||||||
--extra-containers string Specify path to file including definition for additional containers, alternatively use '-' to read from stdin. Example: --extra-containers ./containers.yaml or --extra-containers -.
|
--extra-containers string Deprecated, use --containers instead.
|
||||||
-f, --filename string Create a service from file. The created service can be further modified by combining with other options. For example, -f /path/to/file --env NAME=value adds also an environment variable.
|
-f, --filename string Create a service from file. The created service can be further modified by combining with other options. For example, -f /path/to/file --env NAME=value adds also an environment variable.
|
||||||
--force Create service forcefully, replaces existing service if any.
|
--force Create service forcefully, replaces existing service if any.
|
||||||
-h, --help help for create
|
-h, --help help for create
|
||||||
|
|
|
||||||
|
|
@ -53,11 +53,12 @@ kn service update NAME
|
||||||
--concurrency-limit int Hard Limit of concurrent requests to be processed by a single replica.
|
--concurrency-limit int Hard Limit of concurrent requests to be processed by a single replica.
|
||||||
--concurrency-target int Deprecated, use --scale-target instead.
|
--concurrency-target int Deprecated, use --scale-target instead.
|
||||||
--concurrency-utilization int Deprecated, use --scale-utilization instead. (default 70)
|
--concurrency-utilization int Deprecated, use --scale-utilization instead. (default 70)
|
||||||
|
--containers string Specify path to file including definition for additional containers, alternatively use '-' to read from stdin. Example: --containers ./containers.yaml or --containers -.
|
||||||
-e, --env stringArray Environment variable to set. NAME=value; you may provide this flag any number of times to set multiple environment variables. To unset, specify the environment variable name followed by a "-" (e.g., NAME-).
|
-e, --env stringArray Environment variable to set. NAME=value; you may provide this flag any number of times to set multiple environment variables. To unset, specify the environment variable name followed by a "-" (e.g., NAME-).
|
||||||
--env-file string Path to a file containing environment variables (e.g. --env-file=/home/knative/service1/env).
|
--env-file string Path to a file containing environment variables (e.g. --env-file=/home/knative/service1/env).
|
||||||
--env-from stringArray Add environment variables from a ConfigMap (prefix cm: or config-map:) or a Secret (prefix secret:). Example: --env-from cm:myconfigmap or --env-from secret:mysecret. You can use this flag multiple times. To unset a ConfigMap/Secret reference, append "-" to the name, e.g. --env-from cm:myconfigmap-.
|
--env-from stringArray Add environment variables from a ConfigMap (prefix cm: or config-map:) or a Secret (prefix secret:). Example: --env-from cm:myconfigmap or --env-from secret:mysecret. You can use this flag multiple times. To unset a ConfigMap/Secret reference, append "-" to the name, e.g. --env-from cm:myconfigmap-.
|
||||||
--env-value-from stringArray Add environment variable from a value of key in ConfigMap (prefix cm: or config-map:) or a Secret (prefix sc: or secret:). Example: --env-value-from NAME=cm:myconfigmap:key or --env-value-from NAME=secret:mysecret:key. You can use this flag multiple times. To unset a value from a ConfigMap/Secret key reference, append "-" to the key, e.g. --env-value-from ENV-.
|
--env-value-from stringArray Add environment variable from a value of key in ConfigMap (prefix cm: or config-map:) or a Secret (prefix sc: or secret:). Example: --env-value-from NAME=cm:myconfigmap:key or --env-value-from NAME=secret:mysecret:key. You can use this flag multiple times. To unset a value from a ConfigMap/Secret key reference, append "-" to the key, e.g. --env-value-from ENV-.
|
||||||
--extra-containers string Specify path to file including definition for additional containers, alternatively use '-' to read from stdin. Example: --extra-containers ./containers.yaml or --extra-containers -.
|
--extra-containers string Deprecated, use --containers instead.
|
||||||
-h, --help help for update
|
-h, --help help for update
|
||||||
--image string Image to run.
|
--image string Image to run.
|
||||||
-l, --label stringArray Labels to set for both Service and Revision. name=value; you may provide this flag any number of times to set multiple labels. To unset, specify the label name followed by a "-" (e.g., name-).
|
-l, --label stringArray Labels to set for both Service and Revision. name=value; you may provide this flag any number of times to set multiple labels. To unset, specify the label name followed by a "-" (e.g., name-).
|
||||||
|
|
|
||||||
|
|
@ -19,11 +19,12 @@ kn source container create NAME --image IMAGE --sink SINK
|
||||||
```
|
```
|
||||||
--arg stringArray Add argument to the container command. Example: --arg myArg1 --arg --myArg2 --arg myArg3=3. You can use this flag multiple times.
|
--arg stringArray Add argument to the container command. Example: --arg myArg1 --arg --myArg2 --arg myArg3=3. You can use this flag multiple times.
|
||||||
--cmd stringArray Specify command to be used as entrypoint instead of default one. Example: --cmd /app/start or --cmd sh --cmd /app/start.sh or --cmd /app/start --arg myArg to pass additional arguments.
|
--cmd stringArray Specify command to be used as entrypoint instead of default one. Example: --cmd /app/start or --cmd sh --cmd /app/start.sh or --cmd /app/start --arg myArg to pass additional arguments.
|
||||||
|
--containers string Specify path to file including definition for additional containers, alternatively use '-' to read from stdin. Example: --containers ./containers.yaml or --containers -.
|
||||||
-e, --env stringArray Environment variable to set. NAME=value; you may provide this flag any number of times to set multiple environment variables. To unset, specify the environment variable name followed by a "-" (e.g., NAME-).
|
-e, --env stringArray Environment variable to set. NAME=value; you may provide this flag any number of times to set multiple environment variables. To unset, specify the environment variable name followed by a "-" (e.g., NAME-).
|
||||||
--env-file string Path to a file containing environment variables (e.g. --env-file=/home/knative/service1/env).
|
--env-file string Path to a file containing environment variables (e.g. --env-file=/home/knative/service1/env).
|
||||||
--env-from stringArray Add environment variables from a ConfigMap (prefix cm: or config-map:) or a Secret (prefix secret:). Example: --env-from cm:myconfigmap or --env-from secret:mysecret. You can use this flag multiple times. To unset a ConfigMap/Secret reference, append "-" to the name, e.g. --env-from cm:myconfigmap-.
|
--env-from stringArray Add environment variables from a ConfigMap (prefix cm: or config-map:) or a Secret (prefix secret:). Example: --env-from cm:myconfigmap or --env-from secret:mysecret. You can use this flag multiple times. To unset a ConfigMap/Secret reference, append "-" to the name, e.g. --env-from cm:myconfigmap-.
|
||||||
--env-value-from stringArray Add environment variable from a value of key in ConfigMap (prefix cm: or config-map:) or a Secret (prefix sc: or secret:). Example: --env-value-from NAME=cm:myconfigmap:key or --env-value-from NAME=secret:mysecret:key. You can use this flag multiple times. To unset a value from a ConfigMap/Secret key reference, append "-" to the key, e.g. --env-value-from ENV-.
|
--env-value-from stringArray Add environment variable from a value of key in ConfigMap (prefix cm: or config-map:) or a Secret (prefix sc: or secret:). Example: --env-value-from NAME=cm:myconfigmap:key or --env-value-from NAME=secret:mysecret:key. You can use this flag multiple times. To unset a value from a ConfigMap/Secret key reference, append "-" to the key, e.g. --env-value-from ENV-.
|
||||||
--extra-containers string Specify path to file including definition for additional containers, alternatively use '-' to read from stdin. Example: --extra-containers ./containers.yaml or --extra-containers -.
|
--extra-containers string Deprecated, use --containers instead.
|
||||||
-h, --help help for create
|
-h, --help help for create
|
||||||
--image string Image to run.
|
--image string Image to run.
|
||||||
--limit strings The resource requirement limits for this Service. For example, 'cpu=100m,memory=256Mi'. You can use this flag multiple times. To unset a resource limit, append "-" to the resource name, e.g. '--limit memory-'.
|
--limit strings The resource requirement limits for this Service. For example, 'cpu=100m,memory=256Mi'. You can use this flag multiple times. To unset a resource limit, append "-" to the resource name, e.g. '--limit memory-'.
|
||||||
|
|
|
||||||
|
|
@ -19,11 +19,12 @@ kn source container update NAME --image IMAGE
|
||||||
```
|
```
|
||||||
--arg stringArray Add argument to the container command. Example: --arg myArg1 --arg --myArg2 --arg myArg3=3. You can use this flag multiple times.
|
--arg stringArray Add argument to the container command. Example: --arg myArg1 --arg --myArg2 --arg myArg3=3. You can use this flag multiple times.
|
||||||
--cmd stringArray Specify command to be used as entrypoint instead of default one. Example: --cmd /app/start or --cmd sh --cmd /app/start.sh or --cmd /app/start --arg myArg to pass additional arguments.
|
--cmd stringArray Specify command to be used as entrypoint instead of default one. Example: --cmd /app/start or --cmd sh --cmd /app/start.sh or --cmd /app/start --arg myArg to pass additional arguments.
|
||||||
|
--containers string Specify path to file including definition for additional containers, alternatively use '-' to read from stdin. Example: --containers ./containers.yaml or --containers -.
|
||||||
-e, --env stringArray Environment variable to set. NAME=value; you may provide this flag any number of times to set multiple environment variables. To unset, specify the environment variable name followed by a "-" (e.g., NAME-).
|
-e, --env stringArray Environment variable to set. NAME=value; you may provide this flag any number of times to set multiple environment variables. To unset, specify the environment variable name followed by a "-" (e.g., NAME-).
|
||||||
--env-file string Path to a file containing environment variables (e.g. --env-file=/home/knative/service1/env).
|
--env-file string Path to a file containing environment variables (e.g. --env-file=/home/knative/service1/env).
|
||||||
--env-from stringArray Add environment variables from a ConfigMap (prefix cm: or config-map:) or a Secret (prefix secret:). Example: --env-from cm:myconfigmap or --env-from secret:mysecret. You can use this flag multiple times. To unset a ConfigMap/Secret reference, append "-" to the name, e.g. --env-from cm:myconfigmap-.
|
--env-from stringArray Add environment variables from a ConfigMap (prefix cm: or config-map:) or a Secret (prefix secret:). Example: --env-from cm:myconfigmap or --env-from secret:mysecret. You can use this flag multiple times. To unset a ConfigMap/Secret reference, append "-" to the name, e.g. --env-from cm:myconfigmap-.
|
||||||
--env-value-from stringArray Add environment variable from a value of key in ConfigMap (prefix cm: or config-map:) or a Secret (prefix sc: or secret:). Example: --env-value-from NAME=cm:myconfigmap:key or --env-value-from NAME=secret:mysecret:key. You can use this flag multiple times. To unset a value from a ConfigMap/Secret key reference, append "-" to the key, e.g. --env-value-from ENV-.
|
--env-value-from stringArray Add environment variable from a value of key in ConfigMap (prefix cm: or config-map:) or a Secret (prefix sc: or secret:). Example: --env-value-from NAME=cm:myconfigmap:key or --env-value-from NAME=secret:mysecret:key. You can use this flag multiple times. To unset a value from a ConfigMap/Secret key reference, append "-" to the key, e.g. --env-value-from ENV-.
|
||||||
--extra-containers string Specify path to file including definition for additional containers, alternatively use '-' to read from stdin. Example: --extra-containers ./containers.yaml or --extra-containers -.
|
--extra-containers string Deprecated, use --containers instead.
|
||||||
-h, --help help for update
|
-h, --help help for update
|
||||||
--image string Image to run.
|
--image string Image to run.
|
||||||
--limit strings The resource requirement limits for this Service. For example, 'cpu=100m,memory=256Mi'. You can use this flag multiple times. To unset a resource limit, append "-" to the resource name, e.g. '--limit memory-'.
|
--limit strings The resource requirement limits for this Service. For example, 'cpu=100m,memory=256Mi'. You can use this flag multiple times. To unset a resource limit, append "-" to the resource name, e.g. '--limit memory-'.
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ func NewContainerAddCommand(p *commands.KnParams) *cobra.Command {
|
||||||
# Add command can be chained by standard Unix pipe symbol '|' and passed to 'service add|update|apply' commands
|
# Add command can be chained by standard Unix pipe symbol '|' and passed to 'service add|update|apply' commands
|
||||||
kn container add sidecar --image docker.io/example/sidecar:first | \
|
kn container add sidecar --image docker.io/example/sidecar:first | \
|
||||||
kn container add second --image docker.io/example/sidecar:second | \
|
kn container add second --image docker.io/example/sidecar:second | \
|
||||||
kn service create myksvc --image docker.io/example/my-app:latest --extra-containers -`,
|
kn service create myksvc --image docker.io/example/my-app:latest --containers -`,
|
||||||
RunE: func(cmd *cobra.Command, args []string) (err error) {
|
RunE: func(cmd *cobra.Command, args []string) (err error) {
|
||||||
if len(args) != 1 {
|
if len(args) != 1 {
|
||||||
return errors.New("'container add' requires the container name given as single argument")
|
return errors.New("'container add' requires the container name given as single argument")
|
||||||
|
|
|
||||||
|
|
@ -37,21 +37,24 @@ containers:
|
||||||
name: bar
|
name: bar
|
||||||
resources: {}`
|
resources: {}`
|
||||||
|
|
||||||
stdinReader, stdinWriter, err := os.Pipe()
|
|
||||||
assert.NilError(t, err)
|
|
||||||
stdinWriter.Chmod(os.ModeCharDevice)
|
|
||||||
_, err = stdinWriter.Write([]byte(rawInput))
|
|
||||||
assert.NilError(t, err)
|
|
||||||
stdinWriter.Close()
|
|
||||||
|
|
||||||
origStdin := os.Stdin
|
origStdin := os.Stdin
|
||||||
os.Stdin = stdinReader
|
|
||||||
defer func() { os.Stdin = origStdin }()
|
defer func() { os.Stdin = origStdin }()
|
||||||
|
|
||||||
output, err := executeContainerCommand("add", "foo", "--image", "registry.foo:bar", "--extra-containers", "-")
|
for _, command := range []string{"containers", "extra-containers"} {
|
||||||
assert.NilError(t, err)
|
stdinReader, stdinWriter, err := os.Pipe()
|
||||||
assert.Assert(t, len(output) > 0)
|
assert.NilError(t, err)
|
||||||
assert.Assert(t, util.ContainsAllIgnoreCase(output, "containers", "image", "foo", "registry.foo:bar", "bar", "bar:bar"))
|
stdinWriter.Chmod(os.ModeCharDevice)
|
||||||
|
_, err = stdinWriter.Write([]byte(rawInput))
|
||||||
|
assert.NilError(t, err)
|
||||||
|
stdinWriter.Close()
|
||||||
|
|
||||||
|
os.Stdin = stdinReader
|
||||||
|
|
||||||
|
output, err := executeContainerCommand("add", "foo", "--image", "registry.foo:bar", "--"+command, "-")
|
||||||
|
assert.NilError(t, err)
|
||||||
|
assert.Assert(t, len(output) > 0)
|
||||||
|
assert.Assert(t, util.ContainsAllIgnoreCase(output, "containers", "image", "foo", "registry.foo:bar", "bar", "bar:bar"))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestContainerAddError(t *testing.T) {
|
func TestContainerAddError(t *testing.T) {
|
||||||
|
|
|
||||||
|
|
@ -129,9 +129,14 @@ func (p *PodSpecFlags) AddFlags(flagset *pflag.FlagSet) []string {
|
||||||
"You can use this flag multiple times.")
|
"You can use this flag multiple times.")
|
||||||
flagNames = append(flagNames, "arg")
|
flagNames = append(flagNames, "arg")
|
||||||
|
|
||||||
|
// DEPRECATED since 1.0
|
||||||
flagset.StringVarP(&p.ExtraContainers, "extra-containers", "", "",
|
flagset.StringVarP(&p.ExtraContainers, "extra-containers", "", "",
|
||||||
|
"Deprecated, use --containers instead.")
|
||||||
|
flagNames = append(flagNames, "containers")
|
||||||
|
|
||||||
|
flagset.StringVarP(&p.ExtraContainers, "containers", "", "",
|
||||||
"Specify path to file including definition for additional containers, alternatively use '-' to read from stdin. "+
|
"Specify path to file including definition for additional containers, alternatively use '-' to read from stdin. "+
|
||||||
"Example: --extra-containers ./containers.yaml or --extra-containers -.")
|
"Example: --containers ./containers.yaml or --containers -.")
|
||||||
flagNames = append(flagNames, "containers")
|
flagNames = append(flagNames, "containers")
|
||||||
|
|
||||||
flagset.StringSliceVar(&p.Resources.Limits,
|
flagset.StringSliceVar(&p.Resources.Limits,
|
||||||
|
|
@ -296,7 +301,7 @@ func (p *PodSpecFlags) ResolvePodSpec(podSpec *corev1.PodSpec, flags *pflag.Flag
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if flags.Changed("extra-containers") || p.ExtraContainers == "-" {
|
if flags.Changed("containers") || flags.Changed("extra-containers") || p.ExtraContainers == "-" {
|
||||||
var fromFile *corev1.PodSpec
|
var fromFile *corev1.PodSpec
|
||||||
fromFile, err = decodeContainersFromFile(p.ExtraContainers)
|
fromFile, err = decodeContainersFromFile(p.ExtraContainers)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
|
|
@ -233,7 +233,7 @@ containers:
|
||||||
defer os.RemoveAll(fileName)
|
defer os.RemoveAll(fileName)
|
||||||
}
|
}
|
||||||
|
|
||||||
inputArgs := []string{"--image", "repo/user/imageID:tag", "--extra-containers", fileName}
|
inputArgs := []string{"--image", "repo/user/imageID:tag", "--containers", fileName}
|
||||||
|
|
||||||
flags := &PodSpecFlags{}
|
flags := &PodSpecFlags{}
|
||||||
testCmd := &cobra.Command{
|
testCmd := &cobra.Command{
|
||||||
|
|
|
||||||
|
|
@ -102,7 +102,7 @@ func createServiceWithSidecar(r *test.KnRunResultCollector, serviceName, file st
|
||||||
args := []string{"service", "create", serviceName,
|
args := []string{"service", "create", serviceName,
|
||||||
"--image", pkgtest.ImagePath("servingcontainer"),
|
"--image", pkgtest.ImagePath("servingcontainer"),
|
||||||
"--port", "8881",
|
"--port", "8881",
|
||||||
"--extra-containers", file,
|
"--containers", file,
|
||||||
}
|
}
|
||||||
|
|
||||||
out := r.KnTest().Kn().Run(args...)
|
out := r.KnTest().Kn().Run(args...)
|
||||||
|
|
@ -117,7 +117,7 @@ func createServiceWithPipeInput(r *test.KnRunResultCollector, serviceName, sideC
|
||||||
args := []string{"service", "create", serviceName,
|
args := []string{"service", "create", serviceName,
|
||||||
"--image", pkgtest.ImagePath("servingcontainer"),
|
"--image", pkgtest.ImagePath("servingcontainer"),
|
||||||
"--port", "8881",
|
"--port", "8881",
|
||||||
"--extra-containers", "-",
|
"--containers", "-",
|
||||||
"--namespace", r.KnTest().Kn().Namespace(),
|
"--namespace", r.KnTest().Kn().Namespace(),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue