Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions lib/argument-store.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ class ArgumentStore {
"SEMAPHORE_AGENT_VOLUME_NAME": "",
"SEMAPHORE_AGENT_VOLUME_TYPE": "gp2",
"SEMAPHORE_AGENT_VOLUME_SIZE": "64",
"SEMAPHORE_AGENT_VOLUME_IOPS": "",
"SEMAPHORE_AGENT_VOLUME_THROUGHPUT": "",
"SEMAPHORE_AGENT_TAGS": "",
"SEMAPHORE_AGENT_LICENSE_CONFIGURATION_ARN": "",
"SEMAPHORE_AGENT_MAC_FAMILY": "mac2",
Expand Down
20 changes: 16 additions & 4 deletions lib/aws-semaphore-agent-stack.js
Original file line number Diff line number Diff line change
Expand Up @@ -441,14 +441,26 @@ class AwsSemaphoreAgentStack extends Stack {
return undefined
}

const volumeType = this.argumentStore.get("SEMAPHORE_AGENT_VOLUME_TYPE");
const ebsDevice = {
volumeType: volumeType,
volumeSize: this.argumentStore.getAsNumber("SEMAPHORE_AGENT_VOLUME_SIZE"),
};

if (!this.argumentStore.isEmpty("SEMAPHORE_AGENT_VOLUME_IOPS")) {
ebsDevice.iops = this.argumentStore.getAsNumber("SEMAPHORE_AGENT_VOLUME_IOPS");
}

// Only set throughput when volume type is gp3 because it is not supported for other volume types.
if (volumeType === "gp3" && !this.argumentStore.isEmpty("SEMAPHORE_AGENT_VOLUME_THROUGHPUT")) {
ebsDevice.throughput = this.argumentStore.getAsNumber("SEMAPHORE_AGENT_VOLUME_THROUGHPUT");
}

return [
{
deviceName: this.argumentStore.get("SEMAPHORE_AGENT_VOLUME_NAME"),
volume: {
ebsDevice: {
volumeType: this.argumentStore.get("SEMAPHORE_AGENT_VOLUME_TYPE"),
volumeSize: this.argumentStore.getAsNumber("SEMAPHORE_AGENT_VOLUME_SIZE")
}
ebsDevice: ebsDevice
}
}
]
Expand Down
8 changes: 6 additions & 2 deletions test/aws-semaphore-agent.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ describe("launch configuration", () => {
DeviceName: "/dev/sda1",
Ebs: {
VolumeType: "gp2",
VolumeSize: 64
VolumeSize: 64,
}
}
]
Expand All @@ -388,6 +388,8 @@ describe("launch configuration", () => {
argumentStore.set("SEMAPHORE_AGENT_VOLUME_NAME", "/dev/sda1");
argumentStore.set("SEMAPHORE_AGENT_VOLUME_TYPE", "gp3");
argumentStore.set("SEMAPHORE_AGENT_VOLUME_SIZE", "3981");
argumentStore.set("SEMAPHORE_AGENT_VOLUME_IOPS", "4500");
argumentStore.set("SEMAPHORE_AGENT_VOLUME_THROUGHPUT", "450");

const template = createTemplate(argumentStore);
template.hasResourceProperties("AWS::EC2::LaunchTemplate", {
Expand All @@ -397,7 +399,9 @@ describe("launch configuration", () => {
DeviceName: "/dev/sda1",
Ebs: {
VolumeType: "gp3",
VolumeSize: 3981
VolumeSize: 3981,
Iops: 4500,
Throughput: 450,
}
}
]
Expand Down