Skip to content

Commit

Permalink
image: add image stream secrets client
Browse files Browse the repository at this point in the history
  • Loading branch information
mfojtik committed Aug 30, 2017
1 parent 365a41e commit 40a369a
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 0 deletions.
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).
Do().
Into(result)
return
}

0 comments on commit 40a369a

Please sign in to comment.