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

Add feature to support customized config files to the cluster #82

Merged
merged 6 commits into from
Dec 4, 2023

Conversation

gaiksaya
Copy link
Member

@gaiksaya gaiksaya commented Nov 23, 2023

Description

The customConfigFiles feature allows the users to overwrite or add custom config files to OpenSearch and OpenSearch Dashboards. This will allow to provide any custom configurations including security making the cluster generic for any use cases.

Issues Resolved

resolves #73

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.

Signed-off-by: Sayali Gaikawad <[email protected]>
Signed-off-by: Sayali Gaikawad <[email protected]>
Signed-off-by: Sayali Gaikawad <[email protected]>
Signed-off-by: Sayali Gaikawad <[email protected]>
Copy link

codecov bot commented Nov 23, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (521aeb5) 78.57% compared to head (fd59d4d) 79.05%.

❗ Current head fd59d4d differs from pull request most recent head 9a17e66. Consider uploading reports for the commit 9a17e66 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #82      +/-   ##
==========================================
+ Coverage   78.57%   79.05%   +0.48%     
==========================================
  Files           6        6              
  Lines         434      444      +10     
  Branches      130      131       +1     
==========================================
+ Hits          341      351      +10     
  Misses         93       93              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Signed-off-by: Sayali Gaikawad <[email protected]>
README.md Outdated
@@ -68,6 +68,7 @@ In order to deploy both the stacks the user needs to provide a set of required a
| enableRemoteStore | Optional | boolean | Boolean flag to enable Remote Store feature e.g., `--context enableRemoteStore=true`. See [Enable Remote Store Feature](#enable-remote-store-feature) for more details. Defaults to false |
| storageVolumeType | Optional | string | EBS volume type for all the nodes (data, ml, cluster manager). Defaults to gp2. See `lib/opensearch-config/node-config.ts` for available options. E.g., `-c storageVolumeType=gp3`. For SSD based instance (i.e. i3 family), it is used for root volume configuration. |
| customRoleArn | Optional | string | User provided IAM role arn to be used as ec2 instance profile. `-c customRoleArn=arn:aws:iam::<AWS_ACCOUNT_ID>:role/<ROLE_NAME>` |
| customConfigFiles | Optional | string | You can provide an entire config file to be overwritten or added to OpenSearch and OpenSearch Dashboards. Pass string in the form of JSON with key as local path to the config file to read from and value as file on the server to overwrite/add. Note that the values in the JSON needs to have prefix of `opensearch` or `opensearch-dashboards`. Example: `-c customConfigFiles='{"opensearch-config/config.yml": "opensearch/config/opensearch-security/config.yml", "opensearch-config/role_mapping.yml":"opensearch/config/opensearch-security/roles_mapping.yml", "/roles.yml": "opensearch/config/opensearch-security/roles.yml"}'` |
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit: Formatting change.

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed! Thanks!

const jsonObj = JSON.parse(props.customConfigFiles);
Object.keys(jsonObj).forEach((localFileName) => {
const getConfig = load(readFileSync(localFileName, 'utf-8'));
const remoteConfigLocation = jsonObj[localFileName];
Copy link
Collaborator

Choose a reason for hiding this comment

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

I am assuming this provides the value, i.e, the actual path of the file in opensearch or opensearch-dashboards directory on the ec2 host?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes! root directory remains the same which is /home/ec2-user, the value of json needs to be opensearch/config/* etc.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Also, for local file name, the user has to provide the absolute path or does the code reads using relative-path?

Copy link
Member Author

Choose a reason for hiding this comment

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

Both works as per my testing. Relative as well as absolute path.

Signed-off-by: Sayali Gaikawad <[email protected]>
@rishabh6788 rishabh6788 merged commit 68679fc into opensearch-project:main Dec 4, 2023
3 checks passed
@gaiksaya gaiksaya deleted the add-custom-file branch December 4, 2023 22:39
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.

[FEATURE]Ability to provide customized security configurations to the cluster
2 participants