Skip to content

Commit

Permalink
Merge pull request #12925 from juanvallejo/jvallejo/improve-expose-he…
Browse files Browse the repository at this point in the history
…lp-output-on-generator

Merged by openshift-bot
  • Loading branch information
OpenShift Bot authored Feb 18, 2017
2 parents fff640f + 3c22ef4 commit 6e4333c
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 4 deletions.
7 changes: 7 additions & 0 deletions docs/generated/oc_by_example_content.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -1752,6 +1752,13 @@ Expose a replicated application as a service or route
# Expose a service as a route in the specified path
oc expose service nginx --path=/nginx
# Expose a service using different generators
oc expose service nginx --name=exposed-svc --port=12201 --protocol="TCP" --generator="service/v2"
oc expose service nginx --name=my-route --port=12201 --generator="route/v1"
Exposing a service using the "route/v1" generator (default) will create a new exposed route with the "--name" provided
(or the name of the service otherwise). You may not specify a "--protocol" or "--target-port" option when using this generator.
----
====

Expand Down
9 changes: 8 additions & 1 deletion docs/man/man1/oc-expose.1
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ There is also the ability to expose a deployment configuration, replication cont

.PP
\fB\-\-generator\fP=""
The name of the API generator to use.
The name of the API generator to use. Defaults to "route/v1". Available generators include "service/v1", "service/v2", and "route/v1". "service/v1" will automatically name the port "default", while "service/v2" will leave it unnamed.

.PP
\fB\-\-hostname\fP=""
Expand Down Expand Up @@ -246,6 +246,13 @@ There is also the ability to expose a deployment configuration, replication cont

# Expose a service as a route in the specified path
oc expose service nginx \-\-path=/nginx

# Expose a service using different generators
oc expose service nginx \-\-name=exposed\-svc \-\-port=12201 \-\-protocol="TCP" \-\-generator="service/v2"
oc expose service nginx \-\-name=my\-route \-\-port=12201 \-\-generator="route/v1"

Exposing a service using the "route/v1" generator (default) will create a new exposed route with the "\-\-name" provided
(or the name of the service otherwise). You may not specify a "\-\-protocol" or "\-\-target\-port" option when using this generator.

.fi
.RE
Expand Down
9 changes: 8 additions & 1 deletion docs/man/man1/openshift-cli-expose.1
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ There is also the ability to expose a deployment configuration, replication cont

.PP
\fB\-\-generator\fP=""
The name of the API generator to use.
The name of the API generator to use. Defaults to "route/v1". Available generators include "service/v1", "service/v2", and "route/v1". "service/v1" will automatically name the port "default", while "service/v2" will leave it unnamed.

.PP
\fB\-\-hostname\fP=""
Expand Down Expand Up @@ -246,6 +246,13 @@ There is also the ability to expose a deployment configuration, replication cont

# Expose a service as a route in the specified path
openshift cli expose service nginx \-\-path=/nginx

# Expose a service using different generators
openshift cli expose service nginx \-\-name=exposed\-svc \-\-port=12201 \-\-protocol="TCP" \-\-generator="service/v2"
openshift cli expose service nginx \-\-name=my\-route \-\-port=12201 \-\-generator="route/v1"

Exposing a service using the "route/v1" generator (default) will create a new exposed route with the "\-\-name" provided
(or the name of the service otherwise). You may not specify a "\-\-protocol" or "\-\-target\-port" option when using this generator.

.fi
.RE
Expand Down
11 changes: 9 additions & 2 deletions pkg/cmd/cli/cmd/expose.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,14 @@ var (
%[1]s expose dc ruby-hello-world --port=8080
# Expose a service as a route in the specified path
%[1]s expose service nginx --path=/nginx`)
%[1]s expose service nginx --path=/nginx
# Expose a service using different generators
%[1]s expose service nginx --name=exposed-svc --port=12201 --protocol="TCP" --generator="service/v2"
%[1]s expose service nginx --name=my-route --port=12201 --generator="route/v1"
Exposing a service using the "route/v1" generator (default) will create a new exposed route with the "--name" provided
(or the name of the service otherwise). You may not specify a "--protocol" or "--target-port" option when using this generator.`)
)

// NewCmdExpose is a wrapper for the Kubernetes cli expose command
Expand All @@ -53,7 +60,7 @@ func NewCmdExpose(fullName string, f *clientcmd.Factory, out io.Writer) *cobra.C
// Default generator to an empty string so we can get more flexibility
// when setting defaults based on input resources
cmd.Flags().Set("generator", "")
cmd.Flag("generator").Usage = "The name of the API generator to use."
cmd.Flag("generator").Usage = "The name of the API generator to use. Defaults to \"route/v1\". Available generators include \"service/v1\", \"service/v2\", and \"route/v1\". \"service/v1\" will automatically name the port \"default\", while \"service/v2\" will leave it unnamed."
cmd.Flag("generator").DefValue = ""
// Default protocol to an empty string so we can get more flexibility
// when validating the use of it (invalid for routes)
Expand Down

0 comments on commit 6e4333c

Please sign in to comment.