Search in sources :

Example 1 with AwsAsgUtil

use of com.netflix.eureka.aws.AwsAsgUtil in project eureka by Netflix.

the class AwsInstanceRegistry method init.

@Override
public void init(PeerEurekaNodes peerEurekaNodes) throws Exception {
    super.init(peerEurekaNodes);
    this.awsAsgUtil = new AwsAsgUtil(serverConfig, clientConfig, this);
    // We first check if the instance is STARTING or DOWN, then we check explicit overrides,
    // then we see if our ASG is UP, then we check the status of a potentially existing lease.
    this.instanceStatusOverrideRule = new FirstMatchWinsCompositeRule(new DownOrStartingRule(), new OverrideExistsRule(overriddenInstanceStatusMap), new AsgEnabledRule(this.awsAsgUtil), new LeaseExistsRule());
}
Also used : AsgEnabledRule(com.netflix.eureka.registry.rule.AsgEnabledRule) LeaseExistsRule(com.netflix.eureka.registry.rule.LeaseExistsRule) AwsAsgUtil(com.netflix.eureka.aws.AwsAsgUtil) FirstMatchWinsCompositeRule(com.netflix.eureka.registry.rule.FirstMatchWinsCompositeRule) OverrideExistsRule(com.netflix.eureka.registry.rule.OverrideExistsRule) DownOrStartingRule(com.netflix.eureka.registry.rule.DownOrStartingRule)

Example 2 with AwsAsgUtil

use of com.netflix.eureka.aws.AwsAsgUtil in project eureka by Netflix.

the class AwsAsgUtilTest method setUp.

@Before
public void setUp() throws Exception {
    ConfigurationManager.getConfigInstance().setProperty("eureka.awsAccessId", "fakeId");
    ConfigurationManager.getConfigInstance().setProperty("eureka.awsSecretKey", "fakeKey");
    AmazonInfo dataCenterInfo = mock(AmazonInfo.class);
    EurekaServerConfig serverConfig = new DefaultEurekaServerConfig();
    InstanceInfo.Builder builder = InstanceInfo.Builder.newBuilder();
    builder.setIPAddr("10.10.101.00");
    builder.setHostName("fakeHost");
    builder.setAppName("fake-" + UUID.randomUUID());
    builder.setLeaseInfo(LeaseInfo.Builder.newBuilder().build());
    builder.setDataCenterInfo(dataCenterInfo);
    instanceInfo = builder.build();
    applicationInfoManager = new ApplicationInfoManager(new MyDataCenterInstanceConfig(), instanceInfo);
    DefaultEurekaClientConfig clientConfig = new DefaultEurekaClientConfig();
    // setup config in advance, used in initialize converter
    client = mock(DiscoveryClient.class);
    registry = mock(PeerAwareInstanceRegistry.class);
    awsAsgUtil = spy(new AwsAsgUtil(serverConfig, clientConfig, registry));
}
Also used : DefaultEurekaClientConfig(com.netflix.discovery.DefaultEurekaClientConfig) DefaultEurekaServerConfig(com.netflix.eureka.DefaultEurekaServerConfig) MyDataCenterInstanceConfig(com.netflix.appinfo.MyDataCenterInstanceConfig) AwsAsgUtil(com.netflix.eureka.aws.AwsAsgUtil) DefaultEurekaServerConfig(com.netflix.eureka.DefaultEurekaServerConfig) EurekaServerConfig(com.netflix.eureka.EurekaServerConfig) DiscoveryClient(com.netflix.discovery.DiscoveryClient) AmazonInfo(com.netflix.appinfo.AmazonInfo) InstanceInfo(com.netflix.appinfo.InstanceInfo) ApplicationInfoManager(com.netflix.appinfo.ApplicationInfoManager) PeerAwareInstanceRegistry(com.netflix.eureka.registry.PeerAwareInstanceRegistry) Before(org.junit.Before)

Aggregations

AwsAsgUtil (com.netflix.eureka.aws.AwsAsgUtil)2 AmazonInfo (com.netflix.appinfo.AmazonInfo)1 ApplicationInfoManager (com.netflix.appinfo.ApplicationInfoManager)1 InstanceInfo (com.netflix.appinfo.InstanceInfo)1 MyDataCenterInstanceConfig (com.netflix.appinfo.MyDataCenterInstanceConfig)1 DefaultEurekaClientConfig (com.netflix.discovery.DefaultEurekaClientConfig)1 DiscoveryClient (com.netflix.discovery.DiscoveryClient)1 DefaultEurekaServerConfig (com.netflix.eureka.DefaultEurekaServerConfig)1 EurekaServerConfig (com.netflix.eureka.EurekaServerConfig)1 PeerAwareInstanceRegistry (com.netflix.eureka.registry.PeerAwareInstanceRegistry)1 AsgEnabledRule (com.netflix.eureka.registry.rule.AsgEnabledRule)1 DownOrStartingRule (com.netflix.eureka.registry.rule.DownOrStartingRule)1 FirstMatchWinsCompositeRule (com.netflix.eureka.registry.rule.FirstMatchWinsCompositeRule)1 LeaseExistsRule (com.netflix.eureka.registry.rule.LeaseExistsRule)1 OverrideExistsRule (com.netflix.eureka.registry.rule.OverrideExistsRule)1 Before (org.junit.Before)1