summaryrefslogtreecommitdiffstats
path: root/controller-api
diff options
context:
space:
mode:
authorMartin Polden <mpolden@mpolden.no>2022-05-04 15:04:11 +0200
committerMartin Polden <mpolden@mpolden.no>2022-05-04 15:04:11 +0200
commit817e652b91158cfb4ce0a705b8ecb006b340a7d9 (patch)
tree051cedb8f7cb38f2c02dda01e1348c631fc78a9c /controller-api
parentf25396044fbc0f0ab4ee4b84100893ccbbd5be29 (diff)
Include architecture in ContainerImage tag
Diffstat (limited to 'controller-api')
-rw-r--r--controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/container/ContainerImage.java27
1 files changed, 23 insertions, 4 deletions
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
index 739ad835762..9652eeef530 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/container/ContainerImage.java
@@ -5,6 +5,7 @@ import com.yahoo.component.Version;
import java.time.Instant;
import java.util.Objects;
+import java.util.Optional;
/**
* A container image.
@@ -18,13 +19,15 @@ public class ContainerImage {
private final String repository;
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) {
+ public ContainerImage(String id, String registry, String repository, Instant createdAt, Version version, Optional<Architecture> architecture) {
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);
+ this.architecture = Objects.requireNonNull(architecture);
}
/** Unique identifier of this */
@@ -52,6 +55,16 @@ 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;
@@ -61,18 +74,24 @@ public class ContainerImage {
registry.equals(that.registry) &&
repository.equals(that.repository) &&
createdAt.equals(that.createdAt) &&
- version.equals(that.version);
+ version.equals(that.version) &&
+ architecture.equals(that.architecture);
}
@Override
public int hashCode() {
- return Objects.hash(id, registry, repository, createdAt, version);
+ return Objects.hash(id, registry, repository, createdAt, version, architecture);
}
@Override
public String toString() {
return "container image " + repository + " [registry=" + registry + ",version=" + version.toFullString() +
- ",createdAt=" + createdAt + "]";
+ ",createdAt=" + createdAt + ",architecture=" + architecture.map(Enum::name).orElse("<none>") + "]";
+ }
+
+ public enum Architecture {
+ amd64,
+ arm64,
}
}