opensearch-project / OpenSearch

🔎 Open source distributed and RESTful search engine.
https://opensearch.org/docs/latest/opensearch/index/
Apache License 2.0
8.89k stars 1.63k forks source link

Upgrade AWS SDK v1 to v2 #7372

Closed dblock closed 1 year ago

dblock commented 1 year ago

Description

Upgrading AWS SDK v1 to v2 in discovery-ec2 and repository-s3.

This PR contains the following potentially breaking changes for end-users.

The AWS SDK has other changes, see https://docs.aws.amazon.com/sdk-for-java/latest/developer-guide/migration-client-changes.html and https://github.com/aws/aws-sdk-java-v2/blob/master/docs/LaunchChangelog.md for all changes between AWS SDK v1 and v2.

Related Issues

Resolves #7312.

Check List

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.

github-actions[bot] commented 1 year ago

Gradle Check (Jenkins) Run Completed with:

github-actions[bot] commented 1 year ago

Gradle Check (Jenkins) Run Completed with:

Bukhtawar commented 1 year ago

Code scan for dependencies, looks like we have just the two plugins consuming AWS SDK

github-actions[bot] commented 1 year ago

Gradle Check (Jenkins) Run Completed with:

github-actions[bot] commented 1 year ago

Gradle Check (Jenkins) Run Completed with:

github-actions[bot] commented 1 year ago

Gradle Check (Jenkins) Run Completed with:

github-actions[bot] commented 1 year ago

Gradle Check (Jenkins) Run Completed with:

github-actions[bot] commented 1 year ago

Gradle Check (Jenkins) Run Completed with:

github-actions[bot] commented 1 year ago

Gradle Check (Jenkins) Run Completed with:

github-actions[bot] commented 1 year ago

Gradle Check (Jenkins) Run Completed with:

github-actions[bot] commented 1 year ago

Gradle Check (Jenkins) Run Completed with:

github-actions[bot] commented 1 year ago

Gradle Check (Jenkins) Run Completed with:

github-actions[bot] commented 1 year ago

Gradle Check (Jenkins) Run Completed with:

github-actions[bot] commented 1 year ago

Gradle Check (Jenkins) Run Completed with:

github-actions[bot] commented 1 year ago

Gradle Check (Jenkins) Run Completed with:

github-actions[bot] commented 1 year ago

Gradle Check (Jenkins) Run Completed with:

github-actions[bot] commented 1 year ago

Gradle Check (Jenkins) Run Completed with:

github-actions[bot] commented 1 year ago

Gradle Check (Jenkins) Run Completed with:

github-actions[bot] commented 1 year ago

Gradle Check (Jenkins) Run Completed with:

github-actions[bot] commented 1 year ago

Gradle Check (Jenkins) Run Completed with:

github-actions[bot] commented 1 year ago

Gradle Check (Jenkins) Run Completed with:

github-actions[bot] commented 1 year ago

Gradle Check (Jenkins) Run Completed with:

github-actions[bot] commented 1 year ago

Gradle Check (Jenkins) Run Completed with:

github-actions[bot] commented 1 year ago

Gradle Check (Jenkins) Run Completed with:

github-actions[bot] commented 1 year ago

Gradle Check (Jenkins) Run Completed with:

dblock commented 1 year ago

Looks like :plugins:discovery-ec2:qa:amazon-ec2:yamlRestTestSystemProperties is failing.

