Skip to content

Commit 256ebbe

Browse files
author
Yuriy Bezsonov
committed
WIP
1 parent 0d2e1a0 commit 256ebbe

File tree

3 files changed

+185
-33
lines changed

3 files changed

+185
-33
lines changed

.kiro/specs/infra/design.md

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ public class WorkshopStack extends Stack {
8686

8787
**Vpc**: Creates VPC with appropriate subnets and networking configuration
8888
**Ide**: Creates VS Code IDE environment with necessary permissions
89-
**Eks**: Creates EKS cluster with AutoMode
89+
**Eks**: Creates EKS cluster with Auto Mode, v1.34, native add-ons (Secrets Store CSI, Mountpoint S3 CSI, Pod Identity Agent), and Access Entries
9090
**Database**: Configures RDS Aurora PostgreSQL cluster with universal "workshop-" naming convention
9191
**CodeBuild**: Creates CodeBuild project for AWS service-linked role creation
9292
**Roles**: Creates IAM roles and policies for workshop resources
@@ -199,8 +199,16 @@ Where:
199199
- `bootstrap.sh`: Full system setup, CloudWatch, environment variables, git clone, calls vscode.sh and template script
200200
- `vscode.sh`: Complete VS Code IDE setup (code-server, Caddy, configuration)
201201
- `base.sh`: Base development tools (for base template type)
202+
- `java-on-aws.sh`: Calls base.sh + EKS implementation (cluster setup, add-ons, storage classes)
202203
- Future template scripts will be added to `/ide` folder as needed
203204

205+
#### Workshop Orchestration Pattern
206+
Workshop scripts follow a layered approach:
207+
1. **Base Layer**: `base.sh` provides foundational development tools (Java, Node.js, kubectl, Helm, etc.)
208+
2. **Workshop Layer**: Workshop-specific scripts (e.g., `java-on-aws.sh`) call base.sh then add specialized setup
209+
3. **Error Handling**: Each layer implements proper error handling and progress feedback
210+
4. **Verification**: Final verification ensures all tools and services are operational
211+
204212
#### Configuration
205213
- **Template Type**: Configurable via `TEMPLATE_TYPE` environment variable (defaults to `base`)
206214
- **Git Branch**: Defined in code as `"main"`
@@ -436,6 +444,34 @@ public class BuildConfig {
436444
*For any* database resource created, it should use the "workshop-" prefix instead of workshop-specific naming
437445
**Validates: Requirements 12.1, 12.2, 12.3, 12.4, 12.5, 12.6**
438446

447+
### Property 19: EKS Access Entry Configuration
448+
*For any* EKS cluster created, it should include Access Entry for WSParticipantRole with cluster admin permissions
449+
**Validates: Requirements 13.8**
450+
451+
### Property 20: Workshop Script Orchestration
452+
*For any* java-on-aws workshop execution, it should first execute base.sh successfully before proceeding to EKS implementation
453+
**Validates: Requirements 17.1, 17.2**
454+
455+
### Property 21: Workshop Error Handling
456+
*For any* workshop orchestration error, the system should halt execution and provide clear error messages indicating which phase failed
457+
**Validates: Requirements 17.3**
458+
459+
### Property 22: Workshop Verification
460+
*For any* completed workshop setup, both base tools and EKS services should be verified as operational
461+
**Validates: Requirements 17.4**
462+
463+
### Property 23: EKS Cluster Readiness Check
464+
*For any* EKS setup script execution, it should wait until kubectl get ns command works successfully before proceeding with resource deployment
465+
**Validates: Requirements 18.1**
466+
467+
### Property 24: Kubectl Context Configuration
468+
*For any* EKS cluster setup, the system should update kubeconfig and add cluster to kubectl context
469+
**Validates: Requirements 18.2**
470+
471+
### Property 25: Parallel Deployment Independence
472+
*For any* EKS cluster and database creation, they should depend only on VPC and deploy in parallel without unnecessary dependencies
473+
**Validates: Requirements 19.1, 19.2, 19.3**
474+
439475
## Error Handling
440476

441477
### Script Error Handling Strategy

.kiro/specs/infra/requirements.md

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,3 +177,93 @@ This document specifies the requirements for creating a new AWS workshop infrast
177177
5. WHEN database parameters are stored, THE system SHALL use "workshop-db-connection-string" in Parameter Store
178178
6. WHEN database name is specified, THE system SHALL use "workshop" as the database name instead of workshop-specific names
179179

180+
### Requirement 13
181+
182+
**User Story:** As a workshop developer, I want a standardized EKS cluster with universal naming and modern configuration using the latest CDK constructs, so that Kubernetes-based workshops have consistent infrastructure with current best practices and native CloudFormation resources.
183+
184+
#### Acceptance Criteria
185+
186+
1. WHEN EKS cluster is created, THE system SHALL use the EKS v2 developer preview construct from package "software.amazon.awscdk.services.eks.v2.alpha" for native CloudFormation resource support
187+
2. WHEN EKS cluster is created, THE system SHALL name it "workshop-cluster" for universal identification across workshop types
188+
3. WHEN EKS cluster is configured, THE system SHALL use version 1.34 for current Kubernetes features and security updates
189+
4. WHEN EKS cluster deploys, THE system SHALL enable Auto Mode with "system" and "general-purpose" node pools for automatic node management
190+
5. WHEN EKS cluster networking is configured, THE system SHALL place cluster in private subnets with public and private API access for security and flexibility
191+
6. WHEN EKS cluster logging is enabled, THE system SHALL activate all log types (api, audit, authenticator, controllerManager, scheduler) for comprehensive monitoring
192+
7. WHEN EKS cluster permissions are configured, THE system SHALL use Access Entries authentication mode instead of deprecated ConfigMap-based authentication
193+
8. WHEN EKS cluster access is configured, THE system SHALL create Access Entry for WSParticipantRole and IDE instance role with cluster admin permissions for workshop participant access
194+
195+
### Requirement 14
196+
197+
**User Story:** As a workshop developer, I want database secrets mounted as environment variables in Kubernetes pods using the AWS Secrets Store CSI Driver, so that applications can securely access database credentials without hardcoding them and without requiring External Secrets Operator.
198+
199+
#### Acceptance Criteria
200+
201+
1. WHEN EKS cluster is configured for secrets management, THE system SHALL use AWS Secrets Store CSI Driver add-on instead of External Secrets Operator for mounting secrets
202+
2. WHEN database secrets are mounted, THE system SHALL mount "workshop-db-secret" as environment variables in pods for database connection credentials
203+
3. WHEN database password is mounted, THE system SHALL mount "workshop-db-password-secret" as environment variables in pods for database authentication
204+
4. WHEN database connection string is mounted, THE system SHALL mount "workshop-db-connection-string" from Parameter Store as environment variables in pods for application configuration
205+
5. WHEN secrets access is configured, THE system SHALL use EKS Pod Identity with AWSSecretsManagerClientReadOnlyAccess managed policy for secure secrets retrieval
206+
6. WHEN SecretProviderClass is created, THE system SHALL define which secrets and parameters to mount as files and expose as environment variables in Kubernetes workloads
207+
208+
### Requirement 15
209+
210+
**User Story:** As a workshop developer, I want essential EKS add-ons and configurations for workshop functionality, so that participants have access to storage, ingress, S3 mounting, and proper workshop permissions without manual setup.
211+
212+
#### Acceptance Criteria
213+
214+
1. WHEN EKS cluster is configured for storage, THE system SHALL create GP3 StorageClass as default with encryption enabled for persistent volume claims since EKS Auto Mode does not provide encrypted GP3 by default
215+
2. WHEN EKS cluster is configured for ingress, THE system SHALL create ALB IngressClass and IngressClassParams resources for Application Load Balancer integration since EKS Auto Mode requires explicit IngressClass configuration
216+
3. WHEN EKS cluster is configured for secrets management, THE system SHALL install AWS Secrets Store CSI Driver add-on for mounting database secrets as environment variables
217+
4. WHEN EKS cluster is configured for S3 access, THE system SHALL install AWS Mountpoint S3 CSI driver add-on for S3 bucket mounting capabilities
218+
5. WHEN EKS cluster is configured for authentication, THE system SHALL install EKS Pod Identity Agent add-on for modern IAM authentication with AWS services
219+
6. WHEN EKS cluster is configured for workshop access, THE system SHALL grant WSParticipantRole cluster admin permissions via Access Entries for workshop participant access
220+
7. WHEN EKS cluster setup is complete, THE system SHALL verify all three add-ons (Secrets Store CSI Driver, Mountpoint S3 CSI Driver, Pod Identity Agent) are installed and functional before marking deployment as successful
221+
222+
### Requirement 16
223+
224+
**User Story:** As a workshop developer, I want a complete EKS add-on based architecture that eliminates Helm chart dependencies, so that the infrastructure uses only AWS-native managed services for simplified operations and maintenance.
225+
226+
#### Acceptance Criteria
227+
228+
1. WHEN EKS infrastructure is deployed, THE system SHALL use only EKS add-ons and eliminate all Helm chart installations for a fully AWS-native setup
229+
2. WHEN comparing to original infrastructure, THE system SHALL reduce Helm charts from 2 to 0 by converting External Secrets Operator and Mountpoint S3 CSI Driver to EKS add-ons
230+
3. WHEN EKS add-ons are installed, THE system SHALL configure AWS Secrets Store CSI Driver add-on to replace External Secrets Operator functionality
231+
4. WHEN EKS add-ons are installed, THE system SHALL configure AWS Mountpoint S3 CSI Driver add-on to replace Helm chart installation
232+
5. WHEN EKS add-ons are installed, THE system SHALL configure EKS Pod Identity Agent add-on to provide modern IAM authentication for other add-ons
233+
6. WHEN add-on architecture is complete, THE system SHALL provide equivalent functionality to original setup while using only AWS-managed components
234+
235+
### Requirement 17
236+
237+
**User Story:** As a workshop developer, I want a complete workshop orchestration system that executes foundational and workshop-specific setup in sequence, so that participants have a fully configured development environment with all necessary tools and services.
238+
239+
#### Acceptance Criteria
240+
241+
1. WHEN java-on-aws workshop setup executes, THE system SHALL first run base.sh for foundational development tools installation
242+
2. WHEN base setup completes successfully, THE system SHALL proceed to EKS-specific implementation including cluster configuration and add-ons
243+
3. WHEN workshop orchestration encounters errors, THE system SHALL halt execution and provide clear error messages indicating which phase failed
244+
4. WHEN all setup phases complete, THE system SHALL verify that both base tools and EKS services are operational
245+
5. WHEN workshop script executes, THE system SHALL provide progress feedback for each major phase (base setup, EKS setup, verification)
246+
247+
### Requirement 18
248+
249+
**User Story:** As a workshop developer, I want EKS cluster setup scripts that wait for cluster readiness and configure kubectl context, so that subsequent operations can reliably interact with the cluster and participants have proper access.
250+
251+
#### Acceptance Criteria
252+
253+
1. WHEN EKS setup script executes, THE system SHALL check cluster status and wait until kubectl get ns command works successfully
254+
2. WHEN cluster is ready, THE system SHALL update kubeconfig and add cluster to kubectl context
255+
3. WHEN kubectl context is configured, THE system SHALL deploy GP3 StorageClass, ALB IngressClass, and SecretProviderClass resources
256+
4. WHEN setup script completes, THE system SHALL verify all deployed resources are functional
257+
5. WHEN base development tools are installed, THE system SHALL include kubectl alias 'k' for convenience
258+
259+
### Requirement 19
260+
261+
**User Story:** As a workshop developer, I want EKS cluster and database to deploy in parallel for optimal deployment time, so that infrastructure provisioning is as fast as possible.
262+
263+
#### Acceptance Criteria
264+
265+
1. WHEN EKS cluster is created, THE system SHALL depend only on VPC and deploy in parallel with other resources
266+
2. WHEN database is created, THE system SHALL depend only on VPC and deploy in parallel with EKS cluster
267+
3. WHEN both EKS and database are deploying, THE system SHALL not create unnecessary dependencies between them
268+
4. WHEN parallel deployment completes, THE system SHALL ensure both resources are available for workshop setup scripts
269+

.kiro/specs/infra/tasks.md

Lines changed: 58 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -216,8 +216,9 @@
216216
- Added Kubernetes tools (kubectl 1.34.2, Helm 3.19.3, eks-node-viewer, k9s, e1s)
217217
- Integrated container tools (Docker, SOCI snapshotter 0.12.0) with proper configuration
218218
- Added AWS tools (SAM CLI, Session Manager Plugin) and utilities (jq, yq 4.49.2)
219+
- Added kubectl alias 'k' for convenience in base.sh
219220
- Implemented comprehensive error handling and logging for all tool installations
220-
- _Requirements: 6.4, 6.7_
221+
- _Requirements: 6.4, 6.7, 18.5_
221222

222223
- [x] 11.10 Fix CloudFormation signaling permissions
223224
- Added cloudformation:SignalResource permission to IDE instance IAM role
@@ -371,15 +372,17 @@
371372
- Reference unicorn-roles-analysis.md for IAM role requirements
372373
- _Requirements: 5.4, 5.5_
373374

374-
- [ ] 100.2 Create EKS construct
375-
- Create infra/cdk/src/main/java/sample/com/constructs/Eks.java
376-
- Copy and refactor infrastructure/cdk/src/main/java/com/unicorn/constructs/EksCluster.java
377-
- Update to use EKS AutoMode and integrate with new Vpc and Roles constructs
378-
- Implement unicorn EKS roles: cluster-role, node-role, pod-role, eso-role, eso-sm-role (see unicorn-roles-analysis.md)
379-
- Remove workshop-specific customizations, keep generic EKS setup
380-
- _Requirements: 5.6_
381-
382-
- [ ] 100.3 Create Database construct with universal naming
375+
- [ ] 100.2 Create EKS construct using EKS v2 with Auto Mode
376+
- Create infra/cdk/src/main/java/sample/com/constructs/Eks.java using software.amazon.awscdk.services.eks.v2.alpha
377+
- Configure workshop-cluster with Auto Mode, version 1.34, system+general-purpose node pools
378+
- Add 3 EKS add-ons: AWS Secrets Store CSI Driver, AWS Mountpoint S3 CSI Driver, EKS Pod Identity Agent
379+
- Create Access Entry for WSParticipantRole AND IDE instance role with cluster admin permissions
380+
- Use Access Entries authentication mode instead of ConfigMap-based authentication
381+
- Enable all log types (api, audit, authenticator, controllerManager, scheduler) for comprehensive monitoring
382+
- EKS cluster should depend only on VPC for parallel deployment with Database
383+
- _Requirements: 13.1, 13.2, 13.3, 13.4, 13.7, 13.8, 15.3, 15.5, 15.6, 19.1_
384+
385+
- [x] 100.3 Create Database construct with universal naming
383386
- Create infra/cdk/src/main/java/sample/com/constructs/Database.java
384387
- Copy and refactor database setup from infrastructure/cdk/src/main/java/com/unicorn/core/DatabaseSetup.java
385388
- Update all database resource names to use "workshop-" prefix: cluster, writer, security group, subnet group
@@ -392,33 +395,56 @@
392395
- Consolidate RDS and database schema setup into single construct
393396
- _Requirements: 5.6, 12.1, 12.2, 12.3, 12.4, 12.5, 12.6_
394397

395-
- [ ] 100.4 Update WorkshopStack for java-on-aws
396-
- Add conditional EKS creation: if (!"base".equals(workshopType) && !"java-ai-agents".equals(workshopType))
397-
- Database already conditionally created for non-base templates (same as Roles)
398-
- Test WORKSHOP_TYPE=java-on-aws generates template with all required resources
399-
- Validate generated template matches existing unicornstore-stack.yaml functionality
400-
- _Requirements: 1.2, 5.5_
401-
402-
- [ ] 100.5 Migrate java-on-aws setup scripts
403-
- Copy and refactor infrastructure/scripts/setup/eks.sh to infra/scripts/setup/eks.sh
404-
- Copy and refactor infrastructure/scripts/setup/app.sh to infra/scripts/setup/app.sh
405-
- Copy and refactor infrastructure/scripts/setup/monitoring.sh to infra/scripts/setup/monitoring.sh
406-
- Update all scripts with emoji-based logging and consistent error handling
407-
- _Requirements: 3.3, 5.7_
398+
- [x] 100.4 Update WorkshopStack for java-on-aws with EKS integration (Database part complete)
399+
- Database already conditionally created for non-base templates (same as Roles) ✅
400+
- Need to add conditional EKS creation: if (!"base".equals(workshopType) && !"java-ai-agents".equals(workshopType))
401+
- Test TEMPLATE_TYPE=java-on-aws generates template with VPC, IDE, CodeBuild, Roles, Database, and EKS resources
402+
- Validate generated template includes all EKS add-ons and Access Entries configuration
403+
- Ensure template supports both java-on-aws and base templates from same codebase
404+
- _Requirements: 1.2, 1.3, 13.1, 16.1_
405+
406+
- [ ] 100.5 Create EKS post-deployment setup script
407+
- Create infra/scripts/setup/eks.sh for EKS cluster configuration (based on original infrastructure/scripts/setup/eks.sh)
408+
- Check cluster status and wait until kubectl get ns works successfully before proceeding
409+
- Update kubeconfig and add workshop-cluster to kubectl context
410+
- Deploy GP3 StorageClass (encrypted, default) since EKS Auto Mode doesn't provide encrypted GP3 by default
411+
- Deploy ALB IngressClass + IngressClassParams for Application Load Balancer integration
412+
- Create SecretProviderClass for database secrets (workshop-db-secret, workshop-db-password-secret, workshop-db-connection-string)
413+
- Configure EKS Pod Identity with AWSSecretsManagerClientReadOnlyAccess managed policy
414+
- Verify all three add-ons are installed and functional before completing
415+
- Update script with emoji-based logging and consistent error handling
416+
- _Requirements: 15.1, 15.2, 14.2, 14.3, 14.4, 15.7, 18.1, 18.2, 18.3, 18.4_
408417

409418
- [ ] 100.6 Create java-on-aws workshop orchestration script
410-
- Create infra/scripts/workshops/java-on-aws.sh
411-
- Orchestrate: base.sh, eks.sh, app.sh, monitoring.sh
412-
- Implement proper error handling and progress feedback
419+
- Create infra/scripts/ide/java-on-aws.sh that executes base.sh and EKS implementation
420+
- Script should call base.sh first for foundational development tools
421+
- Then execute EKS-specific setup (cluster configuration, add-ons, storage classes)
422+
- Implement proper error handling and progress feedback between base and EKS phases
413423
- Test script execution and validate all setup steps complete successfully
414424
- _Requirements: 3.1, 3.2_
415425

416-
- [ ] 100.7 Validate java-on-aws migration
417-
- Generate template and compare with existing unicornstore-stack.yaml
418-
- Verify all required resources are present and properly configured
419-
- Test workshop deployment end-to-end (optional, can be done manually)
420-
- Document any differences and ensure they are acceptable
421-
- _Requirements: 5.5_
426+
- [ ]* 100.7 Write property test for EKS Access Entry configuration
427+
- **Property 19: EKS Access Entry Configuration**
428+
- **Validates: Requirements 13.8**
429+
430+
- [ ]* 100.8 Write property test for workshop script orchestration
431+
- **Property 20: Workshop Script Orchestration**
432+
- **Validates: Requirements 17.1, 17.2**
433+
434+
- [ ]* 100.9 Write property test for workshop error handling
435+
- **Property 21: Workshop Error Handling**
436+
- **Validates: Requirements 17.3**
437+
438+
- [ ]* 100.10 Write property test for workshop verification
439+
- **Property 22: Workshop Verification**
440+
- **Validates: Requirements 17.4**
441+
442+
- [ ] 100.11 Validate java-on-aws migration
443+
- Generate template with TEMPLATE_TYPE=java-on-aws and verify all EKS resources are present
444+
- Test template generation for both base and java-on-aws from same codebase
445+
- Verify EKS add-ons, Access Entries, and database resources are properly configured
446+
- Document template differences and ensure they provide equivalent functionality
447+
- _Requirements: 1.2, 1.3, 16.1_
422448

423449
## Java-on-EKS Migration (200.x)
424450

0 commit comments

Comments
 (0)