diff --git a/api/protobuf-spec/github_com_openshift_api_image_v1.proto b/api/protobuf-spec/github_com_openshift_api_image_v1.proto index 417a6c1bb29d..b02bd6cc5829 100644 --- a/api/protobuf-spec/github_com_openshift_api_image_v1.proto +++ b/api/protobuf-spec/github_com_openshift_api_image_v1.proto @@ -70,16 +70,23 @@ message Image { // ImageBlobReferences describes the blob references within an image. message ImageBlobReferences { + // imageMissing is true if the image is referenced by the image stream but the image + // object has been deleted from the API by an administrator. When this field is set, + // layers and config fields may be empty and callers that depend on the image metadata + // should consider the image to be unavailable for download or viewing. + // +optional + optional bool imageMissing = 3; + // layers is the list of blobs that compose this image, from base layer to top layer. // All layers referenced by this array will be defined in the blobs map. Some images // may have zero layers. // +optional repeated string layers = 1; - // manifest, if set, is the blob that contains the image manifest. Some images do - // not have separate manifest blobs and this field will be set to nil if so. + // config, if set, is the blob that contains the image config. Some images do + // not have separate config blobs and this field will be set to nil if so. // +optional - optional string manifest = 2; + optional string config = 2; } // ImageImportSpec describes a request to import a specific image. @@ -270,7 +277,7 @@ message ImageStreamLayers { // blobs is a map of blob name to metadata about the blob. map blobs = 2; - // images is a map between an image name and the names of the blobs and manifests that + // images is a map between an image name and the names of the blobs and config that // comprise the image. map images = 3; } diff --git a/api/swagger-spec/openshift-openapi-spec.json b/api/swagger-spec/openshift-openapi-spec.json index 69982cf8f7d8..3c75ab55f0db 100644 --- a/api/swagger-spec/openshift-openapi-spec.json +++ b/api/swagger-spec/openshift-openapi-spec.json @@ -7,7 +7,7 @@ "name": "Apache 2.0 (ASL2.0)", "url": "http://www.apache.org/licenses/LICENSE-2.0" }, - "version": "latest" + "version": "v3.11.0-alpha.0+e5682f1-882-dirty" }, "paths": { "/api/": { @@ -115583,16 +115583,20 @@ "com.github.openshift.api.image.v1.ImageBlobReferences": { "description": "ImageBlobReferences describes the blob references within an image.", "properties": { + "config": { + "description": "config, if set, is the blob that contains the image config. Some images do not have separate config blobs and this field will be set to nil if so.", + "type": "string" + }, + "imageMissing": { + "description": "imageMissing is true if the image is referenced by the image stream but the image object has been deleted from the API by an administrator. When this field is set, layers and config fields may be empty and callers that depend on the image metadata should consider the image to be unavailable for download or viewing.", + "type": "boolean" + }, "layers": { "description": "layers is the list of blobs that compose this image, from base layer to top layer. All layers referenced by this array will be defined in the blobs map. Some images may have zero layers.", "type": "array", "items": { "type": "string" } - }, - "manifest": { - "description": "manifest, if set, is the blob that contains the image manifest. Some images do not have separate manifest blobs and this field will be set to nil if so.", - "type": "string" } } }, @@ -115989,7 +115993,7 @@ } }, "images": { - "description": "images is a map between an image name and the names of the blobs and manifests that comprise the image.", + "description": "images is a map between an image name and the names of the blobs and config that comprise the image.", "type": "object", "additionalProperties": { "$ref": "#/definitions/com.github.openshift.api.image.v1.ImageBlobReferences" diff --git a/pkg/image/apis/image/types.go b/pkg/image/apis/image/types.go index ef613fbfbeab..c707545b6a18 100644 --- a/pkg/image/apis/image/types.go +++ b/pkg/image/apis/image/types.go @@ -486,15 +486,21 @@ type ImageStreamLayers struct { // ImageBlobReferences describes the blob references within an image. type ImageBlobReferences struct { + // imageMissing is true if the image is referenced by the image stream but the image + // object has been deleted from the API by an administrator. When this field is set, + // layers and config fields may be empty and callers that depend on the image metadata + // should consider the image to be unavailable for download or viewing. + // +optional + ImageMissing bool // layers is the list of blobs that compose this image, from base layer to top layer. // All layers referenced by this array will be defined in the blobs map. Some images // may have zero layers. // +optional Layers []string - // manifest, if set, is the blob that contains the image manifest. Some images do + // config, if set, is the blob that contains the image configuration. Some images do // not have separate manifest blobs and this field will be set to nil if so. // +optional - Manifest *string + Config *string } // ImageLayerData contains metadata about an image layer. diff --git a/pkg/image/apis/image/v1/zz_generated.conversion.go b/pkg/image/apis/image/v1/zz_generated.conversion.go index 35b3d5f7668a..19d46f92e9a8 100644 --- a/pkg/image/apis/image/v1/zz_generated.conversion.go +++ b/pkg/image/apis/image/v1/zz_generated.conversion.go @@ -127,8 +127,9 @@ func autoConvert_image_Image_To_v1_Image(in *image.Image, out *v1.Image, s conve } func autoConvert_v1_ImageBlobReferences_To_image_ImageBlobReferences(in *v1.ImageBlobReferences, out *image.ImageBlobReferences, s conversion.Scope) error { + out.ImageMissing = in.ImageMissing out.Layers = *(*[]string)(unsafe.Pointer(&in.Layers)) - out.Manifest = (*string)(unsafe.Pointer(in.Manifest)) + out.Config = (*string)(unsafe.Pointer(in.Config)) return nil } @@ -138,8 +139,9 @@ func Convert_v1_ImageBlobReferences_To_image_ImageBlobReferences(in *v1.ImageBlo } func autoConvert_image_ImageBlobReferences_To_v1_ImageBlobReferences(in *image.ImageBlobReferences, out *v1.ImageBlobReferences, s conversion.Scope) error { + out.ImageMissing = in.ImageMissing out.Layers = *(*[]string)(unsafe.Pointer(&in.Layers)) - out.Manifest = (*string)(unsafe.Pointer(in.Manifest)) + out.Config = (*string)(unsafe.Pointer(in.Config)) return nil } diff --git a/pkg/image/apis/image/zz_generated.deepcopy.go b/pkg/image/apis/image/zz_generated.deepcopy.go index e4362c002e65..04eb6eae6244 100644 --- a/pkg/image/apis/image/zz_generated.deepcopy.go +++ b/pkg/image/apis/image/zz_generated.deepcopy.go @@ -67,8 +67,8 @@ func (in *ImageBlobReferences) DeepCopyInto(out *ImageBlobReferences) { *out = make([]string, len(*in)) copy(*out, *in) } - if in.Manifest != nil { - in, out := &in.Manifest, &out.Manifest + if in.Config != nil { + in, out := &in.Config, &out.Config if *in == nil { *out = nil } else { diff --git a/pkg/image/apiserver/registry/imagestream/etcd/etcd.go b/pkg/image/apiserver/registry/imagestream/etcd/etcd.go index bf6d8319b009..3e2ef07aa334 100644 --- a/pkg/image/apiserver/registry/imagestream/etcd/etcd.go +++ b/pkg/image/apiserver/registry/imagestream/etcd/etcd.go @@ -224,7 +224,7 @@ func addImageStreamLayersFromCache(isl *imageapi.ImageStreamLayers, is *imageapi } if blob := entry.Config; blob != nil { - reference.Manifest = &blob.Name + reference.Config = &blob.Name if _, ok := isl.Blobs[blob.Name]; !ok { if blob.LayerSize == 0 { // only send media type since we don't the size of the manifest diff --git a/pkg/openapi/zz_generated.openapi.go b/pkg/openapi/zz_generated.openapi.go index f9b4e9532182..52714bd1a6df 100644 --- a/pkg/openapi/zz_generated.openapi.go +++ b/pkg/openapi/zz_generated.openapi.go @@ -6841,6 +6841,13 @@ func schema_openshift_api_image_v1_ImageBlobReferences(ref common.ReferenceCallb SchemaProps: spec.SchemaProps{ Description: "ImageBlobReferences describes the blob references within an image.", Properties: map[string]spec.Schema{ + "imageMissing": { + SchemaProps: spec.SchemaProps{ + Description: "imageMissing is true if the image is referenced by the image stream but the image object has been deleted from the API by an administrator. When this field is set, layers and config fields may be empty and callers that depend on the image metadata should consider the image to be unavailable for download or viewing.", + Type: []string{"boolean"}, + Format: "", + }, + }, "layers": { SchemaProps: spec.SchemaProps{ Description: "layers is the list of blobs that compose this image, from base layer to top layer. All layers referenced by this array will be defined in the blobs map. Some images may have zero layers.", @@ -6855,9 +6862,9 @@ func schema_openshift_api_image_v1_ImageBlobReferences(ref common.ReferenceCallb }, }, }, - "manifest": { + "config": { SchemaProps: spec.SchemaProps{ - Description: "manifest, if set, is the blob that contains the image manifest. Some images do not have separate manifest blobs and this field will be set to nil if so.", + Description: "config, if set, is the blob that contains the image config. Some images do not have separate config blobs and this field will be set to nil if so.", Type: []string{"string"}, Format: "", }, @@ -7444,7 +7451,7 @@ func schema_openshift_api_image_v1_ImageStreamLayers(ref common.ReferenceCallbac }, "images": { SchemaProps: spec.SchemaProps{ - Description: "images is a map between an image name and the names of the blobs and manifests that comprise the image.", + Description: "images is a map between an image name and the names of the blobs and config that comprise the image.", Type: []string{"object"}, AdditionalProperties: &spec.SchemaOrBool{ Schema: &spec.Schema{ diff --git a/test/extended/images/layers.go b/test/extended/images/layers.go index c56c54fe1b40..332f12cec3f4 100644 --- a/test/extended/images/layers.go +++ b/test/extended/images/layers.go @@ -71,9 +71,9 @@ var _ = g.Describe("[Feature:ImageLayers] Image layer subresource", func() { l, ok := layers.Images[image.Image.Name] o.Expect(ok).To(o.BeTrue()) o.Expect(len(l.Layers)).To(o.BeNumerically(">", 0)) - o.Expect(l.Manifest).ToNot(o.BeNil()) - o.Expect(layers.Blobs[*l.Manifest]).ToNot(o.BeNil()) - o.Expect(layers.Blobs[*l.Manifest].MediaType).To(o.Equal("application/vnd.docker.container.image.v1+json")) + o.Expect(l.Config).ToNot(o.BeNil()) + o.Expect(layers.Blobs[*l.Config]).ToNot(o.BeNil()) + o.Expect(layers.Blobs[*l.Config].MediaType).To(o.Equal("application/vnd.docker.container.image.v1+json")) for _, layerID := range l.Layers { o.Expect(layers.Blobs).To(o.HaveKey(layerID)) o.Expect(layers.Blobs[layerID].MediaType).NotTo(o.BeEmpty())