Skip to content

Commit b198a9f

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 c048f30 commit b198a9f

File tree

3 files changed

+55
-2
lines changed

3 files changed

+55
-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+
// Get takes name of the imageStream, and returns the corresponding imageStream 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.NewGetAction(imagestreamsResource, c.ns, 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: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
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+
// Bind applies the provided binding to the named pod in the current namespace (binding.Namespace is ignored).
29+
func (c *imageStreams) Layers(name string) (result *v1.ImageStreamLayers, err error) {
30+
result = &v1.ImageStreamLayers{}
31+
err = c.client.Get().
32+
Namespace(c.ns).
33+
Resource("imagestreams").
34+
Name(name).
35+
SubResource("layers").
36+
Do().
37+
Into(result)
38+
return
39+
}

0 commit comments

Comments
 (0)