@@ -165,8 +165,8 @@ export default function HcpCliAssistant() {
165
165
// Platform config
166
166
const platforms = useMemo ( ( ) => [
167
167
{ value : "openstack" , label : "OpenStack" } ,
168
+ { value : "aws" , label : "AWS" } ,
168
169
// Future platforms can be added here
169
- // { value: "aws", label: "AWS" },
170
170
// { value: "azure", label: "Azure" },
171
171
] , [ ] ) ;
172
172
@@ -178,6 +178,12 @@ export default function HcpCliAssistant() {
178
178
"OpenStack Node Configuration" ,
179
179
"Review & Generate Command"
180
180
] ,
181
+ aws : [
182
+ "AWS Node Configuration" ,
183
+ "AWS Storage Configuration" ,
184
+ "AWS Network Configuration" ,
185
+ "Review & Generate Command"
186
+ ] ,
181
187
// Add more platform steps as they become available
182
188
} ) , [ ] ) ;
183
189
@@ -205,6 +211,16 @@ export default function HcpCliAssistant() {
205
211
nodeImageName : "" ,
206
212
dnsNameservers : "" ,
207
213
additionalPorts : "[]" , // Initialize as string to avoid JSON parsing issues
214
+
215
+ // AWS specific fields
216
+ awsInstanceType : "" ,
217
+ awsInstanceProfile : "" ,
218
+ awsSubnetId : "" ,
219
+ awsSecurityGroupId : "" ,
220
+ awsRootVolumeSize : "120" ,
221
+ awsRootVolumeType : "gp3" ,
222
+ awsRootVolumeIops : "" ,
223
+ awsRootVolumeKmsKey : "" ,
208
224
} ) ;
209
225
210
226
// Get steps based on selected platform - memoize to prevent recalculation
@@ -333,6 +349,17 @@ export default function HcpCliAssistant() {
333
349
}
334
350
}
335
351
352
+ if ( form . platform === "aws" ) {
353
+ const platformStep = step - 2 ; // Adjust for common steps
354
+
355
+ switch ( platformStep ) {
356
+ case 0 : // AWS Node Configuration
357
+ return form . awsInstanceType . trim ( ) !== "" && form . awsInstanceProfile . trim ( ) !== "" ;
358
+ default :
359
+ return true ;
360
+ }
361
+ }
362
+
336
363
return false ;
337
364
} , [ step , form , platformSteps , parsePorts ] ) ;
338
365
@@ -414,6 +441,55 @@ export default function HcpCliAssistant() {
414
441
return cmd ;
415
442
}
416
443
444
+ if ( form . platform === "aws" ) {
445
+ let cmd = `hcp create cluster aws \
446
+ --name ${ form . name } \
447
+ --base-domain ${ form . baseDomain } \
448
+ --node-pool-replicas ${ form . nodePoolReplicas } \
449
+ --pull-secret ${ form . pullSecret } \
450
+ --ssh-key ${ form . sshKey } \
451
+ --instance-type ${ form . awsInstanceType } ` ;
452
+
453
+ // Add optional AWS parameters
454
+ if ( form . awsInstanceType ) {
455
+ cmd += ` \
456
+ --instance-type ${ form . awsInstanceType } ` ;
457
+ }
458
+
459
+ if ( form . awsInstanceProfile ) {
460
+ cmd += ` \
461
+ --instance-profile ${ form . awsInstanceProfile } ` ;
462
+ }
463
+
464
+ if ( form . awsSubnetId ) {
465
+ cmd += ` \
466
+ --subnet-id ${ form . awsSubnetId } ` ;
467
+ }
468
+
469
+ if ( form . awsRootVolumeSize && form . awsRootVolumeSize !== "120" ) {
470
+ cmd += ` \
471
+ --root-volume-size ${ form . awsRootVolumeSize } ` ;
472
+ }
473
+
474
+ if ( form . awsRootVolumeType && form . awsRootVolumeType !== "gp3" ) {
475
+ cmd += ` \
476
+ --root-volume-type ${ form . awsRootVolumeType } ` ;
477
+ }
478
+
479
+ if ( form . awsRootVolumeIops ) {
480
+ cmd += ` \
481
+ --root-volume-iops ${ form . awsRootVolumeIops } ` ;
482
+ }
483
+
484
+ if ( form . awsRootVolumeKmsKey ) {
485
+ cmd += ` \
486
+ --root-volume-kms-key ${ form . awsRootVolumeKmsKey } ` ;
487
+ }
488
+
489
+ cmd = cmd . replace ( / \s + / g, ' ' ) . trim ( ) ;
490
+ return cmd ;
491
+ }
492
+
417
493
return "Platform command generation not implemented" ;
418
494
} , [ form , parsePorts ] ) ;
419
495
@@ -657,6 +733,86 @@ export default function HcpCliAssistant() {
657
733
</ div >
658
734
) ;
659
735
736
+ const renderAwsNodeConfigStep = ( ) => (
737
+ < >
738
+ < InputWithTooltip
739
+ name = "awsInstanceType"
740
+ placeholder = "Instance Type (required). Example: m5.xlarge"
741
+ value = { form . awsInstanceType }
742
+ onChange = { handleChange }
743
+ required
744
+ tooltip = "The AWS EC2 instance type to use for worker nodes in your cluster."
745
+ />
746
+
747
+ < InputWithTooltip
748
+ name = "awsInstanceProfile"
749
+ placeholder = "Instance Profile (required). Example: my-instance-profile"
750
+ value = { form . awsInstanceProfile }
751
+ onChange = { handleChange }
752
+ required
753
+ tooltip = "The AWS IAM instance profile for the node pool. This profile must have the necessary permissions for OpenShift to operate."
754
+ />
755
+ </ >
756
+ ) ;
757
+
758
+ const renderAwsStorageConfigStep = ( ) => (
759
+ < >
760
+ < InputWithTooltip
761
+ name = "awsRootVolumeType"
762
+ placeholder = "Root Volume Type. Example: gp3"
763
+ value = { form . awsRootVolumeType }
764
+ onChange = { handleChange }
765
+ tooltip = "The EBS volume type to use for worker node root volumes. Common types: gp3, io1, io2, etc."
766
+ />
767
+
768
+ < InputWithTooltip
769
+ type = "number"
770
+ name = "awsRootVolumeSize"
771
+ placeholder = "Root Volume Size. Example: 120"
772
+ value = { form . awsRootVolumeSize }
773
+ onChange = { handleChange }
774
+ tooltip = "The size of the root volume in GB for worker nodes."
775
+ />
776
+
777
+ < InputWithTooltip
778
+ type = "number"
779
+ name = "awsRootVolumeIops"
780
+ placeholder = "Root Volume IOPS (optional)"
781
+ value = { form . awsRootVolumeIops }
782
+ onChange = { handleChange }
783
+ tooltip = "The IOPS to provision for the EBS volume. Only applicable for io1, io2, or gp3 volume types."
784
+ />
785
+
786
+ < InputWithTooltip
787
+ name = "awsRootVolumeKmsKey"
788
+ placeholder = "Root Volume KMS Key (optional)"
789
+ value = { form . awsRootVolumeKmsKey }
790
+ onChange = { handleChange }
791
+ tooltip = "The AWS KMS key ID or ARN to use for EBS encryption. If not specified, the default KMS key is used."
792
+ />
793
+ </ >
794
+ ) ;
795
+
796
+ const renderAwsNetworkConfigStep = ( ) => (
797
+ < >
798
+ < InputWithTooltip
799
+ name = "awsSubnetId"
800
+ placeholder = "Subnet ID (required). Example: subnet-1234567890abcdef0"
801
+ value = { form . awsSubnetId }
802
+ onChange = { handleChange }
803
+ tooltip = "The AWS subnet ID where worker nodes will be created. This subnet must have proper connectivity to the control plane."
804
+ />
805
+
806
+ < InputWithTooltip
807
+ name = "awsSecurityGroupId"
808
+ placeholder = "Security Group ID (required). Example: sg-1234567890abcdef0"
809
+ value = { form . awsSecurityGroupId }
810
+ onChange = { handleChange }
811
+ tooltip = "The AWS security group ID to apply to worker nodes. This security group must allow the necessary traffic for OpenShift to operate."
812
+ />
813
+ </ >
814
+ ) ;
815
+
660
816
// Render current step content
661
817
const renderStepContent = ( ) => {
662
818
if ( step === 0 ) {
@@ -678,6 +834,21 @@ export default function HcpCliAssistant() {
678
834
</ div >
679
835
) ;
680
836
}
837
+ } else if ( form . platform === "aws" ) {
838
+ const platformStep = step - 2 ; // Adjust for common steps
839
+
840
+ switch ( platformStep ) {
841
+ case 0 : return renderAwsNodeConfigStep ( ) ;
842
+ case 1 : return renderAwsStorageConfigStep ( ) ;
843
+ case 2 : return renderAwsNetworkConfigStep ( ) ;
844
+ case 3 : return renderCommandReviewStep ( ) ;
845
+ default :
846
+ return (
847
+ < div className = "p-4 bg-yellow-100 border border-yellow-400 rounded" >
848
+ < p > Unknown step for the AWS platform. Please go back and try again.</ p >
849
+ </ div >
850
+ ) ;
851
+ }
681
852
} else if ( form . platform ) {
682
853
// For any platform that is selected but not implemented
683
854
return (
0 commit comments