Skip to content

Commit 89245a7

Browse files
committed
WIP: image: add image stream secrets client
1 parent 1111100 commit 89245a7

File tree

6 files changed

+65
-13
lines changed

6 files changed

+65
-13
lines changed

pkg/image/apis/image/types.go

+1
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,7 @@ type ImageStreamList struct {
197197
}
198198

199199
// +genclient
200+
// +genclient:method=Secrets,verb=list,subresource=secrets,result=k8s.io/kubernetes/pkg/api.Secret
200201

201202
// ImageStream stores a mapping of tags to images, metadata overrides that are applied
202203
// when images are tagged in a stream, and an optional reference to a Docker image

pkg/image/apis/image/v1/types.go

+1
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ type ImageStreamList struct {
152152
}
153153

154154
// +genclient
155+
// +genclient:method=Secrets,verb=list,subresource=secrets,result=k8s.io/kubernetes/pkg/api/v1.Secret
155156

156157
// ImageStream stores a mapping of tags to images, metadata overrides that are applied
157158
// when images are tagged in a stream, and an optional reference to a Docker image

pkg/image/generated/clientset/typed/image/v1/fake/fake_imagestream.go

+11
Original file line numberDiff line numberDiff line change
@@ -120,3 +120,14 @@ func (c *FakeImageStreams) Patch(name string, pt types.PatchType, data []byte, s
120120
}
121121
return obj.(*image_v1.ImageStream), err
122122
}
123+
124+
// Secrets takes label and field selectors, and returns the list of ImageStreams that match those selectors.
125+
func (c *FakeImageStreams) Secrets(opts v1.ListOptions) (result *image_v1.SecretListList, err error) {
126+
obj, err := c.Fake.
127+
Invokes(testing.NewListAction(imagestreamsResource, imagestreamsKind, c.ns, opts), &image_v1.SecretListList{})
128+
129+
if obj == nil {
130+
return nil, err
131+
}
132+
return obj.(*image_v1.ImageStreamList), err
133+
}

pkg/image/generated/clientset/typed/image/v1/imagestream.go

+13
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ type ImageStreamInterface interface {
2626
List(opts meta_v1.ListOptions) (*v1.ImageStreamList, error)
2727
Watch(opts meta_v1.ListOptions) (watch.Interface, error)
2828
Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.ImageStream, err error)
29+
Secrets(opts meta_v1.ListOptions) (*v1.SecretListList, error)
2930
ImageStreamExpansion
3031
}
3132

@@ -154,3 +155,15 @@ func (c *imageStreams) Patch(name string, pt types.PatchType, data []byte, subre
154155
Into(result)
155156
return
156157
}
158+
159+
// Secrets takes label and field selectors, and returns the list of SecretLists that match those selectors.
160+
func (c *imageStreams) Secrets(opts meta_v1.ListOptions) (result *v1.SecretListList, err error) {
161+
result = &v1.SecretListList{}
162+
err = c.client.Get().
163+
Namespace(c.ns).
164+
Resource("imagestreams").Name(imageStream.Name).SubResource("secrets").
165+
VersionedParams(&opts, scheme.ParameterCodec).
166+
Do().
167+
Into(result)
168+
return
169+
}

pkg/image/generated/internalclientset/typed/image/internalversion/fake/fake_imagestream.go

+25-13
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
11
package fake
22

33
import (
4-
image "github.com/openshift/origin/pkg/image/apis/image"
5-
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
64
labels "k8s.io/apimachinery/pkg/labels"
75
schema "k8s.io/apimachinery/pkg/runtime/schema"
86
types "k8s.io/apimachinery/pkg/types"
97
watch "k8s.io/apimachinery/pkg/watch"
108
testing "k8s.io/client-go/testing"
9+
image "github.com/openshift/origin/pkg/image/apis/image"
10+
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
1111
)
1212

13+
1314
// FakeImageStreams implements ImageStreamInterface
1415
type FakeImageStreams struct {
1516
Fake *FakeImage
16-
ns string
17+
ns string
1718
}
1819

1920
var imagestreamsResource = schema.GroupVersionResource{Group: "image.openshift.io", Version: "", Resource: "imagestreams"}
@@ -24,7 +25,7 @@ var imagestreamsKind = schema.GroupVersionKind{Group: "image.openshift.io", Vers
2425
func (c *FakeImageStreams) Get(name string, options v1.GetOptions) (result *image.ImageStream, err error) {
2526
obj, err := c.Fake.
2627
Invokes(testing.NewGetAction(imagestreamsResource, c.ns, name), &image.ImageStream{})
27-
28+
2829
if obj == nil {
2930
return nil, err
3031
}
@@ -35,7 +36,7 @@ func (c *FakeImageStreams) Get(name string, options v1.GetOptions) (result *imag
3536
func (c *FakeImageStreams) List(opts v1.ListOptions) (result *image.ImageStreamList, err error) {
3637
obj, err := c.Fake.
3738
Invokes(testing.NewListAction(imagestreamsResource, imagestreamsKind, c.ns, opts), &image.ImageStreamList{})
38-
39+
3940
if obj == nil {
4041
return nil, err
4142
}
@@ -57,14 +58,14 @@ func (c *FakeImageStreams) List(opts v1.ListOptions) (result *image.ImageStreamL
5758
func (c *FakeImageStreams) Watch(opts v1.ListOptions) (watch.Interface, error) {
5859
return c.Fake.
5960
InvokesWatch(testing.NewWatchAction(imagestreamsResource, c.ns, opts))
60-
61+
6162
}
6263

6364
// Create takes the representation of a imageStream and creates it. Returns the server's representation of the imageStream, and an error, if there is any.
6465
func (c *FakeImageStreams) Create(imageStream *image.ImageStream) (result *image.ImageStream, err error) {
6566
obj, err := c.Fake.
6667
Invokes(testing.NewCreateAction(imagestreamsResource, c.ns, imageStream), &image.ImageStream{})
67-
68+
6869
if obj == nil {
6970
return nil, err
7071
}
@@ -75,7 +76,7 @@ func (c *FakeImageStreams) Create(imageStream *image.ImageStream) (result *image
7576
func (c *FakeImageStreams) Update(imageStream *image.ImageStream) (result *image.ImageStream, err error) {
7677
obj, err := c.Fake.
7778
Invokes(testing.NewUpdateAction(imagestreamsResource, c.ns, imageStream), &image.ImageStream{})
78-
79+
7980
if obj == nil {
8081
return nil, err
8182
}
@@ -87,7 +88,7 @@ func (c *FakeImageStreams) Update(imageStream *image.ImageStream) (result *image
8788
func (c *FakeImageStreams) UpdateStatus(imageStream *image.ImageStream) (*image.ImageStream, error) {
8889
obj, err := c.Fake.
8990
Invokes(testing.NewUpdateSubresourceAction(imagestreamsResource, "status", c.ns, imageStream), &image.ImageStream{})
90-
91+
9192
if obj == nil {
9293
return nil, err
9394
}
@@ -98,25 +99,36 @@ func (c *FakeImageStreams) UpdateStatus(imageStream *image.ImageStream) (*image.
9899
func (c *FakeImageStreams) Delete(name string, options *v1.DeleteOptions) error {
99100
_, err := c.Fake.
100101
Invokes(testing.NewDeleteAction(imagestreamsResource, c.ns, name), &image.ImageStream{})
101-
102+
102103
return err
103104
}
104105

105106
// DeleteCollection deletes a collection of objects.
106107
func (c *FakeImageStreams) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
107108
action := testing.NewDeleteCollectionAction(imagestreamsResource, c.ns, listOptions)
108-
109+
109110
_, err := c.Fake.Invokes(action, &image.ImageStreamList{})
110111
return err
111112
}
112113

113114
// Patch applies the patch and returns the patched imageStream.
114115
func (c *FakeImageStreams) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *image.ImageStream, err error) {
115116
obj, err := c.Fake.
116-
Invokes(testing.NewPatchSubresourceAction(imagestreamsResource, c.ns, name, data, subresources...), &image.ImageStream{})
117-
117+
Invokes(testing.NewPatchSubresourceAction(imagestreamsResource, c.ns, name, data, subresources... ), &image.ImageStream{})
118+
118119
if obj == nil {
119120
return nil, err
120121
}
121122
return obj.(*image.ImageStream), err
122123
}
124+
125+
// Secrets takes label and field selectors, and returns the list of ImageStreams that match those selectors.
126+
func (c *FakeImageStreams) Secrets(opts v1.ListOptions) (result *image.k8s.io/kubernetes/pkg/api.SecretList, err error) {
127+
obj, err := c.Fake.
128+
Invokes(testing.NewListAction(imagestreamsResource, imagestreamsKind, c.ns, opts), &image.k8s.io/kubernetes/pkg/api.SecretList{})
129+
130+
if obj == nil {
131+
return nil, err
132+
}
133+
return obj.(*image.ImageStreamList), err
134+
}

pkg/image/generated/internalclientset/typed/image/internalversion/imagestream.go

+14
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
types "k8s.io/apimachinery/pkg/types"
88
watch "k8s.io/apimachinery/pkg/watch"
99
rest "k8s.io/client-go/rest"
10+
api "k8s.io/kubernetes/pkg/api"
1011
)
1112

1213
// ImageStreamsGetter has a method to return a ImageStreamInterface.
@@ -26,6 +27,7 @@ type ImageStreamInterface interface {
2627
List(opts v1.ListOptions) (*image.ImageStreamList, error)
2728
Watch(opts v1.ListOptions) (watch.Interface, error)
2829
Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *image.ImageStream, err error)
30+
Secrets(opts v1.ListOptions) (*api.SecretList, error)
2931
ImageStreamExpansion
3032
}
3133

@@ -154,3 +156,15 @@ func (c *imageStreams) Patch(name string, pt types.PatchType, data []byte, subre
154156
Into(result)
155157
return
156158
}
159+
160+
// Secrets takes label and field selectors, and returns the list of Secrets that match those selectors.
161+
func (c *imageStreams) Secrets(opts v1.ListOptions) (result *api.SecretList, err error) {
162+
result = &api.SecretList{}
163+
err = c.client.Get().
164+
Namespace(c.ns).
165+
Resource("imagestreams").Name(imageStream.Name).SubResource("secrets").
166+
VersionedParams(&opts, scheme.ParameterCodec).
167+
Do().
168+
Into(result)
169+
return
170+
}

0 commit comments

Comments
 (0)