»  software.amazon.awssdk.core.exception.SdkClientException: Unable to load credentials from any of the providers in the chain AwsCredentialsProviderChain(credentialsProviders=[SystemPropertyCredentialsProvider(), EnvironmentVariableCredentialsProvider(), WebIdentityTokenCredentialsProvider(), ProfileCredentialsProvider(profileName=default, profileFile=ProfileFile(profilesAndSectionsMap=[])), ContainerCredentialsProvider(), InstanceProfileCredentialsProvider()]) : [SystemPropertyCredentialsProvider(): Unable to load credentials from system settings. Secret key must be specified either via environment variable (AWS_SECRET_ACCESS_KEY) or system property (aws.secretAccessKey)., EnvironmentVariableCredentialsProvider(): Unable to load credentials from system settings. Access key must be specified either via environment variable (AWS_ACCESS_KEY_ID) or system property (aws.accessKeyId)., WebIdentityTokenCredentialsProvider(): Either the environment variable AWS_WEB_IDENTITY_TOKEN_FILE or the javaproperty aws.webIdentityTokenFile must be set., ProfileCredentialsProvider(profileName=default, profileFile=ProfileFile(profilesAndSectionsMap=[])): Profile file contained no credentials for profile 'default': ProfileFile(profilesAndSectionsMap=[]), ContainerCredentialsProvider(): Cannot fetch credentials from container - neither AWS_CONTAINER_CREDENTIALS_FULL_URI or AWS_CONTAINER_CREDENTIALS_RELATIVE_URI environment variables are set., InstanceProfileCredentialsProvider(): Failed to load credentials from IMDS.]
»   at software.amazon.awssdk.core.exception.SdkClientException$BuilderImpl.build(SdkClientException.java:111) ~[sdk-core-2.20.55.jar:?]
»   at software.amazon.awssdk.auth.credentials.AwsCredentialsProviderChain.resolveCredentials(AwsCredentialsProviderChain.java:117) ~[auth-2.20.55.jar:?]
»   at software.amazon.awssdk.auth.credentials.internal.LazyAwsCredentialsProvider.resolveCredentials(LazyAwsCredentialsProvider.java:45) ~[auth-2.20.55.jar:?]
»   at software.amazon.awssdk.auth.credentials.DefaultCredentialsProvider.resolveCredentials(DefaultCredentialsProvider.java:126) ~[auth-2.20.55.jar:?]
»   at software.amazon.awssdk.core.internal.util.MetricUtils.measureDuration(MetricUtils.java:50) ~[sdk-core-2.20.55.jar:?]
»   at software.amazon.awssdk.awscore.internal.authcontext.AwsCredentialsAuthorizationStrategy.resolveCredentials(AwsCredentialsAuthorizationStrategy.java:100) ~[aws-core-2.20.55.jar:?]
»   at software.amazon.awssdk.awscore.internal.authcontext.AwsCredentialsAuthorizationStrategy.addCredentialsToExecutionAttributes(AwsCredentialsAuthorizationStrategy.java:77) ~[aws-core-2.20.55.jar:?]
»   at software.amazon.awssdk.awscore.internal.AwsExecutionContextBuilder.invokeInterceptorsAndCreateExecutionContext(AwsExecutionContextBuilder.java:123) ~[aws-core-2.20.55.jar:?]
»   at software.amazon.awssdk.awscore.client.handler.AwsSyncClientHandler.invokeInterceptorsAndCreateExecutionContext(AwsSyncClientHandler.java:69) ~[aws-core-2.20.55.jar:?]
»   at software.amazon.awssdk.core.internal.handler.BaseSyncClientHandler.lambda$execute$1(BaseSyncClientHandler.java:78) ~[sdk-core-2.20.55.jar:?]
»   at software.amazon.awssdk.core.internal.handler.BaseSyncClientHandler.measureApiCallSuccess(BaseSyncClientHandler.java:179) ~[sdk-core-2.20.55.jar:?]
»   at software.amazon.awssdk.core.internal.handler.BaseSyncClientHandler.execute(BaseSyncClientHandler.java:76) ~[sdk-core-2.20.55.jar:?]
»   at software.amazon.awssdk.core.client.handler.SdkSyncClientHandler.execute(SdkSyncClientHandler.java:45) ~[sdk-core-2.20.55.jar:?]
»   at software.amazon.awssdk.awscore.client.handler.AwsSyncClientHandler.execute(AwsSyncClientHandler.java:56) ~[aws-core-2.20.55.jar:?]
»   at software.amazon.awssdk.services.ec2.DefaultEc2Client.describeInstances(DefaultEc2Client.java:18739) ~[ec2-2.20.55.jar:?]
»   at org.opensearch.discovery.ec2.AwsEc2SeedHostsProvider.lambda$fetchDynamicNodes$0(AwsEc2SeedHostsProvider.java:134) ~[discovery-ec2-3.0.0-SNAPSHOT.jar:3.0.0-SNAPSHOT]
»   at java.security.AccessController.doPrivileged(AccessController.java:318) ~[?:?]
»   at org.opensearch.discovery.ec2.SocketAccess.doPrivileged(SocketAccess.java:63) ~[discovery-ec2-3.0.0-SNAPSHOT.jar:3.0.0-SNAPSHOT]
»   at org.opensearch.discovery.ec2.AwsEc2SeedHostsProvider.fetchDynamicNodes(AwsEc2SeedHostsProvider.java:134) [discovery-ec2-3.0.0-SNAPSHOT.jar:3.0.0-SNAPSHOT]
»   at org.opensearch.discovery.ec2.AwsEc2SeedHostsProvider$TransportAddressesCache.refresh(AwsEc2SeedHostsProvider.java:258) [discovery-ec2-3.0.0-SNAPSHOT.jar:3.0.0-SNAPSHOT]
»   at org.opensearch.discovery.ec2.AwsEc2SeedHostsProvider$TransportAddressesCache.refresh(AwsEc2SeedHostsProvider.java:250) [discovery-ec2-3.0.0-SNAPSHOT.jar:3.0.0-SNAPSHOT]
»   at org.opensearch.common.util.SingleObjectCache.getOrRefresh(SingleObjectCache.java:68) [opensearch-3.0.0-SNAPSHOT.jar:3.0.0-SNAPSHOT]
»   at org.opensearch.discovery.ec2.AwsEc2SeedHostsProvider.getSeedAddresses(AwsEc2SeedHostsProvider.java:118) [discovery-ec2-3.0.0-SNAPSHOT.jar:3.0.0-SNAPSHOT]
»   at org.opensearch.discovery.DiscoveryModule.lambda$new$4(DiscoveryModule.java:182) [opensearch-3.0.0-SNAPSHOT.jar:3.0.0-SNAPSHOT]
»   at org.opensearch.discovery.SeedHostsResolver$1.doRun(SeedHostsResolver.java:275) [opensearch-3.0.0-SNAPSHOT.jar:3.0.0-SNAPSHOT]
»   at org.opensearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:806) [opensearch-3.0.0-SNAPSHOT.jar:3.0.0-SNAPSHOT]
»   at org.opensearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:52) [opensearch-3.0.0-SNAPSHOT.jar:3.0.0-SNAPSHOT]
»   at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144) [?:?]
»   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642) [?:?]
»   at java.lang.Thread.run(Thread.java:1589) [?:?]
»   ↑ repeated 7 times ↑
github-actions[bot] commented 1 year ago

