You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: design-proposals/platform-multi-tenancy-simplification.md
+91-45Lines changed: 91 additions & 45 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -41,9 +41,9 @@ upgrades, so that my workflows continue without disruption.
41
41
42
42
This proposal introduces a phased migration from the current monolithic multi-tenant architecture to a modular system
43
43
that supports both single-tenant and multi-tenant deployment modes. By decoupling multi-tenancy components and making
44
-
them optional, the architecture enables flexible service deployment and direct API exposure while reducing operational complexity. The approach preserves all
45
-
existing multi-tenancy features and maintains backward compatibility where required, while allowing lightweight, simplified deployments when multi-tenancy is
46
-
not needed.
44
+
them optional, the architecture enables flexible service deployment and direct API exposure while reducing operational
45
+
complexity. The approach preserves all existing multi-tenancy features and maintains backward compatibility where
46
+
required, while allowing lightweight, simplified deployments when multi-tenancy is not needed.
47
47
48
48
### Current Architecture Problems
49
49
@@ -58,68 +58,114 @@ The current EMF architecture exhibits several key issues:
58
58
-**Lack of Flexibility:** The architecture does not support selective component deployment or straightforward
59
59
integration with external services, restricting adaptability to diverse environments.
- External integrations are streamlined via direct service access.
67
+
- The Multi-tenant API Gateway is simplified to an HTTP router for the Tenant Manager, exposing only `/v1/projects` and
68
+
`/v1/orgs` endpoints.
69
+
- Core services (AO, CO, EIM) expose their (external) APIs directly, eliminating API remapping and project ID
70
+
resolution.
71
+
- A shared middleware library (`orch-lib`) standardizes API handling, authentication, and project ID resolution across
72
+
all services.
73
+
- Multi-tenancy is configurable; Tenant Manager and related controllers are optional and can be enabled or disabled per
74
+
deployment.
75
+
- When multi-tenancy is disabled, services initialize a default tenant and restrict API requests to the default project,
76
+
maintaining consistent service logic.
77
+
- Backward compatibility is preserved, allowing seamless upgrades for existing multi-tenant deployments.
71
78
72
-
Below are examples of external service integration scenarios enabled by the new architecture:
79
+
This modular approach enables organizations to deploy EMF in single-tenant or multi-tenant modes, reducing complexity
80
+
and adapting to varied infrastructure needs.
81
+
82
+
Below are examples of how the new modular architecture enables flexible integration of external services in both
83
+
multi-tenant and single-tenant environments.
84
+
85
+
#### Multi-Tenant Integration
73
86
74
87

88
+
89
+
External services with multi-tenant capabilities can interact with EMF components as follows:
90
+
91
+
-**Tenant Provisioning:** External services create or delete tenants via the Tenant Manager’s `/v1/orgs` and
92
+
`/v1/projects` endpoints.
93
+
-**Authentication:** External OIDC providers issue JWT tokens for secure API access, serving as alternatives to EMF’s
94
+
Keycloak.
95
+
-**API Access:** External services use EIM APIs (e.g., `/v1/project/{project}/hosts`) for infrastructure management
96
+
within tenant contexts.
97
+
-**Core Components:** The Tenant Manager oversees organization and project structures, handling tenant provisioning for
98
+
services. EIM delivers infrastructure management APIs that are aware of tenant context, ensuring operations are scoped
99
+
to the appropriate organization or project.
100
+
101
+
This scenario enables multiple organizations and projects to be managed by external services. Tenant operations—such as
102
+
creation, deletion, and updates—are propagated to EIM through integration with the Tenant Manager. Core EMF services
103
+
process requests according to the active project context, ensuring data isolation and secure access for each tenant.
104
+
105
+
#### Single-Tenant Integration
106
+
75
107

76
108
77
-
### Core Architecture Changes
109
+
External services can also integrate with EMF in a simplified single-tenant mode:
78
110
79
-
1.**Distributed API Handling**
80
-
- Enable direct external API exposure, removing the need for complex central routing and API remapping.
81
-
- Each service (AO, CO, EIM) manages Multi-tenant API Gateway responsibilities including:
82
-
- Resolve active project ID
83
-
- Tenant-aware AuthX
84
-
- Provide `/openapi` and `/swagger` endpoints
85
-
- Consolidate common functionality into a shared `orch-lib` middleware library to minimize duplicate work and ensure consistent API behaviors across services.
111
+
-**Default Tenant Logic:** EIM provisions a default tenant and project automatically.
112
+
-**Direct API Access:** External services connect directly to EIM APIs using pre-defined default project name, with no
113
+
tenant management required.
114
+
-**Authentication:** JWTs are issued by external OIDC providers, without tenant-specific claims.
86
115
87
-
2.**Optional Multi-tenancy Components**
88
-
- Make the Tenancy Manager optional, allowing it to be disabled in single-tenant deployments.
89
-
- Service-specific Tenant Controllers and Keycloak Tenant Controller are also optional.
90
-
- Provide default tenant bootstrap for single-tenant scenarios to simplify setup.
116
+
In this scenario, only the EIM service is required. All API requests operate within a default tenant/project context,
117
+
eliminating the need for complex tenant handling. This approach is ideal for environments where multi-tenancy is
118
+
unnecessary, offering a lightweight and efficient integration path.
91
119
92
-
### Migration Strategy
120
+
### Core Changes
93
121
94
-
#### Phase 0: Foundation
122
+
#### Track 1: Remove Nexus-API-Gateway
95
123
96
-
- Develop a shared middleware library (`orch-lib`) to centralize common multi-tenancy logic.
97
-
- Create Helm configuration templates to support both single-tenant and multi-tenant deployment modes.
98
-
- Implement standardized service initialization patterns using `orch-lib` shared functions for consistent startup across services, such as apiv2, CO, and AO.
99
-
- Build a comprehensive testing framework to validate modularity and backward compatibility.
124
+
##### Step 1: Foundation
100
125
101
-
#### Phase 1: EIM Modernization
126
+
Develop a shared middleware library (`orch-lib`) to centralize multi-tenancy logic and standardize API handling. Key
- Extract the project name from the request URI and resolve it to the corresponding ActiveProjectID by querying the Tenant Manager.
130
+
- Perform tenant-aware authentication by verifying that the resolved project ID exists in the JWT claims.
131
+
- Inject ActiveProjectID into the request context for downstream service logic.
104
132
105
-
- Decouple EIM from the legacy API gateway, enabling direct external API exposure.
106
-
- Remove EIM-specific API mapping from `nexus-api-gateway` configuration.
107
-
- Update CO to interact with EIM via its external APIs for inventory operations.
108
-
- Pilot the modular architecture with EIM to validate design and integration patterns.
109
-
- Support external service integrations with EIM in both single-tenant and multi-tenant modes.
133
+
##### Step 2: EIM Modernization
110
134
111
-
**Benefits:**
112
-
- Minimizes migration risk by introducing changes incrementally.
113
-
- Provides early access to EIM integration for external services.
114
-
- Confirms the effectiveness of the modular approach before expanding to other components.
115
-
- Ensures AO and CO remain stable throughout the transition.
135
+
- Incrementally introduce changes to support EIM decomposition and minimize migration risk.
136
+
- Enable direct external API access to EIM by decoupling it from the legacy API gateway ([PoC completed](https://github.com/open-edge-platform/infra-core/tree/poc-api-gateway)). Actions
137
+
include:
138
+
- Update [services.proto](https://github.com/open-edge-platform/infra-core/blob/main/apiv2/api/proto/services/v1/services.proto) to expose the external API path.
139
+
- Regenerate gRPC stubs and OpenAPI specs with the new path.
140
+
- Change [base URL config](https://github.com/open-edge-platform/infra-core/blob/main/apiv2/internal/common/config.go#L100) from `/edge-infra.orchestrator.apis/v2` to `/v1/projects`.
141
+
- Update [proxy/server.go](https://github.com/open-edge-platform/infra-core/blob/main/apiv2/internal/proxy/server.go#L110) to use `orch-lib` middlewares.
142
+
- Create Traefik IngressRoute to route “PathRegexp(`^/projects/[^/]+/compute`)” to the EIM API.
143
+
- Remove EIM-specific API mapping from the `nexus-api-gateway` configuration.
144
+
- Update CO to use EIM’s external APIs for inventory operations.
145
+
- Validate backward compatibility using existing test suites.
116
146
117
-
####Phase 2: CO and AO Modernization
147
+
##### Step 3: CO and AO Modernization
118
148
119
-
- Transform App Orchestration and Cluster Orchestration to the modular architecture.
120
-
- Achieve the full target architecture with all services decoupled.
149
+
- Refactor App Orchestration (AO) and Cluster Orchestration (CO) to adopt the modular architecture, following the EIM
150
+
approach.
151
+
- Complete the transition to the target architecture with all services decoupled from the legacy gateway.
121
152
122
-
####Phase 3: Cleanup
153
+
##### Step 4: Cleanup
123
154
124
155
- Remove legacy code paths and deprecated components.
125
-
- Finalize documentation for deployment and migration processes.
156
+
- Finalize documentation for deployment and migration.
157
+
158
+
#### Track 2: Make Multi-Tenancy Configurable
159
+
160
+
- Refactor tenant provisioning logic in each service into a reusable function, callable by both the service main process
161
+
and the tenant controller.
162
+
- When multi-tenancy is enabled, the tenant controller triggers provisioning upon new project creation events from the
163
+
Tenant Manager.
164
+
- When multi-tenancy is disabled, the service main process initializes the default project during startup.
165
+
- Add single-tenant API handling logic to `orch-lib` to ensure consistent request processing when multi-tenancy is
166
+
inactive.
167
+
- Provide Helm chart configuration options to select either single-tenant or multi-tenant deployment modes during
168
+
installation.
169
+
- Add a global multi-tenant mode configuraion in the EMF installer, which propagates the selected mode to all enabled
0 commit comments