mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-02 16:29:21 +00:00
expose: Better error formatting and generic flag message
Re error formatting: $ osc expose svc frontend --port=5432 --generator='service/v2' --name=test Before: error: generator %!!(MISSING)q(<nil>) not found. see 'osc expose -h' for help. Now: error: generator "services/v2" not found. see 'openshift cli expose -h' for help.
This commit is contained in:
parent
5520386b18
commit
0fba4820f5
@ -37,7 +37,7 @@ $ kubectl expose rc streamer --port=4100 --protocol=udp --name=video-stream
|
|||||||
--generator="service/v1": The name of the API generator to use. Default is 'service/v1'.
|
--generator="service/v1": The name of the API generator to use. Default is 'service/v1'.
|
||||||
-h, --help=false: help for expose
|
-h, --help=false: help for expose
|
||||||
-l, --labels="": Labels to apply to the service created by this call.
|
-l, --labels="": Labels to apply to the service created by this call.
|
||||||
--name="": The name for the newly created service.
|
--name="": The name for the newly created object.
|
||||||
--no-headers=false: When using the default output, don't print headers.
|
--no-headers=false: When using the default output, don't print headers.
|
||||||
-o, --output="": Output format. One of: json|yaml|template|templatefile.
|
-o, --output="": Output format. One of: json|yaml|template|templatefile.
|
||||||
--output-version="": Output the formatted object with the given version (default api-version).
|
--output-version="": Output the formatted object with the given version (default api-version).
|
||||||
@ -83,6 +83,6 @@ $ kubectl expose rc streamer --port=4100 --protocol=udp --name=video-stream
|
|||||||
### SEE ALSO
|
### SEE ALSO
|
||||||
* [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager
|
* [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager
|
||||||
|
|
||||||
###### Auto generated by spf13/cobra at 2015-05-21 10:33:11.197790185 +0000 UTC
|
###### Auto generated by spf13/cobra at 2015-06-02 11:05:52.857144556 +0000 UTC
|
||||||
|
|
||||||
[]()
|
[]()
|
||||||
|
@ -48,7 +48,7 @@ re\-use the labels from the resource it exposes.
|
|||||||
|
|
||||||
.PP
|
.PP
|
||||||
\fB\-\-name\fP=""
|
\fB\-\-name\fP=""
|
||||||
The name for the newly created service.
|
The name for the newly created object.
|
||||||
|
|
||||||
.PP
|
.PP
|
||||||
\fB\-\-no\-headers\fP=false
|
\fB\-\-no\-headers\fP=false
|
||||||
|
@ -69,7 +69,7 @@ func NewCmdExposeService(f *cmdutil.Factory, out io.Writer) *cobra.Command {
|
|||||||
cmd.Flags().String("target-port", "", "Name or number for the port on the container that the service should direct traffic to. Optional.")
|
cmd.Flags().String("target-port", "", "Name or number for the port on the container that the service should direct traffic to. Optional.")
|
||||||
cmd.Flags().String("public-ip", "", "Name of a public IP address to set for the service. The service will be assigned this IP in addition to its generated service IP.")
|
cmd.Flags().String("public-ip", "", "Name of a public IP address to set for the service. The service will be assigned this IP in addition to its generated service IP.")
|
||||||
cmd.Flags().String("overrides", "", "An inline JSON override for the generated object. If this is non-empty, it is used to override the generated object. Requires that the object supply a valid apiVersion field.")
|
cmd.Flags().String("overrides", "", "An inline JSON override for the generated object. If this is non-empty, it is used to override the generated object. Requires that the object supply a valid apiVersion field.")
|
||||||
cmd.Flags().String("name", "", "The name for the newly created service.")
|
cmd.Flags().String("name", "", "The name for the newly created object.")
|
||||||
return cmd
|
return cmd
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -117,7 +117,7 @@ func RunExpose(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command, args []str
|
|||||||
generatorName := cmdutil.GetFlagString(cmd, "generator")
|
generatorName := cmdutil.GetFlagString(cmd, "generator")
|
||||||
generator, found := f.Generator(generatorName)
|
generator, found := f.Generator(generatorName)
|
||||||
if !found {
|
if !found {
|
||||||
return cmdutil.UsageError(cmd, fmt.Sprintf("generator %q not found.", generator))
|
return cmdutil.UsageError(cmd, fmt.Sprintf("generator %q not found.", generatorName))
|
||||||
}
|
}
|
||||||
names := generator.ParamNames()
|
names := generator.ParamNames()
|
||||||
params := kubectl.MakeParams(cmd, names)
|
params := kubectl.MakeParams(cmd, names)
|
||||||
|
Loading…
Reference in New Issue
Block a user