-
Notifications
You must be signed in to change notification settings - Fork 24.8k
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
Update ec2 secure settings #29134
Update ec2 secure settings #29134
Conversation
Pinging @elastic/es-distributed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
left some minors. LGTM
public void close() throws IOException { | ||
if (client != null) { | ||
client.shutdown(); | ||
public AmazonEc2Reference client() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we can generalizer this and maybe have a utils class in core that does what we do here. Operate on refcounted and maintain a map. Then we can also have a factory method and that way we share most of the logic. Maybe a followup.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
++ This is becoming a pattern and the code is duplicated. I will do the refactoring as the last PR to this branch, to make sure I account for all distinctions of all use cases.
import org.elasticsearch.common.unit.TimeValue; | ||
import java.util.Locale; | ||
|
||
public class Ec2ClientSettings { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
++ make the class final? and add a short javadoc?
for (int i=0; i<3; i++) { | ||
provider.buildDynamicNodes(); | ||
assertThat(provider.fetchCount, is(1)); | ||
Thread.sleep(1_000L); // wait for cache to expire |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
while we are on it.. maybe there is a way to expire the cache manually without sleeping?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To expire the cache manually it will require mocking the DiscoNodesCache
which is part of what this test is about. I think we should not do this.
I think this is related to #28452 , which requires a more "smarter" discovery nodes cache. I will address this test in the scope of that issue.
This is the analogous of #28517 for the ec2 client settings.
The approach is the same: use a client registry that allows for the client settings to change. Users should not cache the client, instead request one on each use.
Note:
This intentionally duplicates some code from the S3 reload settings PR. The factoring of the common bits will be done as the last step, when all reload requirements have been addressed.