ADR: Partion Service as a TenantInfo provider
Status
-
Proposed -
Trialing -
Under review -
Approved -
Retired
Context
Currently, CSPs have their own implementation of retrieving the TenantInfo data:
- AWS. https://community.opengroup.org/osdu/platform/system/lib/cloud/aws/os-core-lib-aws/-/blob/master/src/main/java/org/opengroup/osdu/core/aws/multitenancy/TenantFactory.java
- Azure. https://community.opengroup.org/osdu/platform/system/lib/cloud/azure/os-core-lib-azure/-/blob/master/src/main/java/org/opengroup/osdu/azure/multitenancy/TenantFactoryImpl.java
- IBM. https://community.opengroup.org/osdu/platform/system/lib/cloud/ibm/os-core-lib-ibm/-/blob/master/src/main/java/org/opengroup/osdu/core/ibm/multitenancy/TenantFactory.java
All implementations follow a similar way to retrieve the TenantInfo from the Partition service (request partition service->map to TenantInfo class; calls to the Partition service are cached).
Scope
Implement a common approach to retrieve the TenantInfo data and use it across all services.
Decision
Unify an approach of retrieving TenantInfo and using it across all services:
- Implement a common tenant factory (ITenantFactory) on the core-lib level.
- Remove CSP-specific implementations of the TenantFactory.
- Some CSPs will require to restructure a code and implement missing interfaces (in fact, the code is already there):
- IBM should implement IServiceAccountJwtClient explicitly. There is already a similar method in the TenantFactory implementation.
Outcome of the Decision (added by @rostislav.dublin on May 24):
-
A single common implementation of PartitionTenantInfoFactory in os-core-common. It just lies here and does not inject anywhere. See it in the MR 73 ;
-
Each CSP injects the above single common implementation in its CSP library, removing its own implementation. Everyone moves at their own pace, no one rushes anyone. E.g. GCP uses AbstractFactoryBean as shown here.
Rationale
This change unifies an approach of retrieving tenant information, which is used to separate tenants from each other (multitenancy). With the increased maintainability of the code, OSDU will have a unified basic data to implement multitenancy
Consequences
Simplified CSP-specific code and code generalization (higher maintainability and reusability).