From 62d9df587db73252cffa897e854af6df60358e21 Mon Sep 17 00:00:00 2001 From: "opensearch-trigger-bot[bot]" <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com> Date: Mon, 23 Oct 2023 20:23:12 -0700 Subject: [PATCH] [Backport 1.x] Scope discovery-ec2 IMDS lookups to this cluster formation. (#70) Signed-off-by: dblock Signed-off-by: github-actions[bot] Co-authored-by: github-actions[bot] --- lib/infra/infra-stack.ts | 4 ++++ lib/opensearch-config/multi-node-base-config.yml | 1 - 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/infra/infra-stack.ts b/lib/infra/infra-stack.ts index 30a2fdfe025..5cb6489e30f 100644 --- a/lib/infra/infra-stack.ts +++ b/lib/infra/infra-stack.ts @@ -425,6 +425,10 @@ export class InfraStack extends Stack { const baseConfig: any = load(readFileSync(`${configFileDir}/multi-node-base-config.yml`, 'utf-8')); baseConfig['cluster.name'] = `${scope.stackName}-${scope.account}-${scope.region}`; + + // use discovery-ec2 to find manager nodes by querying IMDS + baseConfig['discovery.ec2.tag.Name'] = `${scope.stackName}/seedNodeAsg,${scope.stackName}/managerNodeAsg`; + const commonConfig = dump(baseConfig).toString(); cfnInitConfig.push(InitCommand.shellCommand(`set -ex;cd opensearch; echo "${commonConfig}" > config/opensearch.yml`, { diff --git a/lib/opensearch-config/multi-node-base-config.yml b/lib/opensearch-config/multi-node-base-config.yml index 0278abc2086..fda432ac47e 100644 --- a/lib/opensearch-config/multi-node-base-config.yml +++ b/lib/opensearch-config/multi-node-base-config.yml @@ -1,5 +1,4 @@ cluster.name: "opensearch" cluster.initial_master_nodes: ["seed"] discovery.seed_providers: ec2 -discovery.ec2.tag.role: manager network.host: 0.0.0.0