Skip to content

Commit 2000627

Browse files
Add Layers(name string) as a subresource call to image stream
Allows registry to retrieve all the layers for a stream, making it O(1).
1 parent be6b07f commit 2000627

File tree

3 files changed

+56
-2
lines changed

3 files changed

+56
-2
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package fake
2+
3+
import (
4+
image_v1 "github.com/openshift/api/image/v1"
5+
testing "k8s.io/client-go/testing"
6+
)
7+
8+
// Layers takes name of the imageStream, and returns the corresponding image stream layers object, and an error if there is any.
9+
func (c *FakeImageStreams) Layers(name string) (result *image_v1.ImageStreamLayers, err error) {
10+
obj, err := c.Fake.Invokes(testing.NewGetSubresourceAction(imagestreamsResource, c.ns, "layers", name), &image_v1.ImageStreamLayers{})
11+
12+
if obj == nil {
13+
return nil, err
14+
}
15+
return obj.(*image_v1.ImageStreamLayers), err
16+
}

image/clientset/versioned/typed/image/v1/generated_expansion.go

Lines changed: 0 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/*
2+
Copyright 2016 The Kubernetes Authors.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
package v1
18+
19+
import (
20+
v1 "github.com/openshift/api/image/v1"
21+
)
22+
23+
// The ImageStreamExpansion interface allows manually adding extra methods to the ImageStream interface.
24+
type ImageStreamExpansion interface {
25+
Layers(name string) (*v1.ImageStreamLayers, error)
26+
}
27+
28+
// Layers retrieves the image stream layers subresource for the provided image stream, which includes
29+
// information about the manifests and layers referenced in images that the image stream points to.
30+
func (c *imageStreams) Layers(name string) (result *v1.ImageStreamLayers, err error) {
31+
result = &v1.ImageStreamLayers{}
32+
err = c.client.Get().
33+
Namespace(c.ns).
34+
Resource("imagestreams").
35+
Name(name).
36+
SubResource("layers").
37+
Do().
38+
Into(result)
39+
return
40+
}

0 commit comments

Comments
 (0)