-
Notifications
You must be signed in to change notification settings - Fork 1
Description
Description
As of this moment, no service is explicitly versioned other than the version assigned to the corresponding container image that the service is packaged in. As as result, expressing dependency between difference versions of services is not possible. For instance, a recent change to the project service introduced a new field to the response from the project.get service method. As a result of this change, services that depend on the project service (repository service for instance) had to be updated to propagate the change in response from project.get. While breaking changes like these are unavoidable, the dependent service (repository, in this case) must continue to be operational using an earlier version of the project service. However, the simultaneous running of two versions of a service is not possible in the current implementation because both versions of the service will be named the same (in the name attribute of the associated Nameko service class).
Proposal
A proposed solution, one that was suggested by the creator of Nameko, is to include a version in the service name.
The proposed solution may be better understood using the example from earlier. Consider two services, repository and project, with repository service being dependent on the project service. The proposed solution is described using the following hypothetical scenarios:
- Assume that version 0.1.0-alpha of the
repositoryservice depends on version 0.1.0-alpha of theprojectservice. The service name of version 0.1.0-alpha of theprojectservice will beproject@0.x.x-alpha.1 Therepositoryservice will no longer useRpcProxy('project')to define its dependency on theprojectservice butRpcProxy('project@0.x.x-alpha'). - Assume that the
projectservice requires a breaking change (like in Issue AddidtoProjectinprojectService #31), the new version of the service will have its name beproject@1.x.x-alpha. Since the new version of the service will be packaged in its own versioned container image, it can be run in parallel with its earlier version. When therepositoryservice is ready to migrate its dependency on theprojectservice to the latest version,RpcProxy('project@0.x.x-alpha')is changed toRpcProxy('project@1.x.x-alpha')and the breaking changes the handled appropriately.
1 Version follows the Semantic Versioning convention but MINOR and PATCH components are ignored because the MAJOR component is sufficient to communicate incompatible changes.
Resources
- APIs as infrastructure: future-proofing Stripe with versioning by Stripe Engineering.
- Versioning by Google Cloud.