Multiple Software Versions Support
Originally
ADR--0115-Multiple Software Versions Support (v3) · Source on Confluence ↗Context
Our platform architecture must accommodate multiple concurrent software versions that can access the same persistence layer. This requirement arises from the need for seamless migrations between versions and the ability for clients to operate with various software versions simultaneously.
Key Terms
- Control Plane: The platform for managing the lifecycle of environments.
- Client: The owner of environments, with each client potentially managing one or more environments.
- Environment: A collection of software, data, and cloud resources.
- Tenant: The owner of data within an environment, where each environment can host multiple tenants.
- Ephemeral Environment: An environment that does not require cloud resources and can be installed locally (e.g., on a laptop) for testing purposes.
Decision
We will implement an architecture that supports N software versions (Helm releases) with access to a single shared persistence layer.
Each environment will be assigned a unique domain to ensure proper routing and isolation.
Benefits
Smooth Migration Between Versions:
- Enables a gradual transition from old to new versions without disruption.
- Allows for rollback if issues are encountered.
- Ensures data consistency during migration.
Multi-Version Support:
- Clients can work with multiple software versions at the same time.
- Accommodates varying client adoption timelines.
- Facilitates A/B testing of features across different versions.
Consequences
Positive
- Increased flexibility for clients.
- Reduced downtime during upgrades.
- Enhanced testing capabilities through version comparison.
Negative
- Additional complexity in the design of the persistence layer.
- Necessity for strict backward and forward compatibility.
- Heightened testing requirements to ensure functionality across versions.
Software Requirements
To support this architecture, the software must fulfill the following requirements:
Data Schema Compatibility:
- Implement schema versioning.
- Ensure backward compatibility for database schemas.
- Design for graceful handling of missing or additional fields.
API Versioning:
- Explicitly version all APIs.
- Maintain compatibility across multiple versions.
- Support deprecation patterns for evolving APIs.
Resource Isolation:
- Establish clear boundaries between version-specific resources.
- Implement shared resource access controls.
- Facilitate version-aware resource allocation.
Monitoring and Observability:
- Utilize version-tagged metrics and logs.
Environment Types
Standard Environments
- Full allocation of cloud resources.
- Production-grade persistence.
- Capable of multi-tenancy.
- Unique domain for each environment.
Ephemeral Environments
- No cloud resources required.
- Capable of local installation on laptops.
- Limited to testing purposes.
- May feature a simplified persistence model.
- Maintains a unique domain identifier.
Implementation Notes
- Helm charts must be designed to support the side-by-side installation of multiple versions.
- The persistence layer must ensure compatibility across specified version ranges.
- Migration tools should be available for transitioning releases between versions.
Database Schema Evolution Patterns
Additive Schema Changes:
- Only add new tables, columns, or indexes.
- Avoid deleting or modifying existing schema elements.
- Use deprecation labels for obsolete elements.
Schema Version Tables:
- Maintain a dedicated schema_version table.
- Track applied migrations with timestamps.
- Include version compatibility information.
Migration Strategies:
- Implement dual-write during transition periods.
- Use database views to present consistent interfaces.
Multi-Version API Design Guidelines
API Versioning Approaches:
- Utilize URL-based versioning (e.g., /api/v1/, /api/v2/).
Backward Compatibility Requirements:
- Never remove fields from responses.
- Accept but ignore unknown fields in requests.
- Maintain deprecated endpoints.
Documentation and Discovery:
- Provide OpenAPI/Swagger specifications for each version.
- Clearly outline deprecation timelines and migration paths.