Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
image: add image stream secrets client
  • Loading branch information
mfojtik committed Aug 31, 2017
commit c087b7d292fe6f50ec8f398db736fba5601a240b
1 change: 1 addition & 0 deletions pkg/image/apis/image/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ type ImageStreamList struct {
}

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

// ImageStream stores a mapping of tags to images, metadata overrides that are applied
// when images are tagged in a stream, and an optional reference to a Docker image
Expand Down
1 change: 1 addition & 0 deletions pkg/image/apis/image/v1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ type ImageStreamList struct {
}

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

// ImageStream stores a mapping of tags to images, metadata overrides that are applied
// when images are tagged in a stream, and an optional reference to a Docker image
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
testing "k8s.io/client-go/testing"
api_v1 "k8s.io/kubernetes/pkg/api/v1"
)

// FakeImageStreams implements ImageStreamInterface
Expand Down Expand Up @@ -120,3 +121,14 @@ func (c *FakeImageStreams) Patch(name string, pt types.PatchType, data []byte, s
}
return obj.(*image_v1.ImageStream), err
}

// Secrets takes label and field selectors, and returns the list of Secrets that match those selectors.
func (c *FakeImageStreams) Secrets(imageStreamName string, opts v1.ListOptions) (result *api_v1.SecretList, err error) {
obj, err := c.Fake.
Invokes(testing.NewListSubresourceAction(imagestreamsResource, imageStreamName, "secrets", imagestreamsKind, c.ns, opts), &api_v1.SecretList{})

if obj == nil {
return nil, err
}
return obj.(*api_v1.SecretList), err
}
17 changes: 17 additions & 0 deletions pkg/image/generated/clientset/typed/image/v1/imagestream.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
rest "k8s.io/client-go/rest"
api_v1 "k8s.io/kubernetes/pkg/api/v1"
)

// ImageStreamsGetter has a method to return a ImageStreamInterface.
Expand All @@ -26,6 +27,8 @@ type ImageStreamInterface interface {
List(opts meta_v1.ListOptions) (*v1.ImageStreamList, error)
Watch(opts meta_v1.ListOptions) (watch.Interface, error)
Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.ImageStream, err error)
Secrets(imageStreamName string, opts meta_v1.ListOptions) (*api_v1.SecretList, error)

ImageStreamExpansion
}

Expand Down Expand Up @@ -154,3 +157,17 @@ func (c *imageStreams) Patch(name string, pt types.PatchType, data []byte, subre
Into(result)
return
}

// Secrets takes v1.ImageStream name, label and field selectors, and returns the list of Secrets that match those selectors.
func (c *imageStreams) Secrets(imageStreamName string, opts meta_v1.ListOptions) (result *api_v1.SecretList, err error) {
result = &api_v1.SecretList{}
err = c.client.Get().
Namespace(c.ns).
Resource("imagestreams").
Name(imageStreamName).
SubResource("secrets").
VersionedParams(&opts, scheme.ParameterCodec).
Do().
Into(result)
return
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
testing "k8s.io/client-go/testing"
api "k8s.io/kubernetes/pkg/api"
)

// FakeImageStreams implements ImageStreamInterface
Expand Down Expand Up @@ -120,3 +121,14 @@ func (c *FakeImageStreams) Patch(name string, pt types.PatchType, data []byte, s
}
return obj.(*image.ImageStream), err
}

// Secrets takes label and field selectors, and returns the list of Secrets that match those selectors.
func (c *FakeImageStreams) Secrets(imageStreamName string, opts v1.ListOptions) (result *api.SecretList, err error) {
obj, err := c.Fake.
Invokes(testing.NewListSubresourceAction(imagestreamsResource, imageStreamName, "secrets", imagestreamsKind, c.ns, opts), &api.SecretList{})

if obj == nil {
return nil, err
}
return obj.(*api.SecretList), err
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
rest "k8s.io/client-go/rest"
api "k8s.io/kubernetes/pkg/api"
)

// ImageStreamsGetter has a method to return a ImageStreamInterface.
Expand All @@ -26,6 +27,8 @@ type ImageStreamInterface interface {
List(opts v1.ListOptions) (*image.ImageStreamList, error)
Watch(opts v1.ListOptions) (watch.Interface, error)
Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *image.ImageStream, err error)
Secrets(imageStreamName string, opts v1.ListOptions) (*api.SecretList, error)

ImageStreamExpansion
}

Expand Down Expand Up @@ -154,3 +157,17 @@ func (c *imageStreams) Patch(name string, pt types.PatchType, data []byte, subre
Into(result)
return
}

// Secrets takes image.ImageStream name, label and field selectors, and returns the list of Secrets that match those selectors.
func (c *imageStreams) Secrets(imageStreamName string, opts v1.ListOptions) (result *api.SecretList, err error) {
result = &api.SecretList{}
err = c.client.Get().
Namespace(c.ns).
Resource("imagestreams").
Name(imageStreamName).
SubResource("secrets").
VersionedParams(&opts, scheme.ParameterCodec).
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sttts @deads2k we don't have this in legacy client, not sure if it is needed or just missing in legacy.

Do().
Into(result)
return
}