Skip to content

Commit

Permalink
Merge pull request #41 from rmohr/kubevirt-publish-info
Browse files Browse the repository at this point in the history
Add KubeVirt platform artifact and image information
  • Loading branch information
cgwalters committed Mar 15, 2022
2 parents 5f15aed + f5e41e9 commit 9dfda84
Show file tree
Hide file tree
Showing 7 changed files with 69 additions and 5 deletions.
14 changes: 14 additions & 0 deletions release/fixtures/fcos-release.json
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,20 @@
}
}
},
"kubevirt": {
"artifacts": {
"qcow2.xz": {
"disk": {
"location": "https://builds.coreos.fedoraproject.org/prod/streams/stable/builds/33.20201201.3.0/x86_64/fedora-coreos-33.20201201.3.0-kubevirt.x86_64.qcow2.xz",
"signature": "https://builds.coreos.fedoraproject.org/prod/streams/stable/builds/33.20201201.3.0/x86_64/fedora-coreos-33.20201201.3.0-kubevirt.x86_64.qcow2.xz.sig",
"sha256": "2be55c5aa1f53eb9a869826dacbab75706ee6bd59185b935ac9be546cc132a85"
}
}
},
"image": {
"image": "quay.io/openshift-release-dev/rhcos@sha256:67a81539946ec0397196c145394553b8e0241acf27b14ae9de43bc56e167f773"
}
},
"qemu": {
"artifacts": {
"qcow2.xz": {
Expand Down
12 changes: 12 additions & 0 deletions release/release.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ type Media struct {
Exoscale *PlatformBase `json:"exoscale"`
Gcp *PlatformGcp `json:"gcp"`
Ibmcloud *PlatformIBMCloud `json:"ibmcloud"`
KubeVirt *PlatformKubeVirt `json:"kubevirt"`
Metal *PlatformBase `json:"metal"`
Nutanix *PlatformBase `json:"nutanix"`
Openstack *PlatformBase `json:"openstack"`
Expand Down Expand Up @@ -98,6 +99,12 @@ type PlatformIBMCloud struct {
Images map[string]IBMCloudImage `json:"images"`
}

// PlatformKubeVirt containerDisk metadata
type PlatformKubeVirt struct {
PlatformBase
Image *KubeVirtContainerDisk `json:"image"`
}

// ImageFormat contains all artifacts for a single OS image
type ImageFormat struct {
Disk *Artifact `json:"disk,omitempty"`
Expand Down Expand Up @@ -132,3 +139,8 @@ type IBMCloudImage struct {
Bucket string `json:"bucket"`
Url string `json:"url"`
}

// KubeVirtContainerDisk describes a disk image inside a container which can be consumed by a KubeVirt based platform
type KubeVirtContainerDisk struct {
Image string `json:"image,omitempty"`
}
3 changes: 3 additions & 0 deletions release/release_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,7 @@ func TestTranslate(t *testing.T) {
Architectures: arches,
}
assert.Equal(t, st.Architectures["x86_64"].Images.Aws.Regions["us-east-2"].Image, usEast2Ami)

// KubeVirt
assert.Equal(t, st.Architectures["x86_64"].Images.KubeVirt.Image, "quay.io/openshift-release-dev/rhcos@sha256:67a81539946ec0397196c145394553b8e0241acf27b14ae9de43bc56e167f773")
}
12 changes: 12 additions & 0 deletions release/translate.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,18 @@ func (releaseArch *Arch) toStreamArch(rel *Release) stream.Arch {
}
}

if releaseArch.Media.KubeVirt != nil {
artifacts["kubevirt"] = stream.PlatformArtifacts{
Release: rel.Release,
Formats: mapFormats(releaseArch.Media.KubeVirt.Artifacts),
}
if releaseArch.Media.KubeVirt.Image != nil {
cloudImages.KubeVirt = &stream.KubeVirtContainerDisk{
Image: releaseArch.Media.KubeVirt.Image.Image,
}
}
}

if releaseArch.Media.Digitalocean != nil {
artifacts["digitalocean"] = stream.PlatformArtifacts{
Release: rel.Release,
Expand Down
15 changes: 15 additions & 0 deletions stream/fixtures/fcos-stream.json
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,18 @@
}
}
},
"kubevirt": {
"release": "33.20201201.3.0",
"formats": {
"qcow2.xz": {
"disk": {
"location": "https://builds.coreos.fedoraproject.org/prod/streams/stable/builds/33.20201201.3.0/x86_64/fedora-coreos-33.20201201.3.0-kubevirt.x86_64.qcow2.xz",
"signature": "https://builds.coreos.fedoraproject.org/prod/streams/stable/builds/33.20201201.3.0/x86_64/fedora-coreos-33.20201201.3.0-kubevirt.x86_64.qcow2.xz.sig",
"sha256": "2be55c5aa1f53eb9a869826dacbab75706ee6bd59185b935ac9be546cc132a85"
}
}
}
},
"qemu": {
"release": "33.20201201.3.0",
"formats": {
Expand Down Expand Up @@ -372,6 +384,9 @@
"project": "fedora-coreos-cloud",
"family": "fedora-coreos-stable",
"name": "fedora-coreos-33-20201201-3-0-gcp-x86-64"
},
"kubevirt": {
"image": "quay.io/openshift-release-dev/rhcos@sha256:67a81539946ec0397196c145394553b8e0241acf27b14ae9de43bc56e167f773"
}
}
}
Expand Down
15 changes: 10 additions & 5 deletions stream/stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,18 @@ type Artifact struct {
UncompressedSha256 string `json:"uncompressed-sha256,omitempty"`
}

type KubeVirtContainerDisk struct {
Image string `json:"image,omitempty"`
}

// Images contains images available in cloud providers
type Images struct {
Aliyun *ReplicatedImage `json:"aliyun,omitempty"`
Aws *AwsImage `json:"aws,omitempty"`
Gcp *GcpImage `json:"gcp,omitempty"`
Ibmcloud *ReplicatedObject `json:"ibmcloud,omitempty"`
PowerVS *ReplicatedObject `json:"powervs,omitempty"`
Aliyun *ReplicatedImage `json:"aliyun,omitempty"`
Aws *AwsImage `json:"aws,omitempty"`
Gcp *GcpImage `json:"gcp,omitempty"`
Ibmcloud *ReplicatedObject `json:"ibmcloud,omitempty"`
PowerVS *ReplicatedObject `json:"powervs,omitempty"`
KubeVirt *KubeVirtContainerDisk `json:"kubevirt,omitempty"`
}

// ReplicatedImage represents an image in all regions of an AWS-like cloud
Expand Down
3 changes: 3 additions & 0 deletions stream/stream_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,7 @@ func TestParseFCS(t *testing.T) {
_, err = stream.QueryDisk("nonarch", "", "nosuchthing")
assert.NotNil(t, err)
assert.Contains(t, err.Error(), "does not have architecture 'nonarch'")

assert.Equal(t, stream.Architectures["x86_64"].Images.KubeVirt.Image, "quay.io/openshift-release-dev/rhcos@sha256:67a81539946ec0397196c145394553b8e0241acf27b14ae9de43bc56e167f773")
assert.Equal(t, stream.Architectures["x86_64"].Artifacts["kubevirt"].Formats["qcow2.xz"].Disk.Sha256, "2be55c5aa1f53eb9a869826dacbab75706ee6bd59185b935ac9be546cc132a85")
}

0 comments on commit 9dfda84

Please sign in to comment.