Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change default volume type to io1 #135

Merged
merged 1 commit into from
Oct 3, 2024
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
44 changes: 37 additions & 7 deletions lib/infra/infra-stack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@

const storageVolType = `${props?.storageVolumeType ?? scope.node.tryGetContext('storageVolumeType')}`;
if (storageVolType === 'undefined') {
this.storageVolumeType = getVolumeType('gp3');
this.storageVolumeType = getVolumeType('io1');
} else {
this.storageVolumeType = getVolumeType(storageVolType);
}
Expand Down Expand Up @@ -495,7 +495,7 @@
);
}
if (this.singleNodeCluster) {
console.log('Single node value is true, creating single node configurations');

Check warning on line 498 in lib/infra/infra-stack.ts

View workflow job for this annotation

GitHub Actions / build

Unexpected console statement
singleNodeInstance = new Instance(this, 'single-node-instance', {
vpc: props.vpc,
instanceType: singleNodeInstanceType,
Expand All @@ -511,7 +511,11 @@
securityGroup: props.securityGroup,
blockDevices: [{
deviceName: '/dev/xvda',
volume: BlockDeviceVolume.ebs(this.dataNodeStorage, { deleteOnTermination: true, volumeType: this.storageVolumeType }),
volume: BlockDeviceVolume.ebs(this.dataNodeStorage, {
deleteOnTermination: true,
volumeType: this.storageVolumeType,
iops: (this.storageVolumeType === EbsDeviceVolumeType.IO1) ? this.dataNodeStorage * 50 : 3000,
}),
}],
init: CloudFormationInit.fromElements(...this.getCfnInitElement(this, clusterLogGroup, 'single-node')),
initOptions: {
Expand Down Expand Up @@ -564,7 +568,11 @@
securityGroup: props.securityGroup,
blockDevices: [{
deviceName: '/dev/xvda',
volume: BlockDeviceVolume.ebs(50, { deleteOnTermination: true, volumeType: props.storageVolumeType }),
volume: BlockDeviceVolume.ebs(50, {
deleteOnTermination: true,
volumeType: this.storageVolumeType,
iops: (this.storageVolumeType === EbsDeviceVolumeType.IO1) ? 2500 : 3000,
}),
}],
requireImdsv2: true,
userData: UserData.forLinux(),
Expand Down Expand Up @@ -600,7 +608,17 @@
blockDevices: [{
deviceName: '/dev/xvda',
// eslint-disable-next-line max-len
volume: (seedConfig === 'seed-manager') ? BlockDeviceVolume.ebs(50, { deleteOnTermination: true, volumeType: props.storageVolumeType }) : BlockDeviceVolume.ebs(this.dataNodeStorage, { deleteOnTermination: true, volumeType: this.storageVolumeType }),
volume: (seedConfig === 'seed-manager') ? BlockDeviceVolume.ebs(50,
{
deleteOnTermination: true,
volumeType: this.storageVolumeType,
iops: (this.storageVolumeType === EbsDeviceVolumeType.IO1) ? 2500 : 3000,
})
: BlockDeviceVolume.ebs(this.dataNodeStorage, {
deleteOnTermination: true,
volumeType: this.storageVolumeType,
iops: (this.storageVolumeType === EbsDeviceVolumeType.IO1) ? this.dataNodeStorage * 50 : 3000,
}),
}],
requireImdsv2: true,
userData: UserData.forLinux(),
Expand Down Expand Up @@ -630,7 +648,11 @@
securityGroup: props.securityGroup,
blockDevices: [{
deviceName: '/dev/xvda',
volume: BlockDeviceVolume.ebs(this.dataNodeStorage, { deleteOnTermination: true, volumeType: this.storageVolumeType }),
volume: BlockDeviceVolume.ebs(this.dataNodeStorage, {
deleteOnTermination: true,
volumeType: this.storageVolumeType,
iops: (this.storageVolumeType === EbsDeviceVolumeType.IO1) ? this.dataNodeStorage * 50 : 3000,
}),
}],
requireImdsv2: true,
userData: UserData.forLinux(),
Expand Down Expand Up @@ -663,7 +685,11 @@
securityGroup: props.securityGroup,
blockDevices: [{
deviceName: '/dev/xvda',
volume: BlockDeviceVolume.ebs(50, { deleteOnTermination: true, volumeType: this.storageVolumeType }),
volume: BlockDeviceVolume.ebs(50, {
deleteOnTermination: true,
volumeType: this.storageVolumeType,
iops: (this.storageVolumeType === EbsDeviceVolumeType.IO1) ? 2500 : 3000,
}),
}],
requireImdsv2: true,
userData: UserData.forLinux(),
Expand Down Expand Up @@ -697,7 +723,11 @@
securityGroup: props.securityGroup,
blockDevices: [{
deviceName: '/dev/xvda',
volume: BlockDeviceVolume.ebs(this.mlNodeStorage, { deleteOnTermination: true, volumeType: this.storageVolumeType }),
volume: BlockDeviceVolume.ebs(this.mlNodeStorage, {
deleteOnTermination: true,
volumeType: this.storageVolumeType,
iops: (this.storageVolumeType === EbsDeviceVolumeType.IO1) ? this.mlNodeStorage * 50 : 3000,
}),
}],
requireImdsv2: true,
userData: UserData.forLinux(),
Expand Down
2 changes: 2 additions & 0 deletions lib/opensearch-config/node-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,8 @@ export const getVolumeType = (volumeType: string) => {
return EbsDeviceVolumeType.GP2;
case EbsDeviceVolumeType.GP3.valueOf():
return EbsDeviceVolumeType.GP3;
case EbsDeviceVolumeType.IO1.valueOf():
return EbsDeviceVolumeType.IO1;
default:
throw new Error('Invalid volume type provided, please provide any one of the following: standard, gp2, gp3');
}
Expand Down
5 changes: 3 additions & 2 deletions test/opensearch-cluster-cdk.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,8 @@ test('Test Resources with security enabled multi-node with existing Vpc with use
DeviceName: '/dev/xvda',
Ebs: {
VolumeSize: 200,
VolumeType: 'gp3',
VolumeType: 'io1',
Iops: 10000,
},
},
],
Expand Down Expand Up @@ -674,7 +675,7 @@ test('Throw error on unsupported ebs volume type', () => {
dataNodeStorage: 200,
isInternal: true,
dataInstanceType: 'r5.4xlarge',
storageVolumeType: 'io1',
storageVolumeType: 'io2',
},
});
// WHEN
Expand Down
Loading