Skip to content

Commit

Permalink
Merge pull request #19969 from smarterclayton/image_layers
Browse files Browse the repository at this point in the history
Provide layers referenced by an image stream as layers subresource
  • Loading branch information
openshift-merge-robot authored Jul 13, 2018
2 parents 3b39b0e + aac71d5 commit 4ad16ad
Show file tree
Hide file tree
Showing 69 changed files with 3,645 additions and 567 deletions.
54 changes: 54 additions & 0 deletions api/docs/apis-image.openshift.io/v1.ImageStream.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -878,6 +878,60 @@ The server guarantees that the objects returned when using continue will be iden
* application/vnd.kubernetes.protobuf


[[Get-apis-image.openshift.io-v1-namespaces-namespace-imagestreams-name-layers]]
=== Get layers of a ImageStream in a namespace
Read layers of the specified ImageStream

==== HTTP request
----
GET /apis/image.openshift.io/v1/namespaces/$NAMESPACE/imagestreams/$NAME/layers HTTP/1.1
Authorization: Bearer $TOKEN
Accept: application/json
Connection: close
----

==== Curl request
----
$ curl -k \
-H "Authorization: Bearer $TOKEN" \
-H 'Accept: application/json' \
https://$ENDPOINT/apis/image.openshift.io/v1/namespaces/$NAMESPACE/imagestreams/$NAME/layers
----

==== Path parameters
[cols="1,5", options="header"]
|===
|Parameter|Description
|name|name of the ImageStreamLayers
|namespace|object name and auth scope, such as for teams and projects
|===

==== Query parameters
[cols="1,5", options="header"]
|===
|Parameter|Description
|pretty|If 'true', then the output is pretty printed.
|===

==== Responses
[cols="1,5", options="header"]
|===
|HTTP Code|Schema
|200 OK|v1.ImageStreamLayers
|401 Unauthorized|
|===

==== Consumes

* \*/*

==== Produces

* application/json
* application/yaml
* application/vnd.kubernetes.protobuf


[[Get-apis-image.openshift.io-v1-namespaces-namespace-imagestreams-name-secrets]]
=== Get secrets of a ImageStream in a namespace
Read secrets of the specified ImageStream
Expand Down
38 changes: 38 additions & 0 deletions api/protobuf-spec/github_com_openshift_api_image_v1.proto

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

138 changes: 138 additions & 0 deletions api/swagger-spec/openshift-openapi-spec.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions glide.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions pkg/cmd/server/origin/legacy.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,8 @@ func LegacyStorage(storage map[schema.GroupVersion]map[string]rest.Storage) map[

case *imagestreametcd.REST:
legacyStorage[resource] = &imagestreametcd.LegacyREST{REST: storage}
case *imagestreametcd.LayersREST:
delete(legacyStorage, resource)

case *routeetcd.REST:
store := *storage.Store
Expand Down
1 change: 1 addition & 0 deletions pkg/image/apis/image/register.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ func addKnownTypes(scheme *runtime.Scheme) error {
&ImageStreamTag{},
&ImageStreamTagList{},
&ImageStreamImage{},
&ImageStreamLayers{},
&ImageStreamImport{},
&kapi.SecretList{},
)
Expand Down
37 changes: 37 additions & 0 deletions pkg/image/apis/image/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,43 @@ type ImageStreamImage struct {
// DockerImageReference points to a Docker image.
type DockerImageReference = reference.DockerImageReference

// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

// ImageStreamLayers describes information about the layers referenced by images in this
// image stream.
type ImageStreamLayers struct {
metav1.TypeMeta
// Standard object's metadata.
metav1.ObjectMeta
// blobs is a map of blob name to metadata about the blob.
Blobs map[string]ImageLayerData
// images is a map between an image name and the names of the blobs and manifests that
// comprise the image.
Images map[string]ImageBlobReferences
}

// ImageBlobReferences describes the blob references within an image.
type ImageBlobReferences struct {
// 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
// not have separate manifest blobs and this field will be set to nil if so.
// +optional
Manifest *string
}

// ImageLayerData contains metadata about an image layer.
type ImageLayerData struct {
// Size of the layer in bytes as defined by the underlying store. This field is
// optional if the necessary information about size is not available.
LayerSize *int64
// MediaType of the referenced object.
MediaType string
}

// +genclient
// +genclient:onlyVerbs=create
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
Expand Down
Loading

0 comments on commit 4ad16ad

Please sign in to comment.