Gradle Check (Jenkins) Run Completed with:

github-actions[bot] commented 1 year ago

Gradle Check (Jenkins) Run Completed with:

codecov[bot] commented 1 year ago

Codecov Report

Merging #7372 (a08cb1f) into main (ecd0879) will increase coverage by 0.16%. The diff coverage is 76.49%.

@@             Coverage Diff              @@
##               main    #7372      +/-   ##
============================================
+ Coverage     70.74%   70.91%   +0.16%     
- Complexity    56201    56333     +132     
============================================
  Files          4687     4689       +2     
  Lines        266242   266340      +98     
  Branches      39096    39098       +2     
============================================
+ Hits         188364   188870     +506     
+ Misses        61905    61505     -400     
+ Partials      15973    15965       -8     
Impacted Files Coverage Δ
...va/org/opensearch/discovery/ec2/AwsEc2Service.java 78.57% <ø> (ø)
...g/opensearch/discovery/ec2/Ec2DiscoveryPlugin.java 76.08% <0.00%> (-3.92%) :arrow_down:
...opensearch/repositories/s3/S3RepositoryPlugin.java 0.00% <ø> (-26.93%) :arrow_down:
.../org/opensearch/repositories/s3/ProxySettings.java 70.00% <50.00%> (+7.50%) :arrow_up:
...search/common/concurrent/RefCountedReleasable.java 90.00% <50.00%> (-10.00%) :arrow_down:
...ensearch/repositories/s3/utils/HttpRangeUtils.java 57.14% <57.14%> (ø)
...ensearch/repositories/s3/StatsMetricPublisher.java 59.25% <59.25%> (ø)
...nsearch/discovery/ec2/AwsEc2SeedHostsProvider.java 65.97% <66.66%> (+2.53%) :arrow_up:
...java/org/opensearch/repositories/s3/S3Service.java 75.26% <74.50%> (-5.11%) :arrow_down:
.../opensearch/repositories/s3/AmazonS3Reference.java 91.66% <75.00%> (ø)
... and 12 more

