Skip to content

Commit

Permalink
Fix naming
Browse files Browse the repository at this point in the history
Signed-off-by: Sayali Gaikawad <[email protected]>
  • Loading branch information
gaiksaya committed Nov 2, 2023
1 parent 941df35 commit 33d37b0
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 15 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ In order to deploy both the stacks the user needs to provide a set of required a
| mlInstanceType | Optional | string | EC2 instance type for ml node. Defaults to r5.xlarge. 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}'` |
| additionalOSDconfig | Optional | string | Additional opensearch_dashboards.yml config parameters passed as JSON. e.g., `additionalOSDconfig='{"data.search.usageTelemetry.enabled": "true"}'` |
| additionalOsdConfig | Optional | string | Additional opensearch_dashboards.yml config parameters passed as JSON. e.g., `additionalOsdConfig='{"data.search.usageTelemetry.enabled": "true"}'` |
| suffix | Optional | string | An optional string identifier to be concatenated with infra stack name. |
| region | Optional | string | User provided aws region |
| account | Optional | string | User provided aws account |
Expand Down
21 changes: 11 additions & 10 deletions lib/infra/infra-stack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export interface infraProps extends StackProps {
readonly mlNodeStorage: number,
readonly jvmSysPropsString?: string,
readonly additionalConfig?: string,
readonly additionalOSDconfig?: string,
readonly additionalOsdConfig?: string,
readonly dataEc2InstanceType: InstanceType,
readonly mlEc2InstanceType: InstanceType,
readonly use50PercentHeap: boolean,
Expand Down Expand Up @@ -581,7 +581,7 @@ export class InfraStack extends Stack {
}));
}

// final run command based on whether the distribution type is min or bundle
// // Startinng OpenSearch based on whether the distribution type is min or bundle
if (props.minDistribution) { // using (stackProps.minDistribution) condition is not working when false value is being sent
cfnInitConfig.push(InitCommand.shellCommand('set -ex;cd opensearch; sudo -u ec2-user nohup ./bin/opensearch >> install.log 2>&1 &',
{
Expand Down Expand Up @@ -621,21 +621,22 @@ export class InfraStack extends Stack {
}));
}

cfnInitConfig.push(InitCommand.shellCommand('set -ex;cd opensearch-dashboards;'
+ 'sudo -u ec2-user nohup ./bin/opensearch-dashboards > dashboard_install.log 2>&1 &', {
cwd: '/home/ec2-user',
ignoreErrors: false,
}));

// @ts-ignore
if (props.additionalOSDconfig.toString() !== 'undefined') {
if (props.additionalOsdConfig.toString() !== 'undefined') {
// @ts-ignore
cfnInitConfig.push(InitCommand.shellCommand(`set -ex;cd opensearch-dashboards; echo "${props.additionalOSDconfig}">>config/opensearch_dashboards.yml`,
cfnInitConfig.push(InitCommand.shellCommand(`set -ex;cd opensearch-dashboards; echo "${props.additionalOsdConfig}">>config/opensearch_dashboards.yml`,
{
cwd: '/home/ec2-user',
ignoreErrors: false,
}));
}

// Startinng OpenSearch-Dashboards
cfnInitConfig.push(InitCommand.shellCommand('set -ex;cd opensearch-dashboards;'
+ 'sudo -u ec2-user nohup ./bin/opensearch-dashboards > dashboard_install.log 2>&1 &', {
cwd: '/home/ec2-user',
ignoreErrors: false,
}));
}

return cfnInitConfig;
Expand Down
6 changes: 3 additions & 3 deletions lib/os-cluster-entrypoint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,13 +192,13 @@ export class OsClusterEntrypoint {
}
}

const osdConfig = `${scope.node.tryGetContext('additionalOSDconfig')}`;
const osdConfig = `${scope.node.tryGetContext('additionalOsdConfig')}`;
if (osdConfig.toString() !== 'undefined') {
try {
const jsonObj = JSON.parse(osdConfig);
osdYmlConfig = dump(jsonObj);
} catch (e) {
throw new Error(`Encountered following error while parsing additionalOSDconfig json parameter: ${e}`);
throw new Error(`Encountered following error while parsing additionalOsdConfig json parameter: ${e}`);

Check warning on line 201 in lib/os-cluster-entrypoint.ts

View check run for this annotation

Codecov / codecov/patch

lib/os-cluster-entrypoint.ts#L201

Added line #L201 was not covered by tests
}
}

Expand Down Expand Up @@ -261,7 +261,7 @@ export class OsClusterEntrypoint {
mlNodeStorage,
jvmSysPropsString: jvmSysProps,
additionalConfig: ymlConfig,
additionalOSDconfig: osdYmlConfig,
additionalOsdConfig: osdYmlConfig,
use50PercentHeap,
isInternal,
enableRemoteStore,
Expand Down
2 changes: 1 addition & 1 deletion test/os-cluster.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ test('Test Resources with security disabled multi-node default instance types',
serverAccessType: 'ipv4',
restrictServerAccessTo: 'all',
additionalConfig: '{ "name": "John Doe", "age": 30, "email": "[email protected]" }',
additionalOSDconfig: '{ "something.enabled": "true", "something_else.enabled": "false" }',
additionalOsdConfig: '{ "something.enabled": "true", "something_else.enabled": "false" }',
},
});

Expand Down

0 comments on commit 33d37b0

Please sign in to comment.