summaryrefslogtreecommitdiffstats
path: root/controller-api
diff options
context:
space:
mode:
authorMartin Polden <mpolden@mpolden.no>2020-11-03 11:23:59 +0100
committerMartin Polden <mpolden@mpolden.no>2020-11-03 11:23:59 +0100
commit8e628d458757d5ed5a77ee791a29b39e4effded3 (patch)
tree032e97b7678fe92262a3cb8c259d0a6bfd10e9d6 /controller-api
parent150a472967f7350b1e65be4d75fde5ad7f3af669 (diff)
Expire stale container images
Diffstat (limited to 'controller-api')
-rw-r--r--controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/ServiceRegistry.java4
-rw-r--r--controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/container/ContainerImage.java78
-rw-r--r--controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/container/ContainerRegistry.java20
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();
+
+}