Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement insecureEdgeTermination options for reencrypt and pasthrough routes #11953

Merged

Conversation

JacobTanenbaum
Copy link
Contributor

@JacobTanenbaum JacobTanenbaum commented Nov 17, 2016

reencrypt routes work the same as edge routes with Allow, Redirect, and
None

passthrough routes are only allowed Redirect or None

change the name of the haproxy acl's and map files to makes sense

map files
os_edge_http_redirect -> os_route_http_redirect
os_edge_http_expose -> os_route_http_expose

acls

edge_http_expose -> route_http_expose
wildcard_edge_http_expose -> wildcard_route_http_expose

git issue: 11547
bug: 1317159 Link
docs: PR3244

@JacobTanenbaum
Copy link
Contributor Author

@knobunc

Copy link
Contributor

@knobunc knobunc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Are there tests we should extend to cover these new cases?

@knobunc
Copy link
Contributor

knobunc commented Nov 17, 2016

@openshift/networking PTAL

@knobunc knobunc self-assigned this Nov 17, 2016
@knobunc
Copy link
Contributor

knobunc commented Nov 17, 2016

Also, I presume there are docs that need to be updated too?

if _, ok := allowedValues[tls.InsecureEdgeTerminationPolicy]; !ok {
msg := fmt.Sprintf("invalid value for InsecureEdgeTerminationPolicy option, acceptable values are %s, %s, %s, or empty", routeapi.InsecureEdgeTerminationPolicyNone, routeapi.InsecureEdgeTerminationPolicyAllow, routeapi.InsecureEdgeTerminationPolicyRedirect)
return field.Invalid(fldPath, tls.InsecureEdgeTerminationPolicy, msg)
if routeapi.TLSTerminationEdge == tls.Termination || routeapi.TLSTerminationReencrypt == tls.Termination {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style: Make this a switch statement on the termination field

if _, ok := allowedValues[tls.InsecureEdgeTerminationPolicy]; !ok {
msg := fmt.Sprintf("invalid value for InsecureEdgeTerminationPolicy option, acceptable values are %s, %s, %s, or empty", routeapi.InsecureEdgeTerminationPolicyNone, routeapi.InsecureEdgeTerminationPolicyAllow, routeapi.InsecureEdgeTerminationPolicyRedirect)
return field.Invalid(fldPath, tls.InsecureEdgeTerminationPolicy, msg)
switch tls.Termination {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider updating the unit test for this function to ensure against regression.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@marun updated the unit test

Copy link
Contributor

@marun marun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor nit about one of the test changes.

I see there is integration coverage for edge + insecure allowed in test/integration/router_test.go. Consider ensuring that reencrypt + insecure allowed has equivalent coverage so the haproxy changes get validated.

@@ -1055,7 +1055,7 @@ func TestValidateTLS(t *testing.T) {
}
}

func TestValidateTLSInsecureEdgeTerminationPolicy(t *testing.T) {
func TestValidatePassthroughInsecureEdgeTerminationPolicy(t *testing.T) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think your intent is reasonable here, but I think it is confusing to use a test table to define the single route used in each iteration of the test loop. Consider creating the route in the loop instead and getting ride of tests.

@knobunc
Copy link
Contributor

knobunc commented Nov 29, 2016

And are there docs we need to update?

@ramr
Copy link
Contributor

ramr commented Nov 29, 2016

LGTM

@knobunc
Copy link
Contributor

knobunc commented Nov 30, 2016

@marun are you good with the test case he added?

@JacobTanenbaum
Copy link
Contributor Author

@marun did I implement the kind of testing you where looking for?

@marun
Copy link
Contributor

marun commented Nov 30, 2016

LGTM [test]

routes
reencrypt routes work the same as edge routes with Allow, Redirect, and
None

passthrough routes are only allowed Redirect or none

change the name of the haproxy acl's and map files to makes sense

map files
os_edge_http_redirect -> os_route_http_redirect
os_edge_http_expose   -> os_route_http_expose

acls

edge_http_expose          -> route_http_expose
wildcard_edge_http_expose -> wildcard_route_http_expose
@knobunc
Copy link
Contributor

knobunc commented Nov 30, 2016

[merge]

@knobunc
Copy link
Contributor

knobunc commented Nov 30, 2016

[test] epel yum install failed

@openshift-bot
Copy link
Contributor

Evaluated for origin test up to 38c0198

@openshift-bot
Copy link
Contributor

continuous-integration/openshift-jenkins/test SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pr_origin/11834/) (Base Commit: 166273b)

@openshift-bot
Copy link
Contributor

openshift-bot commented Dec 1, 2016

continuous-integration/openshift-jenkins/merge SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pr_origin/11834/) (Image: devenv-rhel7_5458)

@knobunc
Copy link
Contributor

knobunc commented Dec 1, 2016

@openshift-bot
Copy link
Contributor

Evaluated for origin merge up to 38c0198

@openshift-bot openshift-bot merged commit 5d5c1e9 into openshift:master Dec 1, 2016
@knobunc knobunc changed the title Implement inscureEdgeTermination options for reencrypt and pasthrough routes Implement insecureEdgeTermination options for reencrypt and pasthrough routes Dec 16, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants