diff options
author | Martin Polden <mpolden@mpolden.no> | 2019-09-06 08:50:18 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-09-06 08:50:18 +0200 |
commit | 8ddea5bd559774c2aa11fef876ec32c0d6e8da40 (patch) | |
tree | b96a7a0017862c584d36f364769d5506252af620 /controller-api | |
parent | 0584e536fa4ba962f909c03722ce26e871682005 (diff) | |
parent | 7de52d84f91839a0d12e706ebc5c4796281d5ba2 (diff) |
Merge pull request #10515 from vespa-engine/mpolden/service-registry-3
Move services to ServiceRegistry part III
Diffstat (limited to 'controller-api')
6 files changed, 66 insertions, 8 deletions
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/ServiceRegistry.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/ServiceRegistry.java index d9a88f665c7..d74dbe13acb 100644 --- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/ServiceRegistry.java +++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/ServiceRegistry.java @@ -4,7 +4,14 @@ package com.yahoo.vespa.hosted.controller.api.integration; import com.yahoo.vespa.hosted.controller.api.integration.certificates.ApplicationCertificateProvider; import com.yahoo.vespa.hosted.controller.api.integration.configserver.ConfigServer; import com.yahoo.vespa.hosted.controller.api.integration.dns.NameService; +import com.yahoo.vespa.hosted.controller.api.integration.entity.EntityService; +import com.yahoo.vespa.hosted.controller.api.integration.organization.ContactRetriever; +import com.yahoo.vespa.hosted.controller.api.integration.organization.IssueHandler; +import com.yahoo.vespa.hosted.controller.api.integration.organization.DeploymentIssues; import com.yahoo.vespa.hosted.controller.api.integration.organization.Mailer; +import com.yahoo.vespa.hosted.controller.api.integration.organization.OwnershipIssues; +import com.yahoo.vespa.hosted.controller.api.integration.resource.CostReportConsumer; +import com.yahoo.vespa.hosted.controller.api.integration.resource.MeteringClient; import com.yahoo.vespa.hosted.controller.api.integration.routing.GlobalRoutingService; import com.yahoo.vespa.hosted.controller.api.integration.routing.RoutingGenerator; @@ -29,4 +36,18 @@ public interface ServiceRegistry { ApplicationCertificateProvider applicationCertificateProvider(); + MeteringClient meteringService(); + + ContactRetriever contactRetriever(); + + IssueHandler issueHandler(); + + OwnershipIssues ownershipIssues(); + + DeploymentIssues deploymentIssues(); + + EntityService entityService(); + + CostReportConsumer costReportConsumer(); + } diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/certificates/ApplicationCertificateMock.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/certificates/ApplicationCertificateMock.java new file mode 100644 index 00000000000..70e82877096 --- /dev/null +++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/certificates/ApplicationCertificateMock.java @@ -0,0 +1,20 @@ +// Copyright 2019 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.vespa.hosted.controller.api.integration.certificates; + +import com.yahoo.config.provision.ApplicationId; + +import java.util.UUID; + +/** + * @author tokle + */ +public class ApplicationCertificateMock implements ApplicationCertificateProvider { + + @Override + public ApplicationCertificate requestCaSignedCertificate(ApplicationId applicationId) { + return new ApplicationCertificate(String.format("vespa.tls.%s.%s@%s", applicationId.tenant(), + applicationId.application(), + UUID.randomUUID().toString())); + } + +} diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/entity/MemoryEntityService.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/entity/MemoryEntityService.java index c5400e2d8e7..a1e633becc6 100644 --- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/entity/MemoryEntityService.java +++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/entity/MemoryEntityService.java @@ -1,11 +1,10 @@ // 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.entity; +import com.google.common.collect.ImmutableMap; import com.yahoo.vespa.hosted.controller.api.identifiers.Property; import com.yahoo.vespa.hosted.controller.api.identifiers.PropertyId; -import java.util.Collections; -import java.util.HashMap; import java.util.Map; /** @@ -15,10 +14,8 @@ public class MemoryEntityService implements EntityService { @Override public Map<PropertyId, Property> listProperties() { - Map<PropertyId, Property> properties = new HashMap<>(); - properties.put(new PropertyId("1234"), new Property("foo")); - properties.put(new PropertyId("4321"), new Property("bar")); - return Collections.unmodifiableMap(properties); + return ImmutableMap.of(new PropertyId("1234"), new Property("foo"), + new PropertyId("4321"), new Property("bar")); } } diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/organization/MockContactRetriever.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/organization/MockContactRetriever.java index 7fbd1a955a1..dd0c143ae28 100644 --- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/organization/MockContactRetriever.java +++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/organization/MockContactRetriever.java @@ -1,7 +1,6 @@ // Copyright 2018 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.organization; -import com.yahoo.component.AbstractComponent; import com.yahoo.vespa.hosted.controller.api.identifiers.PropertyId; import java.net.URI; @@ -13,7 +12,7 @@ import java.util.Optional; /** * @author olaa */ -public class MockContactRetriever extends AbstractComponent implements ContactRetriever{ +public class MockContactRetriever implements ContactRetriever{ private final Map<PropertyId, Contact> contacts = new HashMap<>(); diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/resource/CostReportConsumer.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/resource/CostReportConsumer.java new file mode 100644 index 00000000000..5c4bfcf219d --- /dev/null +++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/resource/CostReportConsumer.java @@ -0,0 +1,16 @@ +package com.yahoo.vespa.hosted.controller.api.integration.resource; + +import com.yahoo.vespa.hosted.controller.api.identifiers.Property; + +import java.util.Map; + +/** + * @author ldalves + */ +public interface CostReportConsumer { + + void consume(String csv); + + Map<Property, ResourceAllocation> fixedAllocations(); + +} diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/resource/ResourceAllocation.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/resource/ResourceAllocation.java index e30d2d55f77..bea34567752 100644 --- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/resource/ResourceAllocation.java +++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/resource/ResourceAllocation.java @@ -41,5 +41,10 @@ public class ResourceAllocation { return new ResourceAllocation(cpuCores + allocation.cpuCores, memoryGb + allocation.memoryGb, diskGb + allocation.diskGb); } + /** Returns a copy of this with each resource multiplied by given factor */ + public ResourceAllocation multiply(double multiplicand) { + return new ResourceAllocation(cpuCores * multiplicand, memoryGb * multiplicand, diskGb * multiplicand); + } + } |