Skip to content

Commit

Permalink
[Backport 1.x] make r5.2xlarge as default instance type (#68)
Browse files Browse the repository at this point in the history
Signed-off-by: Rishabh Singh <[email protected]>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
1 parent 93826d1 commit 7917782
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 8 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ In order to deploy both the stacks the user needs to provide a set of required a
| clientNodeCount (Optional) | integer | Number of dedicated client nodes, default is 0 |
| ingestNodeCount (Optional) | integer | Number of dedicated ingest nodes, default is 0 |
| mlNodeCount (Optional) | integer | Number of dedicated machine learning nodes, default is 0 |
| dataInstanceType (Optional) | string | EC2 instance type for data node, defaults to r5.large. See options in `lib/opensearch-config/node-config.ts` for available options. E.g., `-c dataInstanceType=m5.xlarge` |
| mlInstanceType (Optional) | string | EC2 instance type for ml node, defaults to r5.large. See options in `lib/opensearch-config/node-config.ts` for available options. E.g., `-c mlInstanceType=m5.xlarge` |
| dataInstanceType (Optional) | string | EC2 instance type for data node, defaults to r5.2xlarge. See options in `lib/opensearch-config/node-config.ts` for available options. E.g., `-c dataInstanceType=m5.xlarge` |
| mlInstanceType (Optional) | string | EC2 instance type for ml node, defaults to r5.2xlarge. See options in `lib/opensearch-config/node-config.ts` for available options. E.g., `-c mlInstanceType=m5.xlarge` |
| jvmSysProps (Optional) | string | A comma-separated list of key=value pairs that will be added to `jvm.options` as JVM system properties. |
| additionalConfig (Optional) | string | Additional opensearch.yml config parameters passed as JSON. e.g., `--context additionalConfig='{"plugins.security.nodes_dn": ["CN=*.example.com, OU=SSL, O=Test, L=Test, C=DE", "CN=node.other.com, OU=SSL, O=Test, L=Test, C=DE"], "plugins.security.nodes_dn_dynamic_config_enabled": false}'` |
| suffix (Optional) | string | An optional string identifier to be concatenated with infra stack name. |
Expand Down
6 changes: 6 additions & 0 deletions lib/opensearch-config/node-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ export enum x64Ec2InstanceType {
C5_XLARGE = 'c5.xlarge',
R5_LARGE = 'r5.large',
R5_XLARGE = 'r5.xlarge',
R5_2XLARGE = 'r5.2xlarge',
G5_LARGE = 'g5.large',
G5_XLARGE = 'g5.xlarge',
INF1_XLARGE = 'inf1.xlarge',
Expand All @@ -69,6 +70,7 @@ export enum arm64Ec2InstanceType {
C6G_XLARGE = 'c6g.xlarge',
R6G_LARGE = 'r6g.large',
R6G_XLARGE = 'r6g.xlarge',
R6G_2XLARGE = 'r6g.2xlarge',
G5G_LARGE = 'g5g.large',
G5G_XLARGE = 'g5g.xlarge'
}
Expand All @@ -87,6 +89,8 @@ export const getX64InstanceTypes = (instanceType: string) => {
return InstanceType.of(InstanceClass.R5, InstanceSize.LARGE);
case x64Ec2InstanceType.R5_XLARGE:
return InstanceType.of(InstanceClass.R5, InstanceSize.XLARGE);
case x64Ec2InstanceType.R5_2XLARGE:
return InstanceType.of(InstanceClass.R5, InstanceSize.XLARGE2);
case x64Ec2InstanceType.G5_LARGE:
return InstanceType.of(InstanceClass.G5, InstanceSize.LARGE);
case x64Ec2InstanceType.G5_XLARGE:
Expand Down Expand Up @@ -114,6 +118,8 @@ export const getArm64InstanceTypes = (instanceType: string) => {
return InstanceType.of(InstanceClass.R6G, InstanceSize.LARGE);
case arm64Ec2InstanceType.R6G_XLARGE:
return InstanceType.of(InstanceClass.R6G, InstanceSize.XLARGE);
case arm64Ec2InstanceType.R6G_2XLARGE:
return InstanceType.of(InstanceClass.R6G, InstanceSize.XLARGE2);
case arm64Ec2InstanceType.G5G_LARGE:
return InstanceType.of(InstanceClass.G5G, InstanceSize.LARGE);
case arm64Ec2InstanceType.G5G_XLARGE:
Expand Down
4 changes: 2 additions & 2 deletions lib/os-cluster-entrypoint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ const getInstanceType = (instanceType: string, arch: string) => {
if (instanceType !== 'undefined') {
return getX64InstanceTypes(instanceType);
}
return getX64InstanceTypes('r5.large');
return getX64InstanceTypes('r5.2xlarge');
}
if (instanceType !== 'undefined') {
return getArm64InstanceTypes(instanceType);
}
return getArm64InstanceTypes('r6g.large');
return getArm64InstanceTypes('r6g.2xlarge');
};

export class OsClusterEntrypoint {
Expand Down
8 changes: 4 additions & 4 deletions test/os-cluster.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ test('Test Resources with security disabled multi-node default instance types',
Protocol: 'TCP',
});
infraTemplate.hasResourceProperties('AWS::AutoScaling::LaunchConfiguration', {
InstanceType: 'r5.large',
InstanceType: 'r5.2xlarge',
IamInstanceProfile: {
Ref: 'dataNodeAsgInstanceProfileEC27E8D1',
},
Expand Down Expand Up @@ -227,7 +227,7 @@ test('Throw error on wrong cpu arch to instance mapping', () => {
} catch (error) {
expect(error).toBeInstanceOf(Error);
// eslint-disable-next-line max-len
expect(error.message).toEqual('Invalid instance type provided, please provide any one the following: m6g.xlarge,m6g.2xlarge,c6g.large,c6g.xlarge,r6g.large,r6g.xlarge,g5g.large,g5g.xlarge');
expect(error.message).toEqual('Invalid instance type provided, please provide any one the following: m6g.xlarge,m6g.2xlarge,c6g.large,c6g.xlarge,r6g.large,r6g.xlarge,r6g.2xlarge,g5g.large,g5g.xlarge');
}
});

Expand Down Expand Up @@ -259,7 +259,7 @@ test('Throw error on ec2 instance outside of enum list', () => {
} catch (error) {
expect(error).toBeInstanceOf(Error);
// eslint-disable-next-line max-len
expect(error.message).toEqual('Invalid instance type provided, please provide any one the following: m5.xlarge,m5.2xlarge,c5.large,c5.xlarge,r5.large,r5.xlarge,g5.large,g5.xlarge,inf1.xlarge,inf1.2xlarge');
expect(error.message).toEqual('Invalid instance type provided, please provide any one the following: m5.xlarge,m5.2xlarge,c5.large,c5.xlarge,r5.large,r5.xlarge,r5.2xlarge,g5.large,g5.xlarge,inf1.xlarge,inf1.2xlarge');
}
});

Expand Down Expand Up @@ -292,7 +292,7 @@ test('Test multi-node cluster with only data-nodes', () => {
infraTemplate.resourceCountIs('AWS::AutoScaling::AutoScalingGroup', 2);
infraTemplate.resourceCountIs('AWS::AutoScaling::LaunchConfiguration', 2);
infraTemplate.hasResourceProperties('AWS::AutoScaling::LaunchConfiguration', {
InstanceType: 'r5.large',
InstanceType: 'r5.2xlarge',
IamInstanceProfile: {
Ref: 'seedNodeAsgInstanceProfile6F1EA4FF',
},
Expand Down

0 comments on commit 7917782

Please sign in to comment.