Skip to content

Commit 4ad16ad

Browse files
Merge pull request #19969 from smarterclayton/image_layers
Provide layers referenced by an image stream as layers subresource
2 parents 3b39b0e + aac71d5 commit 4ad16ad

File tree

69 files changed

+3645
-567
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+3645
-567
lines changed

api/docs/apis-image.openshift.io/v1.ImageStream.adoc

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -878,6 +878,60 @@ The server guarantees that the objects returned when using continue will be iden
878878
* application/vnd.kubernetes.protobuf
879879

880880

881+
[[Get-apis-image.openshift.io-v1-namespaces-namespace-imagestreams-name-layers]]
882+
=== Get layers of a ImageStream in a namespace
883+
Read layers of the specified ImageStream
884+
885+
==== HTTP request
886+
----
887+
GET /apis/image.openshift.io/v1/namespaces/$NAMESPACE/imagestreams/$NAME/layers HTTP/1.1
888+
Authorization: Bearer $TOKEN
889+
Accept: application/json
890+
Connection: close
891+
----
892+
893+
==== Curl request
894+
----
895+
$ curl -k \
896+
-H "Authorization: Bearer $TOKEN" \
897+
-H 'Accept: application/json' \
898+
https://$ENDPOINT/apis/image.openshift.io/v1/namespaces/$NAMESPACE/imagestreams/$NAME/layers
899+
----
900+
901+
==== Path parameters
902+
[cols="1,5", options="header"]
903+
|===
904+
|Parameter|Description
905+
|name|name of the ImageStreamLayers
906+
|namespace|object name and auth scope, such as for teams and projects
907+
|===
908+
909+
==== Query parameters
910+
[cols="1,5", options="header"]
911+
|===
912+
|Parameter|Description
913+
|pretty|If 'true', then the output is pretty printed.
914+
|===
915+
916+
==== Responses
917+
[cols="1,5", options="header"]
918+
|===
919+
|HTTP Code|Schema
920+
|200 OK|v1.ImageStreamLayers
921+
|401 Unauthorized|
922+
|===
923+
924+
==== Consumes
925+
926+
* \*/*
927+
928+
==== Produces
929+
930+
* application/json
931+
* application/yaml
932+
* application/vnd.kubernetes.protobuf
933+
934+
881935
[[Get-apis-image.openshift.io-v1-namespaces-namespace-imagestreams-name-secrets]]
882936
=== Get secrets of a ImageStream in a namespace
883937
Read secrets of the specified ImageStream

api/protobuf-spec/github.com_openshift_api_image_v1.proto

Lines changed: 38 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/swagger-spec/openshift-openapi-spec.json

Lines changed: 138 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

glide.lock

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/cmd/server/origin/legacy.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,8 @@ func LegacyStorage(storage map[schema.GroupVersion]map[string]rest.Storage) map[
207207

208208
case *imagestreametcd.REST:
209209
legacyStorage[resource] = &imagestreametcd.LegacyREST{REST: storage}
210+
case *imagestreametcd.LayersREST:
211+
delete(legacyStorage, resource)
210212

211213
case *routeetcd.REST:
212214
store := *storage.Store

pkg/image/apis/image/register.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ func addKnownTypes(scheme *runtime.Scheme) error {
7272
&ImageStreamTag{},
7373
&ImageStreamTagList{},
7474
&ImageStreamImage{},
75+
&ImageStreamLayers{},
7576
&ImageStreamImport{},
7677
&kapi.SecretList{},
7778
)

pkg/image/apis/image/types.go

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -469,6 +469,43 @@ type ImageStreamImage struct {
469469
// DockerImageReference points to a Docker image.
470470
type DockerImageReference = reference.DockerImageReference
471471

472+
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
473+
474+
// ImageStreamLayers describes information about the layers referenced by images in this
475+
// image stream.
476+
type ImageStreamLayers struct {
477+
metav1.TypeMeta
478+
// Standard object's metadata.
479+
metav1.ObjectMeta
480+
// blobs is a map of blob name to metadata about the blob.
481+
Blobs map[string]ImageLayerData
482+
// images is a map between an image name and the names of the blobs and manifests that
483+
// comprise the image.
484+
Images map[string]ImageBlobReferences
485+
}
486+
487+
// ImageBlobReferences describes the blob references within an image.
488+
type ImageBlobReferences struct {
489+
// layers is the list of blobs that compose this image, from base layer to top layer.
490+
// All layers referenced by this array will be defined in the blobs map. Some images
491+
// may have zero layers.
492+
// +optional
493+
Layers []string
494+
// manifest, if set, is the blob that contains the image manifest. Some images do
495+
// not have separate manifest blobs and this field will be set to nil if so.
496+
// +optional
497+
Manifest *string
498+
}
499+
500+
// ImageLayerData contains metadata about an image layer.
501+
type ImageLayerData struct {
502+
// Size of the layer in bytes as defined by the underlying store. This field is
503+
// optional if the necessary information about size is not available.
504+
LayerSize *int64
505+
// MediaType of the referenced object.
506+
MediaType string
507+
}
508+
472509
// +genclient
473510
// +genclient:onlyVerbs=create
474511
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

0 commit comments

Comments
 (0)