diff options
author | Martin Polden <mpolden@mpolden.no> | 2022-05-06 13:45:23 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-06 13:45:23 +0200 |
commit | e5b6198b1928184be21ea7f5d1d08b95c5647e3f (patch) | |
tree | 890bb52fc94328ad2e1bdb0ee797e659c87cf0bd /controller-api | |
parent | 3779f063d0647063309275a39778c3ffcf94839d (diff) | |
parent | 776dc24d57f0d9f49412eeb33e4c912c7fe561c9 (diff) |
Merge pull request #22478 from vespa-engine/freva/gcp-artifact-retention
Prepare for adding GCP ArtifactExpirer
Diffstat (limited to 'controller-api')
-rw-r--r-- | controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/ServiceRegistry.java | 6 | ||||
-rw-r--r-- | controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/artifact/Artifact.java (renamed from controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/container/ContainerImage.java) | 49 | ||||
-rw-r--r-- | controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/artifact/ArtifactRegistry.java | 20 | ||||
-rw-r--r-- | controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/artifact/package-info.java (renamed from controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/container/package-info.java) | 2 | ||||
-rw-r--r-- | controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/container/ContainerRegistry.java | 20 |
5 files changed, 43 insertions, 54 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 be32b74591b..52f687e5708 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 @@ -1,9 +1,11 @@ // Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.hosted.controller.api.integration; +import com.yahoo.config.provision.CloudName; import com.yahoo.config.provision.HostName; import com.yahoo.vespa.hosted.controller.api.identifiers.ControllerVersion; import com.yahoo.vespa.hosted.controller.api.integration.archive.ArchiveService; +import com.yahoo.vespa.hosted.controller.api.integration.artifact.ArtifactRegistry; import com.yahoo.vespa.hosted.controller.api.integration.athenz.AccessControlService; import com.yahoo.vespa.hosted.controller.api.integration.aws.CloudEventFetcher; import com.yahoo.vespa.hosted.controller.api.integration.aws.ResourceTagger; @@ -14,7 +16,6 @@ import com.yahoo.vespa.hosted.controller.api.integration.billing.PlanRegistry; import com.yahoo.vespa.hosted.controller.api.integration.certificates.EndpointCertificateProvider; import com.yahoo.vespa.hosted.controller.api.integration.certificates.EndpointCertificateValidator; 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; @@ -36,6 +37,7 @@ import com.yahoo.vespa.hosted.controller.api.integration.vcmr.ChangeRequestClien import com.yahoo.vespa.hosted.controller.api.integration.zone.ZoneRegistry; import java.time.Clock; +import java.util.Optional; /** * This provides access to all service dependencies of the controller. Implementations of this are responsible for @@ -99,7 +101,7 @@ public interface ServiceRegistry { BillingDatabaseClient billingDatabase(); - ContainerRegistry containerRegistry(); + Optional<? extends ArtifactRegistry> artifactRegistry(CloudName cloudName); TenantSecretService tenantSecretService(); 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/artifact/Artifact.java index 9652eeef530..7ca372f6cd0 100644 --- 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/artifact/Artifact.java @@ -1,33 +1,32 @@ // Copyright Yahoo. 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; +package com.yahoo.vespa.hosted.controller.api.integration.artifact; import com.yahoo.component.Version; import java.time.Instant; import java.util.Objects; -import java.util.Optional; /** - * A container image. + * A registry artifact (e.g. container image or RPM) * * @author mpolden */ -public class ContainerImage { +public class Artifact { private final String id; private final String registry; private final String repository; + private final String tag; private final Instant createdAt; private final Version version; - private final Optional<Architecture> architecture; - public ContainerImage(String id, String registry, String repository, Instant createdAt, Version version, Optional<Architecture> architecture) { + public Artifact(String id, String registry, String repository, String tag, Instant createdAt, Version version) { this.id = Objects.requireNonNull(id); this.registry = Objects.requireNonNull(registry); this.repository = Objects.requireNonNull(repository); + this.tag = Objects.requireNonNull(tag); this.createdAt = Objects.requireNonNull(createdAt); this.version = Objects.requireNonNull(version); - this.architecture = Objects.requireNonNull(architecture); } /** Unique identifier of this */ @@ -35,16 +34,21 @@ public class ContainerImage { return id; } - /** The registry holding this image */ + /** The registry holding this artifact */ public String registry() { return registry; } - /** Repository of this image */ + /** Repository of this artifact */ public String repository() { return repository; } + /** Tag of this artifact */ + public String tag() { + return tag; + } + /** The time this was created */ public Instant createdAt() { return createdAt; @@ -55,43 +59,26 @@ public class ContainerImage { return version; } - /** The architecture of this, if any */ - public Optional<Architecture> architecture() { - return architecture; - } - - /** The tag of this image */ - public String tag() { - return version().toFullString() + architecture.map(arch -> "-" + arch.name()).orElse(""); - } - @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; - ContainerImage that = (ContainerImage) o; + Artifact that = (Artifact) o; return id.equals(that.id) && registry.equals(that.registry) && repository.equals(that.repository) && + tag.equals(that.tag) && createdAt.equals(that.createdAt) && - version.equals(that.version) && - architecture.equals(that.architecture); + version.equals(that.version); } @Override public int hashCode() { - return Objects.hash(id, registry, repository, createdAt, version, architecture); + return Objects.hash(id, registry, repository, tag, createdAt, version); } @Override public String toString() { - return "container image " + repository + " [registry=" + registry + ",version=" + version.toFullString() + - ",createdAt=" + createdAt + ",architecture=" + architecture.map(Enum::name).orElse("<none>") + "]"; + return "artifact " + registry + "/" + repository + " [version=" + version.toFullString() + ",createdAt=" + createdAt + ",tag=" + tag + "]"; } - - public enum Architecture { - amd64, - arm64, - } - } diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/artifact/ArtifactRegistry.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/artifact/ArtifactRegistry.java new file mode 100644 index 00000000000..6ab8409ad11 --- /dev/null +++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/artifact/ArtifactRegistry.java @@ -0,0 +1,20 @@ +// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.vespa.hosted.controller.api.integration.artifact; + + +import java.util.List; + +/** + * A registry of artifacts (e.g. container image or RPM). + * + * @author mpolden + */ +public interface ArtifactRegistry { + + /** Delete all given artifacts */ + void deleteAll(List<Artifact> artifacts); + + /** Returns a list of all artifacts in this system */ + List<Artifact> list(); + +} diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/container/package-info.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/artifact/package-info.java index ca1f6afc5db..8e12be06583 100644 --- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/container/package-info.java +++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/artifact/package-info.java @@ -3,6 +3,6 @@ * @author mpolden */ @ExportPackage -package com.yahoo.vespa.hosted.controller.api.integration.container; +package com.yahoo.vespa.hosted.controller.api.integration.artifact; import com.yahoo.osgi.annotation.ExportPackage; 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 deleted file mode 100644 index 78757ad995a..00000000000 --- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/container/ContainerRegistry.java +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright Yahoo. 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(); - -} |