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

feat(opensearchservice): support for MultiAZWithStandBy (under feature flag) #26082

Merged
merged 16 commits into from
Jul 17, 2023
Merged
Show file tree
Hide file tree
Changes from 2 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
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"DedicatedMasterEnabled": false,
"InstanceCount": 1,
"InstanceType": "r5.large.search",
"MultiAZWithStandbyEnabled": false,
"ZoneAwarenessEnabled": false
},
"DomainEndpointOptions": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"DedicatedMasterEnabled": false,
"InstanceCount": 1,
"InstanceType": "r5.large.search",
"MultiAZWithStandbyEnabled": false,
"ZoneAwarenessEnabled": false
},
"DomainEndpointOptions": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@
"DedicatedMasterEnabled": false,
"InstanceCount": 1,
"InstanceType": "r5.large.search",
"MultiAZWithStandbyEnabled": false,
"ZoneAwarenessEnabled": false
},
"CognitoOptions": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
"DedicatedMasterEnabled": false,
"InstanceCount": 1,
"InstanceType": "r5.large.search",
"MultiAZWithStandbyEnabled": false,
"ZoneAwarenessEnabled": false
},
"DomainEndpointOptions": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@
"DedicatedMasterEnabled": false,
"InstanceCount": 1,
"InstanceType": "r5.large.search",
"MultiAZWithStandbyEnabled": false,
"ZoneAwarenessEnabled": false
},
"DomainEndpointOptions": {
Expand Down Expand Up @@ -427,6 +428,7 @@
"DedicatedMasterEnabled": false,
"InstanceCount": 1,
"InstanceType": "r5.large.search",
"MultiAZWithStandbyEnabled": false,
"ZoneAwarenessEnabled": false
},
"DomainEndpointOptions": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"DedicatedMasterEnabled": false,
"InstanceCount": 1,
"InstanceType": "r5.large.search",
"MultiAZWithStandbyEnabled": false,
"ZoneAwarenessEnabled": false
},
"DomainEndpointOptions": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"DedicatedMasterType": "r5.large.search",
"InstanceCount": 1,
"InstanceType": "r5.large.search",
"MultiAZWithStandbyEnabled": false,
"WarmCount": 2,
"WarmEnabled": true,
"WarmType": "ultrawarm1.medium.search",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"DedicatedMasterEnabled": false,
"InstanceCount": 1,
"InstanceType": "r5.large.search",
"MultiAZWithStandbyEnabled": false,
"ZoneAwarenessEnabled": false
},
"DomainEndpointOptions": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,7 @@
"DedicatedMasterEnabled": false,
"InstanceCount": 2,
"InstanceType": "r5.large.search",
"MultiAZWithStandbyEnabled": false,
"ZoneAwarenessConfig": {
"AvailabilityZoneCount": 2
},
Expand Down
11 changes: 11 additions & 0 deletions packages/aws-cdk-lib/aws-opensearchservice/lib/domain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,14 @@ export interface CapacityConfig {
*/
readonly warmInstanceType?: string;

/**
* Indicates whether Multi-AZ with Standby deployment option is enabled.
* For more information, see [Multi-AZ with Standby]
* (https://docs.aws.amazon.com/opensearch-service/latest/developerguide/managedomains-multiaz.html#managedomains-za-standby)
*
* @default - false
*/
readonly multiAzWithStandbyEnabled?: boolean;
}

/**
Expand Down Expand Up @@ -1215,6 +1223,8 @@ export class Domain extends DomainBase implements IDomain, ec2.IConnectable {
const warmCount = props.capacity?.warmNodes ?? 0;
const warmEnabled = cdk.Token.isUnresolved(warmCount) ? true : warmCount > 0;

const multiAzWithStandbyEnabled = props.capacity?.multiAzWithStandbyEnabled ?? false;

const availabilityZoneCount =
props.zoneAwareness?.availabilityZoneCount ?? 2;

Expand Down Expand Up @@ -1556,6 +1566,7 @@ export class Domain extends DomainBase implements IDomain, ec2.IConnectable {
: undefined,
instanceCount,
instanceType,
multiAzWithStandbyEnabled,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
multiAzWithStandbyEnabled,
multiAzWithStandbyEnabled: props.capacity?.multiAzWithStandbyEnabled,

I don't think there is any reason to explicitly set this to false.

Copy link
Contributor Author

@lpizzinidev lpizzinidev Jun 30, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added a feature flag that defaults multiAzWithStandbyEnabled to true.
This is causing some integration tests to fail.
Let me know if the implementation is correct so I can proceed to fix the failing tests.

warmEnabled: warmEnabled
? warmEnabled
: undefined,
Expand Down
15 changes: 15 additions & 0 deletions packages/aws-cdk-lib/aws-opensearchservice/test/domain.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,21 @@ each([testedOpenSearchVersions]).test('can use tokens in capacity configuration'
});
});

each([testedOpenSearchVersions]).test('can specify multiAZWithStandbyEnabled in capacity configuration', (engineVersion) => {
new Domain(stack, 'Domain', {
version: engineVersion,
capacity: {
multiAzWithStandbyEnabled: true,
},
});

Template.fromStack(stack).hasResourceProperties('AWS::OpenSearchService::Domain', {
ClusterConfig: {
MultiAZWithStandbyEnabled: true,
},
});
});

each([testedOpenSearchVersions]).describe('log groups', (engineVersion) => {

test('slowSearchLogEnabled should create a custom log group', () => {
Expand Down