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

MIGRATIONS-1519: Add support for providing Fargate CPU arch in CDK #520

Merged

Conversation

lewijacn
Copy link
Collaborator

@lewijacn lewijacn commented Feb 23, 2024

Description

Add CDK option to provide default CPU arch defaultFargateCpuArch across Fargate containers for X86_64 and ARM64

Issues Resolved

https://opensearch.atlassian.net/browse/MIGRATIONS-1519

Testing

CDK jest tests and manual AWS deployment

Check List

  • New functionality includes testing
    • All tests pass, including unit test, integration test and doctest
  • New functionality has been documented
  • Commits are signed per the DCO using --signoff

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: Tanner Lewis <lewijacn@amazon.com>
@@ -6,6 +6,7 @@
"nodeToNodeEncryptionEnabled": true,
"encryptionAtRestEnabled": true,
"vpcEnabled": true,
"defaultFargateCpuArch": "X86_64",
Copy link
Member

Choose a reason for hiding this comment

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

This doesn't seem like a setting that should be able to be modified as it depends on the image that's built (unless we change our build script to build within a container and be able to build for whichever target irregardless of host system).

I'd prefer this get auto-resolved, possibly through an auto setting here then using const hostArchitecture = process.arch;

See example for output on M1:

➜  TrafficCapture git:(main) ✗ node
Welcome to Node.js v18.18.2.
Type ".help" for more information.
> process.arch
'arm64'

and for X86 EC2:

[akurait@ip-10-0-3-66 ~]$ node
Welcome to Node.js v18.18.2.
Type ".help" for more information.
> process.arch
'x64'

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good idea, have updated so as a default we will try to use process.arch

Signed-off-by: Tanner Lewis <lewijacn@amazon.com>
Signed-off-by: Tanner Lewis <lewijacn@amazon.com>
Copy link

codecov bot commented Feb 23, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 76.90%. Comparing base (d99fc03) to head (3c1e08f).
Report is 5 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main     #520      +/-   ##
============================================
+ Coverage     76.87%   76.90%   +0.03%     
+ Complexity     1389     1386       -3     
============================================
  Files           158      158              
  Lines          6105     6105              
  Branches        532      532              
============================================
+ Hits           4693     4695       +2     
+ Misses         1061     1058       -3     
- Partials        351      352       +1     
Flag Coverage Δ
unittests 76.90% <ø> (+0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

Signed-off-by: Tanner Lewis <lewijacn@amazon.com>
Signed-off-by: Tanner Lewis <lewijacn@amazon.com>
Signed-off-by: Tanner Lewis <lewijacn@amazon.com>
Signed-off-by: Tanner Lewis <lewijacn@amazon.com>
Signed-off-by: Tanner Lewis <lewijacn@amazon.com>
Signed-off-by: Tanner Lewis <lewijacn@amazon.com>
Signed-off-by: Tanner Lewis <lewijacn@amazon.com>
Signed-off-by: Tanner Lewis <lewijacn@amazon.com>
Signed-off-by: Tanner Lewis <lewijacn@amazon.com>
Signed-off-by: Tanner Lewis <lewijacn@amazon.com>
Signed-off-by: Tanner Lewis <lewijacn@amazon.com>
Signed-off-by: Tanner Lewis <lewijacn@amazon.com>

const cpuArch4 = "X86_64"
const detectedArch4 = validateFargateCpuArch(cpuArch4)
expect(detectedArch4).toEqual(CpuArchitecture.X86_64)
Copy link
Member

@AndreKurait AndreKurait Feb 26, 2024

Choose a reason for hiding this comment

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

Can we have one test that passes nothing and expects it to be something valid?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Added test case 👍

Signed-off-by: Tanner Lewis <lewijacn@amazon.com>
@lewijacn lewijacn merged commit d8763bb into opensearch-project:main Feb 26, 2024
7 checks passed
@lewijacn lewijacn deleted the allow-setting-fargate-cpu-arch branch March 29, 2024 17:15
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.

2 participants