Skip to content

Commit dffae60

Browse files
authored
Merge pull request #8 from shiftstack/aws
aws
2 parents f6472a2 + 28b1237 commit dffae60

File tree

5 files changed

+177
-6
lines changed

5 files changed

+177
-6
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
# Hypershift ton OpenStack CLI Assistant
1+
# Hypershift CLI Assistant
22

33
Click [here](https://shiftstack.github.io/hcp-cli-assistant/) to open the assistant.
44

5-
An interactive web UI wizard that helps users generate the correct `hcp create cluster openstack` command for deploying **HyperShift on OpenStack**.
5+
An interactive web UI wizard that helps users generate the correct `hcp create cluster` commands.
66
The assistant guides users step-by-step through required and optional configurations, ensuring a smooth setup experience.
77

8-
![UI screenshot](screenshot.png?raw=true "UI screenshot")
8+
![UI demo](demo.gif?raw=true "UI demo")
99

1010
## Features
1111
- Step-by-step wizard for easy input
@@ -46,4 +46,4 @@ This project is open-source and available under the **Apache 2.0 License**.
4646

4747
---
4848

49-
Developed for HyperShift on OpenStack users.
49+
Developed for HyperShift users.

demo.gif

916 KB
Loading

index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
66
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
77
<link href="/dist/styles.css" rel="stylesheet">
8-
<title>HyperShift on OpenStack - CLI assistant</title>
8+
<title>HyperShift CLI assistant</title>
99
</head>
1010
<body>
1111
<div id="root"></div>

screenshot.png

-74.5 KB
Binary file not shown.

src/App.jsx

Lines changed: 172 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,8 @@ export default function HcpCliAssistant() {
165165
// Platform config
166166
const platforms = useMemo(() => [
167167
{ value: "openstack", label: "OpenStack" },
168+
{ value: "aws", label: "AWS" },
168169
// Future platforms can be added here
169-
// { value: "aws", label: "AWS" },
170170
// { value: "azure", label: "Azure" },
171171
], []);
172172

@@ -178,6 +178,12 @@ export default function HcpCliAssistant() {
178178
"OpenStack Node Configuration",
179179
"Review & Generate Command"
180180
],
181+
aws: [
182+
"AWS Node Configuration",
183+
"AWS Storage Configuration",
184+
"AWS Network Configuration",
185+
"Review & Generate Command"
186+
],
181187
// Add more platform steps as they become available
182188
}), []);
183189

@@ -205,6 +211,16 @@ export default function HcpCliAssistant() {
205211
nodeImageName: "",
206212
dnsNameservers: "",
207213
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: "",
208224
});
209225

210226
// Get steps based on selected platform - memoize to prevent recalculation
@@ -333,6 +349,17 @@ export default function HcpCliAssistant() {
333349
}
334350
}
335351

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+
336363
return false;
337364
}, [step, form, platformSteps, parsePorts]);
338365

@@ -414,6 +441,55 @@ export default function HcpCliAssistant() {
414441
return cmd;
415442
}
416443

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+
417493
return "Platform command generation not implemented";
418494
}, [form, parsePorts]);
419495

@@ -657,6 +733,86 @@ export default function HcpCliAssistant() {
657733
</div>
658734
);
659735

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+
660816
// Render current step content
661817
const renderStepContent = () => {
662818
if (step === 0) {
@@ -678,6 +834,21 @@ export default function HcpCliAssistant() {
678834
</div>
679835
);
680836
}
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+
}
681852
} else if (form.platform) {
682853
// For any platform that is selected but not implemented
683854
return (

0 commit comments

Comments
 (0)