diff options
author | Morten Tokle <mortent@oath.com> | 2019-01-16 13:37:32 +0100 |
---|---|---|
committer | Morten Tokle <mortent@oath.com> | 2019-01-24 15:31:33 +0100 |
commit | 894c4fdd551f11f415c08c09af64c3228a57d74a (patch) | |
tree | 72ce74677e2635ae23a76b392c25bdb68e67dd24 /controller-api | |
parent | 1ed75a5681fc19966fdb1940f3f55e6c8f5c2c76 (diff) |
Maintainer updating name service for load balancers
Diffstat (limited to 'controller-api')
4 files changed, 66 insertions, 2 deletions
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/configserver/ConfigServer.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/configserver/ConfigServer.java index e3599b3e652..ad52ba48d4e 100644 --- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/configserver/ConfigServer.java +++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/configserver/ConfigServer.java @@ -71,4 +71,6 @@ public interface ConfigServer { /** Get service convergence status for given deployment */ Optional<ServiceConvergence> serviceConvergence(DeploymentId deployment); + List<LoadBalancer> getLoadBalancers(DeploymentId deployment); + } diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/configserver/LoadBalancer.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/configserver/LoadBalancer.java new file mode 100644 index 00000000000..a0cb76860a7 --- /dev/null +++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/configserver/LoadBalancer.java @@ -0,0 +1,48 @@ +// Copyright 2019 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.vespa.hosted.controller.api.integration.configserver; + +import com.yahoo.vespa.hosted.controller.api.identifiers.ApplicationId; +import com.yahoo.vespa.hosted.controller.api.identifiers.InstanceId; +import com.yahoo.vespa.hosted.controller.api.identifiers.TenantId; + +public class LoadBalancer { + private final String id; + private final TenantId tenant; + private final ApplicationId application; + private final InstanceId instance; + private final String cluster; + private final String hostname; + + public LoadBalancer(String id, TenantId tenant, ApplicationId application, InstanceId instance, String cluster, String hostname) { + this.id = id; + this.tenant = tenant; + this.application = application; + this.instance = instance; + this.cluster = cluster; + this.hostname = hostname; + } + + public String id() { + return id; + } + + public TenantId tenant() { + return tenant; + } + + public ApplicationId application() { + return application; + } + + public InstanceId instance() { + return instance; + } + + public String cluster() { + return cluster; + } + + public String hostname() { + return hostname; + } +} diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/dns/MemoryNameService.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/dns/MemoryNameService.java index 06599aa0b82..aca7562df6f 100644 --- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/dns/MemoryNameService.java +++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/dns/MemoryNameService.java @@ -7,7 +7,6 @@ import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Optional; -import java.util.UUID; import java.util.stream.Collectors; /** @@ -25,7 +24,7 @@ public class MemoryNameService implements NameService { @Override public RecordId createCname(RecordName alias, RecordData canonicalName) { - RecordId id = new RecordId(UUID.randomUUID().toString()); + RecordId id = new RecordId(alias.asString()); records.put(id, new Record(id, Record.Type.CNAME, alias, canonicalName)); return id; } diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/dns/RecordId.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/dns/RecordId.java index da42c38252a..2aa3f4a810e 100644 --- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/dns/RecordId.java +++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/dns/RecordId.java @@ -1,6 +1,8 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.hosted.controller.api.integration.dns; +import java.util.Objects; + /** * Unique identifier for a resource record. * @@ -24,4 +26,17 @@ public class RecordId { "id='" + id + '\'' + '}'; } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + RecordId recordId = (RecordId) o; + return id.equals(recordId.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } } |