Skip to content

Commit

Permalink
route/v1: Fix CRD to allow path for non-TLS routes
Browse files Browse the repository at this point in the history
Fix the Route CRD validation for allow routes with null spec.tls and
nonempty spec.path.

This commit is related to USHIFT-333.

https://issues.redhat.com/browse/USHIFT-333

* route/v1/route.crd.yaml-patch: Add a case to allow spec.path to be
nonempty when spec.tls is null.  The existing case to allow spec.path when
spec.tls.termination is not "passthrough" is insufficient when spec.tls is
not specified at all.
* route/v1/route.crd.yaml: Regenerate.
* route/v1/test-route-validation.sh: Add test cases "non-TLS with nonempty
path" and "edge-terminated with nonempty path".
  • Loading branch information
Miciah committed Aug 31, 2022
1 parent 0ee1471 commit fae88bf
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 0 deletions.
4 changes: 4 additions & 0 deletions route/v1/route.crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ spec:
- properties:
path:
maxLength: 0
- properties:
tls:
enum:
- null
- not:
properties:
tls:
Expand Down
3 changes: 3 additions & 0 deletions route/v1/route.crd.yaml-patch
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
- properties:
path:
maxLength: 0
- properties:
tls:
enum: [null]
- not:
properties:
tls:
Expand Down
33 changes: 33 additions & 0 deletions route/v1/test-route-validation.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,39 @@ spec:
EOF
expect_fail 'passthrough with nonempty path'

oc create -f - <<'EOF'
apiVersion: route.openshift.io/v1
kind: Route
metadata:
namespace: openshift-ingress
name: testroute
spec:
host: test.foo
path: /
to:
kind: Service
name: router-internal-default
EOF
expect_pass 'non-TLS with nonempty path'
delete_route

oc create -f - <<'EOF'
apiVersion: route.openshift.io/v1
kind: Route
metadata:
namespace: openshift-ingress
name: testroute
spec:
host: test.foo
path: /
tls:
termination: edge
to:
kind: Service
name: router-internal-default
EOF
expect_pass 'edge-terminated with nonempty path'
delete_route

oc create -f - <<'EOF'
apiVersion: route.openshift.io/v1
Expand Down

0 comments on commit fae88bf

Please sign in to comment.