... and 429 files with indirect coverage changes

github-actions[bot] commented 1 year ago

Gradle Check (Jenkins) Run Completed with:

Bukhtawar commented 1 year ago

Looks like I approved only the EC2 changes there are more commits following in. Can we review both EC2 and S3 changes independently and merge finally?

github-actions[bot] commented 1 year ago

Gradle Check (Jenkins) Run Completed with:

dblock commented 1 year ago

Looks like I approved only the EC2 changes there are more commits following in. Can we review both EC2 and S3 changes independently and merge finally?

@raghuvanshraj and I decided to combine the two in 1 PR because the changes are quite similar in nature and we want to make sure we don't diverge across one or the other plugin (e.g. for override settings or how proxy is setup). There's some breaking changes that will need to be discussed together as well that affect both plugins.

The changes between the 2 plugins are isolated though, so you can look in subfolders in 1 PR.

Will mark this PR ready as soon as we've resolved all outstanding issues.

github-actions[bot] commented 1 year ago

Gradle Check (Jenkins) Run Completed with:

github-actions[bot] commented 1 year ago

Gradle Check (Jenkins) Run Completed with:

github-actions[bot] commented 1 year ago

Gradle Check (Jenkins) Run Completed with:

github-actions[bot] commented 1 year ago

Gradle Check (Jenkins) Run Completed with:

github-actions[bot] commented 1 year ago

Gradle Check (Jenkins) Run Completed with:

github-actions[bot] commented 1 year ago

Gradle Check (Jenkins) Run Completed with:

github-actions[bot] commented 1 year ago

Gradle Check (Jenkins) Run Completed with:

dblock commented 1 year ago

@Bukhtawar care to do a pass on this PR?

andrross commented 1 year ago

I'm not super familiar with the integration testing here. I see we have some test fixtures, but in my experience test fixtures rarely offer perfect fidelity with the real services. Is there any testing beyond the tests that already run that we should do?

github-actions[bot] commented 1 year ago

Gradle Check (Jenkins) Run Completed with:

github-actions[bot] commented 1 year ago

Gradle Check (Jenkins) Run Completed with:

github-actions[bot] commented 1 year ago

Gradle Check (Jenkins) Run Completed with:

github-actions[bot] commented 1 year ago

Gradle Check (Jenkins) Run Completed with:

reta commented 1 year ago

Massive one, @dblock :clap: :) did first pass

github-actions[bot] commented 1 year ago

Gradle Check (Jenkins) Run Completed with:

github-actions[bot] commented 1 year ago

Gradle Check (Jenkins) Run Completed with:

github-actions[bot] commented 1 year ago

Gradle Check (Jenkins) Run Completed with: