Skip to content

Commit

Permalink
Merge pull request #6037 from ramr/prohibit-passthrough-route-with-path
Browse files Browse the repository at this point in the history
Merged by openshift-bot
  • Loading branch information
OpenShift Bot committed Jan 20, 2016
2 parents 1216765 + f174dce commit a0f9bba
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pkg/route/api/validation/validation.go
Expand Up @@ -32,6 +32,11 @@ func ValidateRoute(route *routeapi.Route) fielderrors.ValidationErrorList {
result = append(result, fielderrors.NewFieldInvalid("path", route.Spec.Path, "path must begin with /"))
}

if len(route.Spec.Path) > 0 && route.Spec.TLS != nil &&
route.Spec.TLS.Termination == routeapi.TLSTerminationPassthrough {
result = append(result, fielderrors.NewFieldInvalid("path", route.Spec.Path, "passthrough termination does not support paths"))
}

if len(route.Spec.To.Name) == 0 {
result = append(result, fielderrors.NewFieldRequired("serviceName"))
}
Expand Down
20 changes: 20 additions & 0 deletions pkg/route/api/validation/validation_test.go
Expand Up @@ -179,6 +179,26 @@ func TestValidateRoute(t *testing.T) {
},
expectedErrors: 1,
},
{
name: "Passthrough route with path",
route: &api.Route{
ObjectMeta: kapi.ObjectMeta{
Name: "name",
Namespace: "foo",
},
Spec: api.RouteSpec{
Host: "www.example.com",
Path: "/test",
To: kapi.ObjectReference{
Name: "serviceName",
},
TLS: &api.TLSConfig{
Termination: api.TLSTerminationPassthrough,
},
},
},
expectedErrors: 1,
},
}

for _, tc := range tests {
Expand Down

0 comments on commit a0f9bba

Please sign in to comment.