Skip to content

Commit 50f1f6e

Browse files
author
OpenShift Bot
authored
Merge pull request #9890 from kargakis/add-insecure-policy-flag
Merged by openshift-bot
2 parents 38a6fdb + f89940d commit 50f1f6e

File tree

8 files changed

+21
-0
lines changed

8 files changed

+21
-0
lines changed

contrib/completions/bash/oc

+1
Original file line numberDiff line numberDiff line change
@@ -8250,6 +8250,7 @@ _oc_create_route_edge()
82508250
flags_with_completion+=("--cert")
82518251
flags_completion+=("_filedir")
82528252
flags+=("--hostname=")
8253+
flags+=("--insecure-policy=")
82538254
flags+=("--key=")
82548255
flags_with_completion+=("--key")
82558256
flags_completion+=("_filedir")

contrib/completions/bash/openshift

+1
Original file line numberDiff line numberDiff line change
@@ -12539,6 +12539,7 @@ _openshift_cli_create_route_edge()
1253912539
flags_with_completion+=("--cert")
1254012540
flags_completion+=("_filedir")
1254112541
flags+=("--hostname=")
12542+
flags+=("--insecure-policy=")
1254212543
flags+=("--key=")
1254312544
flags_with_completion+=("--key")
1254412545
flags_completion+=("_filedir")

contrib/completions/zsh/oc

+1
Original file line numberDiff line numberDiff line change
@@ -8411,6 +8411,7 @@ _oc_create_route_edge()
84118411
flags_with_completion+=("--cert")
84128412
flags_completion+=("_filedir")
84138413
flags+=("--hostname=")
8414+
flags+=("--insecure-policy=")
84148415
flags+=("--key=")
84158416
flags_with_completion+=("--key")
84168417
flags_completion+=("_filedir")

contrib/completions/zsh/openshift

+1
Original file line numberDiff line numberDiff line change
@@ -12700,6 +12700,7 @@ _openshift_cli_create_route_edge()
1270012700
flags_with_completion+=("--cert")
1270112701
flags_completion+=("_filedir")
1270212702
flags+=("--hostname=")
12703+
flags+=("--insecure-policy=")
1270312704
flags+=("--key=")
1270412705
flags_with_completion+=("--key")
1270512706
flags_completion+=("_filedir")

docs/man/man1/oc-create-route-edge.1

+4
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ generated route should expose via the \-\-service flag.
3333
\fB\-\-hostname\fP=""
3434
Set a hostname for the new route
3535

36+
.PP
37+
\fB\-\-insecure\-policy\fP=""
38+
Set an insecure policy for the new route
39+
3640
.PP
3741
\fB\-\-key\fP=""
3842
Path to a key file.

docs/man/man1/openshift-cli-create-route-edge.1

+4
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ generated route should expose via the \-\-service flag.
3333
\fB\-\-hostname\fP=""
3434
Set a hostname for the new route
3535

36+
.PP
37+
\fB\-\-insecure\-policy\fP=""
38+
Set an insecure policy for the new route
39+
3640
.PP
3741
\fB\-\-key\fP=""
3842
Path to a key file.

pkg/cmd/cli/cmd/create/route.go

+6
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ func NewCmdCreateEdgeRoute(fullName string, f *clientcmd.Factory, out io.Writer)
7373
kcmdutil.AddOutputFlagsForMutation(cmd)
7474
cmd.Flags().String("hostname", "", "Set a hostname for the new route")
7575
cmd.Flags().String("port", "", "Name of the service port or number of the container port the route will route traffic to")
76+
cmd.Flags().String("insecure-policy", "", "Set an insecure policy for the new route")
7677
cmd.Flags().String("service", "", "Name of the service that the new route is exposing")
7778
cmd.MarkFlagRequired("service")
7879
cmd.Flags().String("path", "", "Path that the router watches to route traffic to the service.")
@@ -130,6 +131,11 @@ func CreateEdgeRoute(f *clientcmd.Factory, out io.Writer, cmd *cobra.Command, ar
130131
}
131132
route.Spec.TLS.CACertificate = string(caCert)
132133

134+
insecurePolicy := kcmdutil.GetFlagString(cmd, "insecure-policy")
135+
if len(insecurePolicy) > 0 {
136+
route.Spec.TLS.InsecureEdgeTerminationPolicy = api.InsecureEdgeTerminationPolicyType(insecurePolicy)
137+
}
138+
133139
route, err = oc.Routes(ns).Create(route)
134140
if err != nil {
135141
return err

test/cmd/basicresources.sh

+3
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,9 @@ os::cmd::expect_success 'oc create route edge test-route --service=frontend'
164164
os::cmd::expect_success 'oc delete routes test-route'
165165
os::cmd::expect_failure 'oc create route edge new-route'
166166
os::cmd::expect_success 'oc delete services frontend'
167+
os::cmd::expect_success 'oc create route edge --insecure-policy=Allow --service=foo --port=80'
168+
os::cmd::expect_success_and_text 'oc get route foo -o jsonpath="{.spec.tls.insecureEdgeTerminationPolicy}"' 'Allow'
169+
os::cmd::expect_success 'oc delete routes foo'
167170
echo "routes: ok"
168171
os::test::junit::declare_suite_end
169172

0 commit comments

Comments
 (0)