Skip to content
This repository has been archived by the owner on Feb 15, 2022. It is now read-only.

AWS CloudMap as a discovery mode for the peer forwarder #734

Merged

Conversation

dlvenable
Copy link
Contributor

Issue #, if available:

#730

Description of changes:

This PR includes:

  • Support for AWS CloudMap as a Peer Forwarder Discovery Mode. The new AwsCloudMapPeerListProvider class provides this implementation.
  • Documentation for AWS CloudMap as a Peer Forwarder Discovery Mode.
  • Refactoring how the PeerListProviderFactory and DiscoveryMode interact. This change adds compile-time checks on adding new DiscoveryMode values since you cannot add them without now including the create method.
  • The Peer Forwarder project uses JUnit 5

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.

…arder plugin. Addionally, refactored the interactions within the PeerListProviderFactory and DiscoveryMode classes. opendistro-for-elasticsearch#730

Signed-off-by: David Venable <dlv@amazon.com>
@dlvenable dlvenable requested review from dinujoh and chenqi0805 July 21, 2021 20:45
…and close these resources during testing. Use Awaitility for improved timing and to aid in reliable testing. opendistro-for-elasticsearch#730

Signed-off-by: David Venable <dlv@amazon.com>
}

@Override
protected void doCloseAsync(CompletableFuture<?> future) {
Copy link
Contributor

@dinujoh dinujoh Jul 22, 2021

Choose a reason for hiding this comment

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

Will this be invoked when the server is stopped or on SIGKILL signal ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is large part depends on how the Peer Forwarder uses the list. This is a Closeable interface, much like the DnsAddressEndpointGroup class. So the caller will need to close it in order for this to run.

…s, adding final modifiers, and formatting in the main files modified by this PR. opendistro-for-elasticsearch#730

Signed-off-by: David Venable <dlv@amazon.com>
Copy link
Contributor

@dinujoh dinujoh left a comment

Choose a reason for hiding this comment

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

One of the test cases is failing:

com.amazon.dataprepper.plugins.prepper.peerforwarder.discovery.AwsCloudMapPeerListProviderTest > WithDiscoverInstances > getPeerList_returns_list_as_found() FAILED
    org.awaitility.core.ConditionTimeoutException at AwsCloudMapPeerListProviderTest.java:204
        Caused by: java.lang.AssertionError at MatcherAssert.java:20

@dinujoh dinujoh self-requested a review July 22, 2021 22:55
…pPeerListProviderTest. opendistro-for-elasticsearch#730

Signed-off-by: David Venable <dlv@amazon.com>

* `awsCloudMapNamespaceName` - Set to your CloudMap Namespace name
* `awsCloudMapServiceName` - Set to the service name within your specified Namespace
* `awsRegion` - The AWS region where your namespace exists.
Copy link
Contributor

Choose a reason for hiding this comment

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

STY: Can we make the above snake case? Just for style consistency.

Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like we have the same issue in otel source. Maybe we can change them in separate PR

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is an inconsistency which I am seeing throughout the project. Since the awsRegion already existed, and I'm using it in my changes, I decided to use camelCase for my new properties.

pluginMetrics);
}

private static String getRequiredSettingString(final PluginSetting pluginSetting, final String propertyName) {
Copy link
Contributor

Choose a reason for hiding this comment

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

We might consider refactoring it into data-prepper API if it is used in multiple places. Just a note for now

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes. I think this also relates to another issue that came up. We have different exceptions for plugin errors. We should make these consistent.

Copy link
Contributor

@chenqi0805 chenqi0805 left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks for the work!

@dlvenable dlvenable merged commit c861793 into opendistro-for-elasticsearch:main Jul 23, 2021
@dlvenable dlvenable deleted the 730-aws-cloud-map branch October 13, 2021 18:31
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants