forked from elastic/elasticsearch
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'upstream/main' into inference_metadata_…
…fields
- Loading branch information
Showing
20 changed files
with
447 additions
and
421 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
pr: 117748 | ||
summary: Add IMDSv2 support to `repository-s3` | ||
area: Snapshot/Restore | ||
type: enhancement | ||
issues: | ||
- 105135 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
75 changes: 75 additions & 0 deletions
75
...aRestTest/java/org/elasticsearch/repositories/s3/RepositoryS3ImdsV2CredentialsRestIT.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the "Elastic License | ||
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side | ||
* Public License v 1"; you may not use this file except in compliance with, at | ||
* your election, the "Elastic License 2.0", the "GNU Affero General Public | ||
* License v3.0 only", or the "Server Side Public License, v 1". | ||
*/ | ||
|
||
package org.elasticsearch.repositories.s3; | ||
|
||
import fixture.aws.imds.Ec2ImdsHttpFixture; | ||
import fixture.aws.imds.Ec2ImdsVersion; | ||
import fixture.s3.DynamicS3Credentials; | ||
import fixture.s3.S3HttpFixture; | ||
|
||
import com.carrotsearch.randomizedtesting.annotations.ThreadLeakFilters; | ||
import com.carrotsearch.randomizedtesting.annotations.ThreadLeakScope; | ||
|
||
import org.elasticsearch.test.cluster.ElasticsearchCluster; | ||
import org.elasticsearch.test.fixtures.testcontainers.TestContainersThreadFilter; | ||
import org.junit.ClassRule; | ||
import org.junit.rules.RuleChain; | ||
import org.junit.rules.TestRule; | ||
|
||
import java.util.Set; | ||
|
||
@ThreadLeakFilters(filters = { TestContainersThreadFilter.class }) | ||
@ThreadLeakScope(ThreadLeakScope.Scope.NONE) // https://github.com/elastic/elasticsearch/issues/102482 | ||
public class RepositoryS3ImdsV2CredentialsRestIT extends AbstractRepositoryS3RestTestCase { | ||
|
||
private static final String PREFIX = getIdentifierPrefix("RepositoryS3ImdsV2CredentialsRestIT"); | ||
private static final String BUCKET = PREFIX + "bucket"; | ||
private static final String BASE_PATH = PREFIX + "base_path"; | ||
private static final String CLIENT = "imdsv2_credentials_client"; | ||
|
||
private static final DynamicS3Credentials dynamicS3Credentials = new DynamicS3Credentials(); | ||
|
||
private static final Ec2ImdsHttpFixture ec2ImdsHttpFixture = new Ec2ImdsHttpFixture( | ||
Ec2ImdsVersion.V2, | ||
dynamicS3Credentials::addValidCredentials, | ||
Set.of() | ||
); | ||
|
||
private static final S3HttpFixture s3Fixture = new S3HttpFixture(true, BUCKET, BASE_PATH, dynamicS3Credentials::isAuthorized); | ||
|
||
public static ElasticsearchCluster cluster = ElasticsearchCluster.local() | ||
.module("repository-s3") | ||
.setting("s3.client." + CLIENT + ".endpoint", s3Fixture::getAddress) | ||
.systemProperty("com.amazonaws.sdk.ec2MetadataServiceEndpointOverride", ec2ImdsHttpFixture::getAddress) | ||
.build(); | ||
|
||
@ClassRule | ||
public static TestRule ruleChain = RuleChain.outerRule(ec2ImdsHttpFixture).around(s3Fixture).around(cluster); | ||
|
||
@Override | ||
protected String getTestRestCluster() { | ||
return cluster.getHttpAddresses(); | ||
} | ||
|
||
@Override | ||
protected String getBucketName() { | ||
return BUCKET; | ||
} | ||
|
||
@Override | ||
protected String getBasePath() { | ||
return BASE_PATH; | ||
} | ||
|
||
@Override | ||
protected String getClientName() { | ||
return CLIENT; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.