Skip to content

Commit a95673f

Browse files
committed
image: add image stream secrets client
1 parent 89f08de commit a95673f

File tree

6 files changed

+58
-0
lines changed

6 files changed

+58
-0
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

+12
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
types "k8s.io/apimachinery/pkg/types"
99
watch "k8s.io/apimachinery/pkg/watch"
1010
testing "k8s.io/client-go/testing"
11+
api_v1 "k8s.io/kubernetes/pkg/api/v1"
1112
)
1213

1314
// FakeImageStreams implements ImageStreamInterface
@@ -120,3 +121,14 @@ func (c *FakeImageStreams) Patch(name string, pt types.PatchType, data []byte, s
120121
}
121122
return obj.(*image_v1.ImageStream), err
122123
}
124+
125+
// Secrets takes label and field selectors, and returns the list of Secrets that match those selectors.
126+
func (c *FakeImageStreams) Secrets(imageStreamName, opts v1.ListOptions) (result *api_v1.SecretList, err error) {
127+
obj, err := c.Fake.
128+
Invokes(testing.NewListSubresourceAction(imagestreamsResource, "secrets", imagestreamsKind, c.ns, opts), &api_v1.SecretList{})
129+
130+
if obj == nil {
131+
return nil, err
132+
}
133+
return obj.(*api_v1.SecretList), err
134+
}

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

+16
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_v1 "k8s.io/kubernetes/pkg/api/v1"
1011
)
1112

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

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

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

+12
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
types "k8s.io/apimachinery/pkg/types"
99
watch "k8s.io/apimachinery/pkg/watch"
1010
testing "k8s.io/client-go/testing"
11+
api "k8s.io/kubernetes/pkg/api"
1112
)
1213

1314
// FakeImageStreams implements ImageStreamInterface
@@ -120,3 +121,14 @@ func (c *FakeImageStreams) Patch(name string, pt types.PatchType, data []byte, s
120121
}
121122
return obj.(*image.ImageStream), err
122123
}
124+
125+
// Secrets takes label and field selectors, and returns the list of Secrets that match those selectors.
126+
func (c *FakeImageStreams) Secrets(imageStreamName, opts v1.ListOptions) (result *api.SecretList, err error) {
127+
obj, err := c.Fake.
128+
Invokes(testing.NewListSubresourceAction(imagestreamsResource, "secrets", imagestreamsKind, c.ns, opts), &api.SecretList{})
129+
130+
if obj == nil {
131+
return nil, err
132+
}
133+
return obj.(*api.SecretList), err
134+
}

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

+16
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(imageStreamName string, opts v1.ListOptions) (*api.SecretList, error)
2931
ImageStreamExpansion
3032
}
3133

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

0 commit comments

Comments
 (0)