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

Preserve backwards compatibilty for old routes for destination CA #14818

Merged

Conversation

smarterclayton
Copy link
Contributor

OpenShift 3.6 allows destinationCACertificates on the new
route.openshift.io group for reencrypt routes to be empty. To preserve
backwards compatibility for the existing route API, set a simple "no-op"
PEM into the returned REST response, and strip it if a client round trips
it. A v1 client that tries to send an empty destinationCACertificate will
be allowed to do so, but will get back a response that includes the empty
PEM file.

I still need to add a set of tests

[test] @knobunc

@smarterclayton smarterclayton force-pushed the backcompat_for_routes branch 2 times, most recently from 68b5755 to fcf3923 Compare June 22, 2017 02:24
@smarterclayton
Copy link
Contributor Author

Tests added, ran against a 1.5.1 router and got:

$ oc logs dc/router
I0622 02:35:00.149563       1 router.go:496] Router reloaded:
 - Checking HAProxy /healthz on port 1936 ...
 - HAProxy port 1936 health check ok : 0 retry attempt(s).
I0622 02:35:00.149701       1 router.go:236] Router is including routes in all namespaces
I0622 02:35:00.259195       1 router.go:496] Router reloaded:
 - Checking HAProxy /healthz on port 1936 ...
 - HAProxy port 1936 health check ok : 0 retry attempt(s).
I0622 02:35:16.389777       1 router.go:496] Router reloaded:
 - Checking HAProxy /healthz on port 1936 ...
 - HAProxy port 1936 health check ok : 0 retry attempt(s).
E0622 02:35:30.608653       1 extended_validator.go:67] Skipping route default/bar due to invalid configuration:
  - spec.tls.destinationCACertificate: Invalid value: "redacted destination ca certificate data": failed to parse destination CA certificate: Could not read any certificates
E0622 02:35:30.637006       1 controller.go:311] invalid route configuration
E0622 02:35:30.637423       1 extended_validator.go:67] Skipping route default/bar due to invalid configuration:
  - spec.tls.destinationCACertificate: Invalid value: "redacted destination ca certificate data": failed to parse destination CA certificate: Could not read any certificates
E0622 02:35:30.637442       1 controller.go:311] invalid route configuration

because we inject the "fake" destinationCACertificate that is not parseable.

@smarterclayton
Copy link
Contributor Author

And of course our error output is atrocious, but at least it's correct:

oc describe route
Name:		bar
Namespace:	default
Created:	2 minutes ago
Labels:		<none>
Annotations:	openshift.io/host.generated=true
Requested Host:	bar-default.router.default.svc.cluster.local
		  rejected by router router: ExtendedValidationFailed (2 minutes ago)

  - spec.tls.destinationCACertificate: Invalid value: "redacted destination ca certificate data": failed to parse destination CA certificate: Could not read any certificates
Path:			<none>
TLS Termination:	reencrypt
Insecure Policy:	<none>
Endpoint Port:		9090

Service:	bar
Weight:		100 (100%)
Endpoints:	<error: endpoints "bar" not found>

@smarterclayton smarterclayton added this to the 3.6.0 milestone Jun 22, 2017
@smarterclayton
Copy link
Contributor Author

[severity:blocker]

@smarterclayton
Copy link
Contributor Author

@liggitt for API compatibility

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.

Wow. Nice.

And now I have a good example of how all that machinery works.

@knobunc
Copy link
Contributor

knobunc commented Jun 22, 2017

[test][testextended][extended: networking]

The last test flaked on #13271

@smarterclayton
Copy link
Contributor Author

smarterclayton commented Jun 22, 2017 via email

case "routes":
restStorage := s.(*routeetcd.REST)
store := *restStorage.Store
store.Decorator = routeregistry.DecorateLegacyRouteWithEmptyDestinationCACertificates
Copy link
Contributor

Choose a reason for hiding this comment

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

@liggitt I haven't used the decorator before. Does it play nicely the various storage caches involved?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

things are copied before they come out of the cache, because of self link (which is always set)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

but it's good to double check. We've used Decorators for the last 3 years with ImageStreams, so not terribly worried.

@openshift-bot openshift-bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jun 24, 2017
@knobunc
Copy link
Contributor

knobunc commented Jun 26, 2017

@openshift/networking FYI

@openshift-bot openshift-bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jun 27, 2017
@smarterclayton
Copy link
Contributor Author

smarterclayton commented Jun 27, 2017 via email

OpenShift 3.6 allows destinationCACertificates on the new
route.openshift.io group for reencrypt routes to be empty. To preserve
backwards compatibility for the existing route API, set a simple "no-op"
PEM into the returned REST response, and strip it if a client round
trips it. A v1 client that tries to send an empty
destinationCACertificate will be allowed to do so, but will get back a
response that includes the empty PEM file.
@openshift-bot
Copy link
Contributor

Evaluated for origin testextended up to a3c81a1

@openshift-bot
Copy link
Contributor

continuous-integration/openshift-jenkins/testextended SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pull_request_origin_extended/753/) (Base Commit: 3704f7f) (PR Branch Commit: a3c81a1) (Extended Tests: networking)

@liggitt
Copy link
Contributor

liggitt commented Jun 27, 2017

LGTM

@smarterclayton
Copy link
Contributor Author

[merge]

@openshift-bot
Copy link
Contributor

openshift-bot commented Jun 27, 2017

continuous-integration/openshift-jenkins/merge Waiting: You are in the build queue at position: 7

@openshift-bot
Copy link
Contributor

Evaluated for origin merge up to a3c81a1

@smarterclayton
Copy link
Contributor Author

[test]

@openshift-bot
Copy link
Contributor

Evaluated for origin test up to a3c81a1

@openshift-bot
Copy link
Contributor

continuous-integration/openshift-jenkins/test SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pull_request_origin/2716/) (Base Commit: cf83ff4) (PR Branch Commit: a3c81a1)

@smarterclayton smarterclayton merged commit c6e84df into openshift:master Jun 27, 2017
@knobunc
Copy link
Contributor

knobunc commented Jun 28, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants