Skip to content

Commit 3703939

Browse files
committed
Markdownlint
1 parent 845b623 commit 3703939

2 files changed

Lines changed: 235 additions & 19 deletions

File tree

component-extraction-plan.md

Lines changed: 206 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,206 @@
1+
# Component Extraction Plan: EKS to components-microstacks
2+
3+
## Overview
4+
5+
Plan to extract Kubernetes-agnostic components from EKS-hosted directory and move them to the shared `components-microstacks` directory for reuse across all cloud platforms (AWS EKS, Google GKE, Azure AKS).
6+
7+
## Current State Analysis
8+
9+
### components-microstacks Directory
10+
- `api.ts` - Empty placeholder
11+
- `console.ts` - Empty placeholder
12+
- `cert-manager.ts` - Empty placeholder
13+
- `openSearch.ts` - Functional OpenSearch Helm chart deployment
14+
- `index.ts` - Basic structure
15+
16+
### Key Findings from EKS Analysis
17+
18+
The EKS `90-pulumi-service/` stage contains the primary Kubernetes deployments that are cloud-agnostic:
19+
20+
1. **API Deployment** - Complete Kubernetes deployment with database migration init container
21+
2. **Console Deployment** - Frontend service deployment
22+
3. **Kubernetes Services** - Service definitions for API and Console
23+
4. **Secrets Management** - Multiple Kubernetes secrets for various integrations
24+
5. **Encryption Service** - Local key storage with optional cloud KMS integration
25+
26+
## Implementation Plan
27+
28+
### Phase 1: Core Service Components (High Priority)
29+
30+
#### 1. API Component (`api.ts`)
31+
- **Source**: `eks-hosted/90-pulumi-service/index.ts:133-225`
32+
- **Kubernetes Resources**:
33+
- Deployment with init container for database migrations
34+
- Service (port 80 → 8080)
35+
- PodDisruptionBudget for high availability
36+
- **Key Features**:
37+
- Database migration init container
38+
- Comprehensive environment variable configuration
39+
- Resource specifications and volume mounts
40+
- **Parameterization Needed**:
41+
- Image names (API and migrations)
42+
- Resource requirements (CPU, memory)
43+
- Environment variables (domain names, database connections)
44+
- Namespace configuration
45+
- Replica count
46+
- Storage configuration (abstract S3/GCS/Azure Blob)
47+
48+
#### 2. Console Component (`console.ts`)
49+
- **Source**: `eks-hosted/90-pulumi-service/index.ts:240-305`
50+
- **Kubernetes Resources**:
51+
- Deployment for frontend service
52+
- Service (port 80 → 3000)
53+
- PodDisruptionBudget
54+
- **Key Features**:
55+
- Console container configuration
56+
- UI feature flag management
57+
- OAuth provider integration
58+
- **Parameterization Needed**:
59+
- Console image name
60+
- Domain configuration
61+
- Feature flags (email login/signup, SAML SSO)
62+
- OAuth provider settings
63+
- Internal API endpoint configuration
64+
65+
### Phase 2: Supporting Infrastructure (Medium Priority)
66+
67+
#### 3. Modular Secrets Management Components
68+
- **Source**: `eks-hosted/90-pulumi-service/secrets.ts`
69+
- **Current Issues**: Very EKS-specific, monolithic structure
70+
- **Proposed Split**:
71+
- `databaseSecrets.ts` - Database connection credentials
72+
- `smtpSecrets.ts` - Email server configuration
73+
- `oauthSecrets.ts` - OAuth provider settings (GitHub, Google, etc.)
74+
- `samlSecrets.ts` - SAML SSO certificate management with auto-generation
75+
- **Benefits**: Modular approach, flexible secret key naming, support for external secret references
76+
77+
#### 4. Encryption Service Component (`encryptionService.ts`)
78+
- **Source**: `eks-hosted/90-pulumi-service/encryptionService.ts`
79+
- **Kubernetes Resources**:
80+
- Secret for local encryption keys
81+
- Volume and VolumeMount specifications
82+
- **Cloud Dependencies**: AWS KMS integration (conditional)
83+
- **Abstraction Goals**:
84+
- Support multiple cloud key management services (AWS KMS, Azure Key Vault, GCP KMS)
85+
- Maintain local key fallback option
86+
- Configurable encryption backends
87+
88+
### Phase 3: Enhanced Infrastructure (Lower Priority)
89+
90+
#### 5. OpenSearch Component Improvements
91+
- **Current**: Already exists in `components-microstacks/openSearch.ts`
92+
- **Issues**:
93+
- Contains GCP-specific service annotations (`cloud.google.com/neg`)
94+
- Hardcoded namespace logic
95+
- **Improvements**:
96+
- Remove cloud-specific annotations
97+
- Make service type configurable
98+
- Support different ingress patterns per cloud provider
99+
100+
#### 6. Ingress Component (`ingress.ts`)
101+
- **Purpose**: Abstract ingress patterns across cloud providers
102+
- **Support**:
103+
- ALB (AWS) with AWS-specific annotations
104+
- NGINX (GKE/AKS) with standard annotations
105+
- Cloud-specific TLS certificate management
106+
- **Features**:
107+
- Parameterized annotations per cloud provider
108+
- Domain routing configuration
109+
- TLS certificate management patterns
110+
111+
## Cross-Platform Comparison
112+
113+
### Common Patterns Identified
114+
1. **API + Console deployment pattern** - Consistent across all platforms
115+
2. **Database migration init containers** - Same pattern everywhere
116+
3. **Secret management for credentials** - Similar structures
117+
4. **Environment variable injection** - Standard Kubernetes patterns
118+
5. **Service-to-service communication** - Consistent networking patterns
119+
120+
### Platform-Specific Differences
121+
- **AWS EKS**: Uses ALB Ingress, Route53 DNS, ACM certificates
122+
- **Google GKE**: Uses NGINX Ingress, Cloud DNS, Let's Encrypt certificates
123+
- **Azure AKS**: Uses NGINX Ingress, Azure DNS, cert-manager certificates
124+
125+
## Proposed Configuration Interface
126+
127+
```typescript
128+
export interface PulumiServiceArgs {
129+
namespace: pulumi.Input<string>;
130+
imageTag: pulumi.Input<string>;
131+
132+
// Domain configuration
133+
apiDomain: pulumi.Input<string>;
134+
consoleDomain: pulumi.Input<string>;
135+
136+
// Resource configuration
137+
apiReplicas?: pulumi.Input<number>;
138+
consoleReplicas?: pulumi.Input<number>;
139+
140+
// Storage configuration (cloud-agnostic)
141+
storageConfig: {
142+
checkpointsEndpoint: pulumi.Input<string>;
143+
policyPacksEndpoint: pulumi.Input<string>;
144+
escEndpoint: pulumi.Input<string>;
145+
eventsEndpoint: pulumi.Input<string>;
146+
};
147+
148+
// Database configuration
149+
database: DatabaseConfig;
150+
151+
// Optional integrations
152+
smtp?: SMTPConfig;
153+
oauth?: OAuthConfig;
154+
openSearch?: OpenSearchConfig;
155+
156+
// Ingress configuration (varies by cloud)
157+
ingress: IngressConfig;
158+
}
159+
```
160+
161+
## Migration Strategy
162+
163+
### Step-by-Step Approach
164+
1. **Extract one component at a time** to minimize disruption
165+
2. **Create comprehensive TypeScript interfaces** for configuration
166+
3. **Update EKS implementation** to use new shared components
167+
4. **Validate functionality** with existing EKS deployments
168+
5. **Migrate GKE and AKS** to use shared components
169+
6. **Remove duplicate code** from platform-specific directories
170+
7. **Update documentation** and examples
171+
172+
### Backward Compatibility
173+
- Maintain existing EKS functionality during transition
174+
- Provide migration guides for users
175+
- Support both old and new component structures temporarily
176+
177+
## Benefits
178+
179+
### Code Reuse
180+
- Same core components work across EKS, GKE, AKS
181+
- Reduced duplication of Kubernetes resource definitions
182+
- Consistent deployment patterns
183+
184+
### Maintenance
185+
- Single source of truth for core Pulumi Service components
186+
- Easier to implement new features across all platforms
187+
- Simplified testing and validation
188+
189+
### Consistency
190+
- Standardized configuration interfaces
191+
- Uniform behavior across cloud providers
192+
- Easier troubleshooting and support
193+
194+
## Success Metrics
195+
196+
1. **Reduction in duplicate code** - Measure lines of code eliminated
197+
2. **Cross-platform consistency** - Verify identical Kubernetes resources
198+
3. **Configuration simplicity** - Reduced platform-specific parameters
199+
4. **Maintenance efficiency** - Time to implement features across platforms
200+
201+
## Next Steps
202+
203+
1. **Begin with API component extraction** - Highest impact, well-defined scope
204+
2. **Create comprehensive test suite** - Validate components work across platforms
205+
3. **Update documentation** - Reflect new shared component architecture
206+
4. **Engage stakeholders** - Get feedback on proposed interfaces and migration approach

eks-hosted/README.md

Lines changed: 29 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,19 @@
33
This version of the EKS installer for Pulumi self-hosted is broken into smaller, individual stacks.
44

55
This new architecture is being implemented to meet the following requirements:
6-
- Allow users to bring their own infrastructure for sections of the solution.
6+
7+
- Allow users to bring their own infrastructure for sections of the solution.
78
- For example IAM is managed as a separate stack since some customers cannot allow the installer to create and manage the IAM resources needed for the service infrastructure. Similarly, networking may be handled by a different team, etc.
8-
- Support mixing and matching capabilities based on the license. Different features such as insights, ESC, deployments etc. require their own infrastructure.
9-
- Make it easier to maintain and test the overall solution. By breaking the overall deployment into smaller stacks, it makes it easier to test the different parts of the solution since individual stacks can be upped and destroyed.
9+
- Support mixing and matching capabilities based on the license. Different features such as insights, ESC, deployments etc. require their own infrastructure.
10+
- Make it easier to maintain and test the overall solution. By breaking the overall deployment into smaller stacks, it makes it easier to test the different parts of the solution since individual stacks can be upped and destroyed.
1011

1112
This architecture does impose some design requirements:
13+
1214
- Make each stack as self-contained as possible.
1315
- In those cases where the provided installer is not used (i.e. the user stands up the resources on their own), then a mechanism is needed to pass in the ids, etc for that externally managed infrastructure while still supporting those cases where the infra is managed by the installers.
1416

1517
## Installer Revision History
18+
1619
Version ID | Date | K8s Version Supported | Note
1720
---|---|---|--
1821
1.0 | Oct, 2024 | 1.30.3 | Initial version of the new eks installer.
@@ -22,35 +25,39 @@ Version ID | Date | K8s Version Supported | Note
2225
### State Management
2326

2427
It is generally assumed one is using an S3 state backend.
25-
See [AWS S3 state Backend](https://www.pulumi.com/docs/iac/concepts/state-and-backends/#aws-s3) for instructions on how to set up and login to an s3 backend.
28+
See [AWS S3 state Backend](https://www.pulumi.com/docs/iac/concepts/state-and-backends/#aws-s3) for instructions on how to set up and login to an s3 backend.
2629
That said, one can use Pulumi Cloud for the state backend as well. However, these instructions will generally assume an S3 backend is being used.
2730

2831
### Configuration
2932

30-
Each project has its own configuration requirements. Each project folder has a `Pulumi.EXAMPLE.yaml` file that includes instructions for setting up the configuration and can be used as a template for the actual stack config file (see [Pulumi stack config](https://www.pulumi.com/docs/iac/concepts/config/)).
33+
Each project has its own configuration requirements. Each project folder has a `Pulumi.EXAMPLE.yaml` file that includes instructions for setting up the configuration and can be used as a template for the actual stack config file (see [Pulumi stack config](https://www.pulumi.com/docs/iac/concepts/config/)).
3134

3235
### Deployment Order
3336

34-
Each subfolder is it's own Pulumi project (and by extension stack). The numbering represents the order of deployment.
37+
Each subfolder is it's own Pulumi project (and by extension stack). The numbering represents the order of deployment.
38+
39+
### Using Existing Infrastructure
3540

36-
### Using Existing Infrastructure
3741
In some cases, you man need to use existing infrastructure.
3842
Currently, the following installer projects support the case where the infrastructure already exists:
3943

40-
* 01-iam: IAM resources
41-
* 02-networking: VPC and subnets
42-
* 15-state-policies-mgmt: S3 buckets for state and policy storage.
43-
* 30-esc: S3 bucket for ESC-related storage
44+
01-iam: IAM resources
45+
46+
- 02-networking: VPC and subnets
47+
- 15-state-policies-mgmt: S3 buckets for state and policy storage.
48+
- 30-esc: S3 bucket for ESC-related storage
4449

4550
If using pre-existing resources, you will still run the given stacks (i.e. `01-iam` and `02-networking`) but you will provide the values for the resources your created - see the project's `Pulumi.README.yaml` for details.
4651
The stack will then pretend to create the resources and output the values so that downstream stacks can use the values as needed.
52+
4753
- Review the `Pulumi.README.yaml` file to understand some of the inputs for the given stack.
4854
- Review `index.ts` and any related files to understand how the given infrastructure is created.
4955

5056
### Deployment Instructions
5157

5258
These instructions assume you are using "prod" for the name of your stacks. Of course you can name the stack anything you want.
5359
The process is the same for each microstack:
60+
5461
- cd to the given project folder (e.g. `01-iam`)
5562
- `npm install` to install the package dependencies
5663
- Run `pulumi stack init prod` (or whatever name of stack you want to use)
@@ -62,14 +69,17 @@ The process is the same for each microstack:
6269
- Move to the next project folder and repeat the above steps.
6370

6471
#### Helpful Tips about Stack Depenencies
72+
6573
The following stacks manage stateful resources or resources that are foundational to other stacks. So careful thought should be given before destroying them:
66-
* 01-iam
67-
* 02-networking
68-
* 05-eks-cluster
69-
* 15-state-policies-mgmt
70-
* 20-database
71-
* 30-esc
74+
75+
- 01-iam
76+
- 02-networking
77+
- 05-eks-cluster
78+
- 15-state-policies-mgmt
79+
- 20-database
80+
- 30-esc
7281

7382
The following stacks do not manage stateful resources and so can be destroyed/re-created without losing data. Destroying/recreating these stacks will cause a service disruption but no permanent data loss:
74-
* 25-insights: If restarted, use the service UI "selfhosted" page to reindex the searchclsuter.. See: [Re-index opensearch](https://www.pulumi.com/docs/pulumi-cloud/admin/self-hosted/components/search/#backfilling-data)
75-
* 90-pulumi-service
83+
84+
- 25-insights: If restarted, use the service UI "selfhosted" page to reindex the searchclsuter.. See: [Re-index opensearch](https://www.pulumi.com/docs/pulumi-cloud/admin/self-hosted/components/search/#backfilling-data)
85+
- 90-pulumi-service

0 commit comments

Comments
 (0)