diff options
author | HÃ¥kon Hallingstad <hakon.hallingstad@gmail.com> | 2020-11-04 12:32:02 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-04 12:32:02 +0100 |
commit | f350ff36a625186296e908f3d132662500a907d9 (patch) | |
tree | 793e5ad22b2e5930cf3bbab81d72d6fdb9e97e7f /controller-api | |
parent | 758771b52b1eaed618f21ded7c80fa6c9ff0b1fb (diff) |
Revert "Revert "Expire stale container images""
Diffstat (limited to 'controller-api')
3 files changed, 102 insertions, 0 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 7b4d82a9f53..8f2d2161f92 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 @@ -7,6 +7,7 @@ import com.yahoo.vespa.hosted.controller.api.integration.aws.ResourceTagger; import com.yahoo.vespa.hosted.controller.api.integration.billing.BillingController; import com.yahoo.vespa.hosted.controller.api.integration.certificates.EndpointCertificateProvider; import com.yahoo.vespa.hosted.controller.api.integration.configserver.ConfigServer; +import com.yahoo.vespa.hosted.controller.api.integration.container.ContainerRegistry; import com.yahoo.vespa.hosted.controller.api.integration.deployment.ApplicationStore; import com.yahoo.vespa.hosted.controller.api.integration.deployment.ArtifactRepository; import com.yahoo.vespa.hosted.controller.api.integration.deployment.TesterCloud; @@ -81,4 +82,7 @@ public interface ServiceRegistry { BillingController billingController(); HostRepairClient hostRepairClient(); + + ContainerRegistry containerRegistry(); + } diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/container/ContainerImage.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/container/ContainerImage.java new file mode 100644 index 00000000000..904c64a2197 --- /dev/null +++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/container/ContainerImage.java @@ -0,0 +1,78 @@ +// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.vespa.hosted.controller.api.integration.container; + +import com.yahoo.component.Version; + +import java.time.Instant; +import java.util.Objects; + +/** + * A container image. + * + * @author mpolden + */ +public class ContainerImage { + + private final String id; + private final String registry; + private final String repository; + private final Instant createdAt; + private final Version version; + + public ContainerImage(String id, String registry, String repository, Instant createdAt, Version version) { + this.id = Objects.requireNonNull(id); + this.registry = Objects.requireNonNull(registry); + this.repository = Objects.requireNonNull(repository); + this.createdAt = Objects.requireNonNull(createdAt); + this.version = Objects.requireNonNull(version); + } + + /** Unique identifier of this */ + public String id() { + return id; + } + + /** The registry holding this image */ + public String registry() { + return registry; + } + + /** Repository of this image */ + public String repository() { + return repository; + } + + /** The time this was created */ + public Instant createdAt() { + return createdAt; + } + + /** The version of this */ + public Version version() { + return version; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + ContainerImage that = (ContainerImage) o; + return id.equals(that.id) && + registry.equals(that.registry) && + repository.equals(that.repository) && + createdAt.equals(that.createdAt) && + version.equals(that.version); + } + + @Override + public int hashCode() { + return Objects.hash(id, registry, repository, createdAt, version); + } + + @Override + public String toString() { + return "container image " + repository + " [registry=" + registry + ",version=" + version.toFullString() + + ",createdAt=" + createdAt + "]"; + } + +} diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/container/ContainerRegistry.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/container/ContainerRegistry.java new file mode 100644 index 00000000000..f11c474415b --- /dev/null +++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/container/ContainerRegistry.java @@ -0,0 +1,20 @@ +// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.vespa.hosted.controller.api.integration.container; + + +import java.util.List; + +/** + * A registry of container images. + * + * @author mpolden + */ +public interface ContainerRegistry { + + /** Delete all given images */ + void deleteAll(List<ContainerImage> images); + + /** Returns a list of all container images in this system */ + List<ContainerImage> list(); + +} |