Skip to content

Commit

Permalink
adding option '--insecure-policy' for passthrough and reencrypt route…
Browse files Browse the repository at this point in the history
… for CLI

PR11953 added support for insecureEdgeTerminationPolicy to reencrypt and passthrough routes,
so it should be supported in the CLI as well.

Bug: 1403155
  • Loading branch information
JacobTanenbaum committed Feb 2, 2017
1 parent 92ce2c9 commit daa215c
Show file tree
Hide file tree
Showing 9 changed files with 44 additions and 0 deletions.
4 changes: 4 additions & 0 deletions contrib/completions/bash/oc
Expand Up @@ -7649,6 +7649,8 @@ _oc_create_route_passthrough()
local_nonpersistent_flags+=("--dry-run")
flags+=("--hostname=")
local_nonpersistent_flags+=("--hostname=")
flags+=("--insecure-policy=")
local_nonpersistent_flags+=("--insecure-policy=")
flags+=("--no-headers")
local_nonpersistent_flags+=("--no-headers")
flags+=("--output=")
Expand Down Expand Up @@ -7743,6 +7745,8 @@ _oc_create_route_reencrypt()
local_nonpersistent_flags+=("--dry-run")
flags+=("--hostname=")
local_nonpersistent_flags+=("--hostname=")
flags+=("--insecure-policy=")
local_nonpersistent_flags+=("--insecure-policy=")
flags+=("--key=")
flags_with_completion+=("--key")
flags_completion+=("_filedir")
Expand Down
4 changes: 4 additions & 0 deletions contrib/completions/bash/openshift
Expand Up @@ -12640,6 +12640,8 @@ _openshift_cli_create_route_passthrough()
local_nonpersistent_flags+=("--dry-run")
flags+=("--hostname=")
local_nonpersistent_flags+=("--hostname=")
flags+=("--insecure-policy=")
local_nonpersistent_flags+=("--insecure-policy=")
flags+=("--no-headers")
local_nonpersistent_flags+=("--no-headers")
flags+=("--output=")
Expand Down Expand Up @@ -12736,6 +12738,8 @@ _openshift_cli_create_route_reencrypt()
local_nonpersistent_flags+=("--dry-run")
flags+=("--hostname=")
local_nonpersistent_flags+=("--hostname=")
flags+=("--insecure-policy=")
local_nonpersistent_flags+=("--insecure-policy=")
flags+=("--key=")
flags_with_completion+=("--key")
flags_completion+=("_filedir")
Expand Down
4 changes: 4 additions & 0 deletions contrib/completions/zsh/oc
Expand Up @@ -7797,6 +7797,8 @@ _oc_create_route_passthrough()
local_nonpersistent_flags+=("--dry-run")
flags+=("--hostname=")
local_nonpersistent_flags+=("--hostname=")
flags+=("--insecure-policy=")
local_nonpersistent_flags+=("--insecure-policy=")
flags+=("--no-headers")
local_nonpersistent_flags+=("--no-headers")
flags+=("--output=")
Expand Down Expand Up @@ -7891,6 +7893,8 @@ _oc_create_route_reencrypt()
local_nonpersistent_flags+=("--dry-run")
flags+=("--hostname=")
local_nonpersistent_flags+=("--hostname=")
flags+=("--insecure-policy=")
local_nonpersistent_flags+=("--insecure-policy=")
flags+=("--key=")
flags_with_completion+=("--key")
flags_completion+=("_filedir")
Expand Down
4 changes: 4 additions & 0 deletions contrib/completions/zsh/openshift
Expand Up @@ -12788,6 +12788,8 @@ _openshift_cli_create_route_passthrough()
local_nonpersistent_flags+=("--dry-run")
flags+=("--hostname=")
local_nonpersistent_flags+=("--hostname=")
flags+=("--insecure-policy=")
local_nonpersistent_flags+=("--insecure-policy=")
flags+=("--no-headers")
local_nonpersistent_flags+=("--no-headers")
flags+=("--output=")
Expand Down Expand Up @@ -12884,6 +12886,8 @@ _openshift_cli_create_route_reencrypt()
local_nonpersistent_flags+=("--dry-run")
flags+=("--hostname=")
local_nonpersistent_flags+=("--hostname=")
flags+=("--insecure-policy=")
local_nonpersistent_flags+=("--insecure-policy=")
flags+=("--key=")
flags_with_completion+=("--key")
flags_completion+=("_filedir")
Expand Down
4 changes: 4 additions & 0 deletions docs/man/man1/oc-create-route-passthrough.1
Expand Up @@ -32,6 +32,10 @@ Specify the service (either just its name or using type/name syntax) that the ge
\fB\-\-hostname\fP=""
Set a hostname for the new route

.PP
\fB\-\-insecure\-policy\fP=""
Set an insecure policy for the new route

.PP
\fB\-\-no\-headers\fP=false
When using the default or custom\-column output format, don't print headers.
Expand Down
4 changes: 4 additions & 0 deletions docs/man/man1/oc-create-route-reencrypt.1
Expand Up @@ -44,6 +44,10 @@ Specify the service (either just its name or using type/name syntax) that the ge
\fB\-\-hostname\fP=""
Set a hostname for the new route

.PP
\fB\-\-insecure\-policy\fP=""
Set an insecure policy for the new route

.PP
\fB\-\-key\fP=""
Path to a key file.
Expand Down
4 changes: 4 additions & 0 deletions docs/man/man1/openshift-cli-create-route-passthrough.1
Expand Up @@ -32,6 +32,10 @@ Specify the service (either just its name or using type/name syntax) that the ge
\fB\-\-hostname\fP=""
Set a hostname for the new route

.PP
\fB\-\-insecure\-policy\fP=""
Set an insecure policy for the new route

.PP
\fB\-\-no\-headers\fP=false
When using the default or custom\-column output format, don't print headers.
Expand Down
4 changes: 4 additions & 0 deletions docs/man/man1/openshift-cli-create-route-reencrypt.1
Expand Up @@ -44,6 +44,10 @@ Specify the service (either just its name or using type/name syntax) that the ge
\fB\-\-hostname\fP=""
Set a hostname for the new route

.PP
\fB\-\-insecure\-policy\fP=""
Set an insecure policy for the new route

.PP
\fB\-\-key\fP=""
Path to a key file.
Expand Down
12 changes: 12 additions & 0 deletions pkg/cmd/cli/cmd/create/route.go
Expand Up @@ -198,6 +198,7 @@ func NewCmdCreatePassthroughRoute(fullName string, f *clientcmd.Factory, out io.
kcmdutil.AddDryRunFlag(cmd)
cmd.Flags().String("hostname", "", "Set a hostname for the new route")
cmd.Flags().String("port", "", "Name of the service port or number of the container port the route will route traffic to")
cmd.Flags().String("insecure-policy", "", "Set an insecure policy for the new route")
cmd.Flags().String("service", "", "Name of the service that the new route is exposing")
cmd.MarkFlagRequired("service")

Expand Down Expand Up @@ -232,6 +233,11 @@ func CreatePassthroughRoute(f *clientcmd.Factory, out io.Writer, cmd *cobra.Comm
route.Spec.TLS = new(api.TLSConfig)
route.Spec.TLS.Termination = api.TLSTerminationPassthrough

insecurePolicy := kcmdutil.GetFlagString(cmd, "insecure-policy")
if len(insecurePolicy) > 0 {
route.Spec.TLS.InsecureEdgeTerminationPolicy = api.InsecureEdgeTerminationPolicyType(insecurePolicy)
}

dryRun := kcmdutil.GetFlagBool(cmd, "dry-run")
actualRoute := route

Expand Down Expand Up @@ -293,6 +299,7 @@ func NewCmdCreateReencryptRoute(fullName string, f *clientcmd.Factory, out io.Wr
kcmdutil.AddDryRunFlag(cmd)
cmd.Flags().String("hostname", "", "Set a hostname for the new route")
cmd.Flags().String("port", "", "Name of the service port or number of the container port the route will route traffic to")
cmd.Flags().String("insecure-policy", "", "Set an insecure policy for the new route")
cmd.Flags().String("service", "", "Name of the service that the new route is exposing")
cmd.MarkFlagRequired("service")
cmd.Flags().String("path", "", "Path that the router watches to route traffic to the service.")
Expand Down Expand Up @@ -359,6 +366,11 @@ func CreateReencryptRoute(f *clientcmd.Factory, out io.Writer, cmd *cobra.Comman
}
route.Spec.TLS.DestinationCACertificate = string(destCACert)

insecurePolicy := kcmdutil.GetFlagString(cmd, "insecure-policy")
if len(insecurePolicy) > 0 {
route.Spec.TLS.InsecureEdgeTerminationPolicy = api.InsecureEdgeTerminationPolicyType(insecurePolicy)
}

dryRun := kcmdutil.GetFlagBool(cmd, "dry-run")
actualRoute := route

Expand Down

0 comments on commit daa215c

Please sign in to comment.