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

OpenSearch cluster cdk changes #3

Merged
merged 1 commit into from
Dec 23, 2022
Merged

OpenSearch cluster cdk changes #3

merged 1 commit into from
Dec 23, 2022

Conversation

rishabh6788
Copy link
Collaborator

Signed-off-by: Rishabh Singh sngri@amazon.com

Description

This PR adds capability to spin up single-node and multi-node OpenSearch cluster using aws-cdk.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

README.md Outdated
| securityGroupId (Optional) | boolean | Re-use existing security group, provide security group id |
| cidr (Optional) | string | User provided CIDR block for new Vpc, default is `10.0.0.0/16` |
| managerNodeCount (Optional) | integer | Number of cluster manager nodes, default is 3 |
| dateNodeCount (Optional) | integer | Number of data nodes, default is 2 |
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
| dateNodeCount (Optional) | integer | Number of data nodes, default is 2 |
| dataNodeCount (Optional) | integer | Number of data nodes, default is 2 |

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thanks for pointing this out, fixed!

README.md Outdated
Comment on lines 32 to 33
| managerNodeCount (Optional) | integer | Number of cluster manager nodes, default is 3 |
| dateNodeCount (Optional) | integer | Number of data nodes, default is 2 |
Copy link
Contributor

Choose a reason for hiding this comment

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

should have an option for ML node count also? as we have now MLCommons plugin also.

Copy link
Collaborator Author

@rishabh6788 rishabh6788 Nov 23, 2022

Choose a reason for hiding this comment

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

Ack! Added.

@@ -0,0 +1,17 @@
#!/usr/bin/env node
Copy link
Member

Choose a reason for hiding this comment

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

not required?

force_flush_interval: 5,
},
}),
InitCommand.shellCommand('set -ex;/opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl -a stop'),
Copy link
Member

Choose a reason for hiding this comment

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

I believe all shell commands have set -xe set by default. Can you check and remove from everywhere if not required?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Already tested, needs to be present for each statement for it to be reflected in the init log, setting it on top did not log all the commands.


/* The security group allows all ip access by default to all the ports.
Please update below if you want to restrict access to certain ips and ports */
this.osSecurityGroup.addIngressRule(Peer.anyIpv4(), Port.allTcp());
Copy link
Member

Choose a reason for hiding this comment

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

See the comment about public access above.

@rishabh6788 rishabh6788 requested review from gaiksaya and removed request for navneet1v December 15, 2022 22:02
README.md Outdated
| jvmSysProps (Optional) | string | A comma-separated list of key=value pairs that will be added to `jvm.options` as JVM system properties. |

#### Restricting Server Access
You need to restrict access to your jenkins endpoint (load balancer).
Copy link
Member

Choose a reason for hiding this comment

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

This should be opensearch cluster acess :)


Be sure to:
## Getting Started
Copy link
Member

Choose a reason for hiding this comment

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

Create a bullet list with all headers? Similar to https://github.com/opensearch-project/opensearch-ci/blob/main/README.md?plain=1#L3-L26 so that users can have easy access?

README.md Outdated
Comment on lines 92 to 107
#### Please note the load-balancer url is internet facing and can be accessed by anyone.
To restrict access please refer [Client IP Preservation](https://docs.aws.amazon.com/elasticloadbalancing/latest/network/load-balancer-target-groups.html#client-ip-preservation) to restrict access on internet-facing network load balancer.
You need to add the ip/prefix-list rule in the security group created in network stack.
Copy link
Member

Choose a reason for hiding this comment

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

Can you replace this section with restricting server access one? I believe you posted that somewhere else?

});

const instanceRole = new Role(this, 'instanceRole', {
roleName: 'OS-Instance-Role',
Copy link
Member

Choose a reason for hiding this comment

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

remove role name as this will block users from deploying multiple clusters in same account. The cluster creation will fail saying resource already exists.

}

const alb = new NetworkLoadBalancer(this, 'publicNlb', {
loadBalancerName: 'opensearch-nlb',
Copy link
Member

Choose a reason for hiding this comment

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

Avoid resource naming. This avoids user to deploy multiple clusters

if (props.vpcId === undefined) {
console.log('No VPC Provided, creating new');
this.vpc = new Vpc(this, 'opensearchClusterVpc', {
vpcName: 'opensearch-cluster-vpc',
Copy link
Member

Choose a reason for hiding this comment

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

avoid resource naming

maxAzs: props.maxAzs,
subnetConfiguration: [
{
name: 'public-subnet',
Copy link
Member

Choose a reason for hiding this comment

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

Same as above avoid resource naming

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

name here is a mandatory attribute and since it is tied to the VPC, having duplicates will not cause any failure as it is more of a tag than an actual resource name. @gaiksaya

cidrMask: 24,
},
{
name: 'private-subnet',
Copy link
Member

Choose a reason for hiding this comment

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

Same as above avoid resource naming

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

name here is a mandatory attribute and since it is tied to the VPC, having duplicates will not cause any failure as it is more of a tag than an actual resource name. @gaiksaya

Signed-off-by: Rishabh Singh <sngri@amazon.com>
@rishabh6788 rishabh6788 merged commit 8e958b0 into opensearch-project:main Dec 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants