Commit 3ee833ca authored by k8s-merge-robot's avatar k8s-merge-robot

Merge pull request #25006 from liggitt/third-party-root-scope

Automatic merge from submit-queue Make ThirdPartyResource a root scoped object ThirdPartyResource (the registration of a third party type) belongs at the cluster scope. It results in resource handlers installed in every namespace, and the same name in two namespaces collides (namespace is ignored when determining group/kind). ThirdPartyResourceData (an actual instance of that type) is still namespace-scoped. This PR moves ThirdPartyResource to be a root scope object. Someone previously using ThirdPartyResource definitions in alpha should be able to move them from namespace to root scope like this: setup (run on 1.2): ``` kubectl create ns ns1 echo '{"kind":"ThirdPartyResource","apiVersion":"extensions/v1beta1","metadata":{"name":"foo.example.com"},"versions":[{"name":"v8"}]}' | kubectl create -f - --namespace=ns1 echo '{"kind":"Foo","apiVersion":"example.com/v8","metadata":{"name":"MyFoo"},"testkey":"testvalue"}' | kubectl create -f - --namespace=ns1 ``` export: ``` kubectl get thirdpartyresource --all-namespaces -o yaml > tprs.yaml ``` remove namespaced kind registrations (this shouldn't remove the data of that type, which is another possible issue): ``` kubectl delete -f tprs.yaml ``` ... upgrade ... re-register the custom types at the root scope: ``` kubectl create -f tprs.yaml ``` Additionally, pre-1.3 clients that expect to read/write ThirdPartyResource at a namespace scope will not be compatible with 1.3+ servers, and 1.3+ clients that expect to read/write ThirdPartyResource at a root scope will not be compatible with pre-1.3 servers.
parents 331a2ecb e41d5047
...@@ -92,6 +92,7 @@ func newRESTMapper(externalVersions []unversioned.GroupVersion) meta.RESTMapper ...@@ -92,6 +92,7 @@ func newRESTMapper(externalVersions []unversioned.GroupVersion) meta.RESTMapper
// if a kind is not enumerated here, it is assumed to have a namespace scope // if a kind is not enumerated here, it is assumed to have a namespace scope
rootScoped := sets.NewString( rootScoped := sets.NewString(
"PodSecurityPolicy", "PodSecurityPolicy",
"ThirdPartyResource",
) )
ignoredKinds := sets.NewString() ignoredKinds := sets.NewString()
......
...@@ -169,7 +169,7 @@ type HorizontalPodAutoscalerList struct { ...@@ -169,7 +169,7 @@ type HorizontalPodAutoscalerList struct {
Items []HorizontalPodAutoscaler `json:"items"` Items []HorizontalPodAutoscaler `json:"items"`
} }
// +genclient=true // +genclient=true,nonNamespaced=true
// A ThirdPartyResource is a generic representation of a resource, it is used by add-ons and plugins to add new resource // A ThirdPartyResource is a generic representation of a resource, it is used by add-ons and plugins to add new resource
// types to the API. It consists of one or more Versions of the api. // types to the API. It consists of one or more Versions of the api.
......
...@@ -166,7 +166,7 @@ type HorizontalPodAutoscalerList struct { ...@@ -166,7 +166,7 @@ type HorizontalPodAutoscalerList struct {
Items []HorizontalPodAutoscaler `json:"items" protobuf:"bytes,2,rep,name=items"` Items []HorizontalPodAutoscaler `json:"items" protobuf:"bytes,2,rep,name=items"`
} }
// +genclient=true // +genclient=true,nonNamespaced=true
// A ThirdPartyResource is a generic representation of a resource, it is used by add-ons and plugins to add new resource // A ThirdPartyResource is a generic representation of a resource, it is used by add-ons and plugins to add new resource
// types to the API. It consists of one or more Versions of the api. // types to the API. It consists of one or more Versions of the api.
......
...@@ -145,7 +145,7 @@ func ValidateThirdPartyResourceName(name string, prefix bool) (bool, string) { ...@@ -145,7 +145,7 @@ func ValidateThirdPartyResourceName(name string, prefix bool) (bool, string) {
func ValidateThirdPartyResource(obj *extensions.ThirdPartyResource) field.ErrorList { func ValidateThirdPartyResource(obj *extensions.ThirdPartyResource) field.ErrorList {
allErrs := field.ErrorList{} allErrs := field.ErrorList{}
allErrs = append(allErrs, apivalidation.ValidateObjectMeta(&obj.ObjectMeta, true, ValidateThirdPartyResourceName, field.NewPath("metadata"))...) allErrs = append(allErrs, apivalidation.ValidateObjectMeta(&obj.ObjectMeta, false, ValidateThirdPartyResourceName, field.NewPath("metadata"))...)
versions := sets.String{} versions := sets.String{}
for ix := range obj.Versions { for ix := range obj.Versions {
......
...@@ -62,8 +62,8 @@ func (c *ExtensionsClient) Scales(namespace string) ScaleInterface { ...@@ -62,8 +62,8 @@ func (c *ExtensionsClient) Scales(namespace string) ScaleInterface {
return newScales(c, namespace) return newScales(c, namespace)
} }
func (c *ExtensionsClient) ThirdPartyResources(namespace string) ThirdPartyResourceInterface { func (c *ExtensionsClient) ThirdPartyResources() ThirdPartyResourceInterface {
return newThirdPartyResources(c, namespace) return newThirdPartyResources(c)
} }
// NewForConfig creates a new ExtensionsClient for the given config. // NewForConfig creates a new ExtensionsClient for the given config.
......
...@@ -50,8 +50,8 @@ func (c *FakeExtensions) Scales(namespace string) unversioned.ScaleInterface { ...@@ -50,8 +50,8 @@ func (c *FakeExtensions) Scales(namespace string) unversioned.ScaleInterface {
return &FakeScales{c, namespace} return &FakeScales{c, namespace}
} }
func (c *FakeExtensions) ThirdPartyResources(namespace string) unversioned.ThirdPartyResourceInterface { func (c *FakeExtensions) ThirdPartyResources() unversioned.ThirdPartyResourceInterface {
return &FakeThirdPartyResources{c, namespace} return &FakeThirdPartyResources{c}
} }
// GetRESTClient returns a RESTClient that is used to communicate // GetRESTClient returns a RESTClient that is used to communicate
......
...@@ -28,15 +28,13 @@ import ( ...@@ -28,15 +28,13 @@ import (
// FakeThirdPartyResources implements ThirdPartyResourceInterface // FakeThirdPartyResources implements ThirdPartyResourceInterface
type FakeThirdPartyResources struct { type FakeThirdPartyResources struct {
Fake *FakeExtensions Fake *FakeExtensions
ns string
} }
var thirdpartyresourcesResource = unversioned.GroupVersionResource{Group: "extensions", Version: "", Resource: "thirdpartyresources"} var thirdpartyresourcesResource = unversioned.GroupVersionResource{Group: "extensions", Version: "", Resource: "thirdpartyresources"}
func (c *FakeThirdPartyResources) Create(thirdPartyResource *extensions.ThirdPartyResource) (result *extensions.ThirdPartyResource, err error) { func (c *FakeThirdPartyResources) Create(thirdPartyResource *extensions.ThirdPartyResource) (result *extensions.ThirdPartyResource, err error) {
obj, err := c.Fake. obj, err := c.Fake.
Invokes(core.NewCreateAction(thirdpartyresourcesResource, c.ns, thirdPartyResource), &extensions.ThirdPartyResource{}) Invokes(core.NewRootCreateAction(thirdpartyresourcesResource, thirdPartyResource), &extensions.ThirdPartyResource{})
if obj == nil { if obj == nil {
return nil, err return nil, err
} }
...@@ -45,8 +43,7 @@ func (c *FakeThirdPartyResources) Create(thirdPartyResource *extensions.ThirdPar ...@@ -45,8 +43,7 @@ func (c *FakeThirdPartyResources) Create(thirdPartyResource *extensions.ThirdPar
func (c *FakeThirdPartyResources) Update(thirdPartyResource *extensions.ThirdPartyResource) (result *extensions.ThirdPartyResource, err error) { func (c *FakeThirdPartyResources) Update(thirdPartyResource *extensions.ThirdPartyResource) (result *extensions.ThirdPartyResource, err error) {
obj, err := c.Fake. obj, err := c.Fake.
Invokes(core.NewUpdateAction(thirdpartyresourcesResource, c.ns, thirdPartyResource), &extensions.ThirdPartyResource{}) Invokes(core.NewRootUpdateAction(thirdpartyresourcesResource, thirdPartyResource), &extensions.ThirdPartyResource{})
if obj == nil { if obj == nil {
return nil, err return nil, err
} }
...@@ -55,13 +52,12 @@ func (c *FakeThirdPartyResources) Update(thirdPartyResource *extensions.ThirdPar ...@@ -55,13 +52,12 @@ func (c *FakeThirdPartyResources) Update(thirdPartyResource *extensions.ThirdPar
func (c *FakeThirdPartyResources) Delete(name string, options *api.DeleteOptions) error { func (c *FakeThirdPartyResources) Delete(name string, options *api.DeleteOptions) error {
_, err := c.Fake. _, err := c.Fake.
Invokes(core.NewDeleteAction(thirdpartyresourcesResource, c.ns, name), &extensions.ThirdPartyResource{}) Invokes(core.NewRootDeleteAction(thirdpartyresourcesResource, name), &extensions.ThirdPartyResource{})
return err return err
} }
func (c *FakeThirdPartyResources) DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error { func (c *FakeThirdPartyResources) DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error {
action := core.NewDeleteCollectionAction(thirdpartyresourcesResource, c.ns, listOptions) action := core.NewRootDeleteCollectionAction(thirdpartyresourcesResource, listOptions)
_, err := c.Fake.Invokes(action, &extensions.ThirdPartyResourceList{}) _, err := c.Fake.Invokes(action, &extensions.ThirdPartyResourceList{})
return err return err
...@@ -69,8 +65,7 @@ func (c *FakeThirdPartyResources) DeleteCollection(options *api.DeleteOptions, l ...@@ -69,8 +65,7 @@ func (c *FakeThirdPartyResources) DeleteCollection(options *api.DeleteOptions, l
func (c *FakeThirdPartyResources) Get(name string) (result *extensions.ThirdPartyResource, err error) { func (c *FakeThirdPartyResources) Get(name string) (result *extensions.ThirdPartyResource, err error) {
obj, err := c.Fake. obj, err := c.Fake.
Invokes(core.NewGetAction(thirdpartyresourcesResource, c.ns, name), &extensions.ThirdPartyResource{}) Invokes(core.NewRootGetAction(thirdpartyresourcesResource, name), &extensions.ThirdPartyResource{})
if obj == nil { if obj == nil {
return nil, err return nil, err
} }
...@@ -79,8 +74,7 @@ func (c *FakeThirdPartyResources) Get(name string) (result *extensions.ThirdPart ...@@ -79,8 +74,7 @@ func (c *FakeThirdPartyResources) Get(name string) (result *extensions.ThirdPart
func (c *FakeThirdPartyResources) List(opts api.ListOptions) (result *extensions.ThirdPartyResourceList, err error) { func (c *FakeThirdPartyResources) List(opts api.ListOptions) (result *extensions.ThirdPartyResourceList, err error) {
obj, err := c.Fake. obj, err := c.Fake.
Invokes(core.NewListAction(thirdpartyresourcesResource, c.ns, opts), &extensions.ThirdPartyResourceList{}) Invokes(core.NewRootListAction(thirdpartyresourcesResource, opts), &extensions.ThirdPartyResourceList{})
if obj == nil { if obj == nil {
return nil, err return nil, err
} }
...@@ -101,6 +95,5 @@ func (c *FakeThirdPartyResources) List(opts api.ListOptions) (result *extensions ...@@ -101,6 +95,5 @@ func (c *FakeThirdPartyResources) List(opts api.ListOptions) (result *extensions
// Watch returns a watch.Interface that watches the requested thirdPartyResources. // Watch returns a watch.Interface that watches the requested thirdPartyResources.
func (c *FakeThirdPartyResources) Watch(opts api.ListOptions) (watch.Interface, error) { func (c *FakeThirdPartyResources) Watch(opts api.ListOptions) (watch.Interface, error) {
return c.Fake. return c.Fake.
InvokesWatch(core.NewWatchAction(thirdpartyresourcesResource, c.ns, opts)) InvokesWatch(core.NewRootWatchAction(thirdpartyresourcesResource, opts))
} }
...@@ -25,7 +25,7 @@ import ( ...@@ -25,7 +25,7 @@ import (
// ThirdPartyResourcesGetter has a method to return a ThirdPartyResourceInterface. // ThirdPartyResourcesGetter has a method to return a ThirdPartyResourceInterface.
// A group's client should implement this interface. // A group's client should implement this interface.
type ThirdPartyResourcesGetter interface { type ThirdPartyResourcesGetter interface {
ThirdPartyResources(namespace string) ThirdPartyResourceInterface ThirdPartyResources() ThirdPartyResourceInterface
} }
// ThirdPartyResourceInterface has methods to work with ThirdPartyResource resources. // ThirdPartyResourceInterface has methods to work with ThirdPartyResource resources.
...@@ -43,14 +43,12 @@ type ThirdPartyResourceInterface interface { ...@@ -43,14 +43,12 @@ type ThirdPartyResourceInterface interface {
// thirdPartyResources implements ThirdPartyResourceInterface // thirdPartyResources implements ThirdPartyResourceInterface
type thirdPartyResources struct { type thirdPartyResources struct {
client *ExtensionsClient client *ExtensionsClient
ns string
} }
// newThirdPartyResources returns a ThirdPartyResources // newThirdPartyResources returns a ThirdPartyResources
func newThirdPartyResources(c *ExtensionsClient, namespace string) *thirdPartyResources { func newThirdPartyResources(c *ExtensionsClient) *thirdPartyResources {
return &thirdPartyResources{ return &thirdPartyResources{
client: c, client: c,
ns: namespace,
} }
} }
...@@ -58,7 +56,6 @@ func newThirdPartyResources(c *ExtensionsClient, namespace string) *thirdPartyRe ...@@ -58,7 +56,6 @@ func newThirdPartyResources(c *ExtensionsClient, namespace string) *thirdPartyRe
func (c *thirdPartyResources) Create(thirdPartyResource *extensions.ThirdPartyResource) (result *extensions.ThirdPartyResource, err error) { func (c *thirdPartyResources) Create(thirdPartyResource *extensions.ThirdPartyResource) (result *extensions.ThirdPartyResource, err error) {
result = &extensions.ThirdPartyResource{} result = &extensions.ThirdPartyResource{}
err = c.client.Post(). err = c.client.Post().
Namespace(c.ns).
Resource("thirdpartyresources"). Resource("thirdpartyresources").
Body(thirdPartyResource). Body(thirdPartyResource).
Do(). Do().
...@@ -70,7 +67,6 @@ func (c *thirdPartyResources) Create(thirdPartyResource *extensions.ThirdPartyRe ...@@ -70,7 +67,6 @@ func (c *thirdPartyResources) Create(thirdPartyResource *extensions.ThirdPartyRe
func (c *thirdPartyResources) Update(thirdPartyResource *extensions.ThirdPartyResource) (result *extensions.ThirdPartyResource, err error) { func (c *thirdPartyResources) Update(thirdPartyResource *extensions.ThirdPartyResource) (result *extensions.ThirdPartyResource, err error) {
result = &extensions.ThirdPartyResource{} result = &extensions.ThirdPartyResource{}
err = c.client.Put(). err = c.client.Put().
Namespace(c.ns).
Resource("thirdpartyresources"). Resource("thirdpartyresources").
Name(thirdPartyResource.Name). Name(thirdPartyResource.Name).
Body(thirdPartyResource). Body(thirdPartyResource).
...@@ -82,7 +78,6 @@ func (c *thirdPartyResources) Update(thirdPartyResource *extensions.ThirdPartyRe ...@@ -82,7 +78,6 @@ func (c *thirdPartyResources) Update(thirdPartyResource *extensions.ThirdPartyRe
// Delete takes name of the thirdPartyResource and deletes it. Returns an error if one occurs. // Delete takes name of the thirdPartyResource and deletes it. Returns an error if one occurs.
func (c *thirdPartyResources) Delete(name string, options *api.DeleteOptions) error { func (c *thirdPartyResources) Delete(name string, options *api.DeleteOptions) error {
return c.client.Delete(). return c.client.Delete().
Namespace(c.ns).
Resource("thirdpartyresources"). Resource("thirdpartyresources").
Name(name). Name(name).
Body(options). Body(options).
...@@ -93,7 +88,6 @@ func (c *thirdPartyResources) Delete(name string, options *api.DeleteOptions) er ...@@ -93,7 +88,6 @@ func (c *thirdPartyResources) Delete(name string, options *api.DeleteOptions) er
// DeleteCollection deletes a collection of objects. // DeleteCollection deletes a collection of objects.
func (c *thirdPartyResources) DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error { func (c *thirdPartyResources) DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error {
return c.client.Delete(). return c.client.Delete().
Namespace(c.ns).
Resource("thirdpartyresources"). Resource("thirdpartyresources").
VersionedParams(&listOptions, api.ParameterCodec). VersionedParams(&listOptions, api.ParameterCodec).
Body(options). Body(options).
...@@ -105,7 +99,6 @@ func (c *thirdPartyResources) DeleteCollection(options *api.DeleteOptions, listO ...@@ -105,7 +99,6 @@ func (c *thirdPartyResources) DeleteCollection(options *api.DeleteOptions, listO
func (c *thirdPartyResources) Get(name string) (result *extensions.ThirdPartyResource, err error) { func (c *thirdPartyResources) Get(name string) (result *extensions.ThirdPartyResource, err error) {
result = &extensions.ThirdPartyResource{} result = &extensions.ThirdPartyResource{}
err = c.client.Get(). err = c.client.Get().
Namespace(c.ns).
Resource("thirdpartyresources"). Resource("thirdpartyresources").
Name(name). Name(name).
Do(). Do().
...@@ -117,7 +110,6 @@ func (c *thirdPartyResources) Get(name string) (result *extensions.ThirdPartyRes ...@@ -117,7 +110,6 @@ func (c *thirdPartyResources) Get(name string) (result *extensions.ThirdPartyRes
func (c *thirdPartyResources) List(opts api.ListOptions) (result *extensions.ThirdPartyResourceList, err error) { func (c *thirdPartyResources) List(opts api.ListOptions) (result *extensions.ThirdPartyResourceList, err error) {
result = &extensions.ThirdPartyResourceList{} result = &extensions.ThirdPartyResourceList{}
err = c.client.Get(). err = c.client.Get().
Namespace(c.ns).
Resource("thirdpartyresources"). Resource("thirdpartyresources").
VersionedParams(&opts, api.ParameterCodec). VersionedParams(&opts, api.ParameterCodec).
Do(). Do().
...@@ -129,7 +121,6 @@ func (c *thirdPartyResources) List(opts api.ListOptions) (result *extensions.Thi ...@@ -129,7 +121,6 @@ func (c *thirdPartyResources) List(opts api.ListOptions) (result *extensions.Thi
func (c *thirdPartyResources) Watch(opts api.ListOptions) (watch.Interface, error) { func (c *thirdPartyResources) Watch(opts api.ListOptions) (watch.Interface, error) {
return c.client.Get(). return c.client.Get().
Prefix("watch"). Prefix("watch").
Namespace(c.ns).
Resource("thirdpartyresources"). Resource("thirdpartyresources").
VersionedParams(&opts, api.ParameterCodec). VersionedParams(&opts, api.ParameterCodec).
Watch() Watch()
......
...@@ -66,8 +66,8 @@ func (c *ExtensionsClient) Scales(namespace string) ScaleInterface { ...@@ -66,8 +66,8 @@ func (c *ExtensionsClient) Scales(namespace string) ScaleInterface {
return newScales(c, namespace) return newScales(c, namespace)
} }
func (c *ExtensionsClient) ThirdPartyResources(namespace string) ThirdPartyResourceInterface { func (c *ExtensionsClient) ThirdPartyResources() ThirdPartyResourceInterface {
return newThirdPartyResources(c, namespace) return newThirdPartyResources(c)
} }
// NewForConfig creates a new ExtensionsClient for the given config. // NewForConfig creates a new ExtensionsClient for the given config.
......
...@@ -53,6 +53,6 @@ func (c *FakeExtensions) Scales(namespace string) v1beta1.ScaleInterface { ...@@ -53,6 +53,6 @@ func (c *FakeExtensions) Scales(namespace string) v1beta1.ScaleInterface {
return &FakeScales{c, namespace} return &FakeScales{c, namespace}
} }
func (c *FakeExtensions) ThirdPartyResources(namespace string) v1beta1.ThirdPartyResourceInterface { func (c *FakeExtensions) ThirdPartyResources() v1beta1.ThirdPartyResourceInterface {
return &FakeThirdPartyResources{c, namespace} return &FakeThirdPartyResources{c}
} }
...@@ -28,14 +28,13 @@ import ( ...@@ -28,14 +28,13 @@ import (
// FakeThirdPartyResources implements ThirdPartyResourceInterface // FakeThirdPartyResources implements ThirdPartyResourceInterface
type FakeThirdPartyResources struct { type FakeThirdPartyResources struct {
Fake *FakeExtensions Fake *FakeExtensions
ns string
} }
var thirdpartyresourcesResource = unversioned.GroupVersionResource{Group: "extensions", Version: "v1beta1", Resource: "thirdpartyresources"} var thirdpartyresourcesResource = unversioned.GroupVersionResource{Group: "extensions", Version: "v1beta1", Resource: "thirdpartyresources"}
func (c *FakeThirdPartyResources) Create(thirdPartyResource *v1beta1.ThirdPartyResource) (result *v1beta1.ThirdPartyResource, err error) { func (c *FakeThirdPartyResources) Create(thirdPartyResource *v1beta1.ThirdPartyResource) (result *v1beta1.ThirdPartyResource, err error) {
obj, err := c.Fake. obj, err := c.Fake.
Invokes(core.NewCreateAction(thirdpartyresourcesResource, c.ns, thirdPartyResource), &v1beta1.ThirdPartyResource{}) Invokes(core.NewRootCreateAction(thirdpartyresourcesResource, thirdPartyResource), &v1beta1.ThirdPartyResource{})
if obj == nil { if obj == nil {
return nil, err return nil, err
...@@ -45,7 +44,7 @@ func (c *FakeThirdPartyResources) Create(thirdPartyResource *v1beta1.ThirdPartyR ...@@ -45,7 +44,7 @@ func (c *FakeThirdPartyResources) Create(thirdPartyResource *v1beta1.ThirdPartyR
func (c *FakeThirdPartyResources) Update(thirdPartyResource *v1beta1.ThirdPartyResource) (result *v1beta1.ThirdPartyResource, err error) { func (c *FakeThirdPartyResources) Update(thirdPartyResource *v1beta1.ThirdPartyResource) (result *v1beta1.ThirdPartyResource, err error) {
obj, err := c.Fake. obj, err := c.Fake.
Invokes(core.NewUpdateAction(thirdpartyresourcesResource, c.ns, thirdPartyResource), &v1beta1.ThirdPartyResource{}) Invokes(core.NewRootUpdateAction(thirdpartyresourcesResource, thirdPartyResource), &v1beta1.ThirdPartyResource{})
if obj == nil { if obj == nil {
return nil, err return nil, err
...@@ -55,13 +54,13 @@ func (c *FakeThirdPartyResources) Update(thirdPartyResource *v1beta1.ThirdPartyR ...@@ -55,13 +54,13 @@ func (c *FakeThirdPartyResources) Update(thirdPartyResource *v1beta1.ThirdPartyR
func (c *FakeThirdPartyResources) Delete(name string, options *api.DeleteOptions) error { func (c *FakeThirdPartyResources) Delete(name string, options *api.DeleteOptions) error {
_, err := c.Fake. _, err := c.Fake.
Invokes(core.NewDeleteAction(thirdpartyresourcesResource, c.ns, name), &v1beta1.ThirdPartyResource{}) Invokes(core.NewRootDeleteAction(thirdpartyresourcesResource, name), &v1beta1.ThirdPartyResource{})
return err return err
} }
func (c *FakeThirdPartyResources) DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error { func (c *FakeThirdPartyResources) DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error {
action := core.NewDeleteCollectionAction(thirdpartyresourcesResource, c.ns, listOptions) action := core.NewRootDeleteCollectionAction(thirdpartyresourcesResource, listOptions)
_, err := c.Fake.Invokes(action, &v1beta1.ThirdPartyResourceList{}) _, err := c.Fake.Invokes(action, &v1beta1.ThirdPartyResourceList{})
return err return err
...@@ -69,7 +68,7 @@ func (c *FakeThirdPartyResources) DeleteCollection(options *api.DeleteOptions, l ...@@ -69,7 +68,7 @@ func (c *FakeThirdPartyResources) DeleteCollection(options *api.DeleteOptions, l
func (c *FakeThirdPartyResources) Get(name string) (result *v1beta1.ThirdPartyResource, err error) { func (c *FakeThirdPartyResources) Get(name string) (result *v1beta1.ThirdPartyResource, err error) {
obj, err := c.Fake. obj, err := c.Fake.
Invokes(core.NewGetAction(thirdpartyresourcesResource, c.ns, name), &v1beta1.ThirdPartyResource{}) Invokes(core.NewRootGetAction(thirdpartyresourcesResource, name), &v1beta1.ThirdPartyResource{})
if obj == nil { if obj == nil {
return nil, err return nil, err
...@@ -79,7 +78,7 @@ func (c *FakeThirdPartyResources) Get(name string) (result *v1beta1.ThirdPartyRe ...@@ -79,7 +78,7 @@ func (c *FakeThirdPartyResources) Get(name string) (result *v1beta1.ThirdPartyRe
func (c *FakeThirdPartyResources) List(opts api.ListOptions) (result *v1beta1.ThirdPartyResourceList, err error) { func (c *FakeThirdPartyResources) List(opts api.ListOptions) (result *v1beta1.ThirdPartyResourceList, err error) {
obj, err := c.Fake. obj, err := c.Fake.
Invokes(core.NewListAction(thirdpartyresourcesResource, c.ns, opts), &v1beta1.ThirdPartyResourceList{}) Invokes(core.NewRootListAction(thirdpartyresourcesResource, opts), &v1beta1.ThirdPartyResourceList{})
if obj == nil { if obj == nil {
return nil, err return nil, err
...@@ -101,6 +100,6 @@ func (c *FakeThirdPartyResources) List(opts api.ListOptions) (result *v1beta1.Th ...@@ -101,6 +100,6 @@ func (c *FakeThirdPartyResources) List(opts api.ListOptions) (result *v1beta1.Th
// Watch returns a watch.Interface that watches the requested thirdPartyResources. // Watch returns a watch.Interface that watches the requested thirdPartyResources.
func (c *FakeThirdPartyResources) Watch(opts api.ListOptions) (watch.Interface, error) { func (c *FakeThirdPartyResources) Watch(opts api.ListOptions) (watch.Interface, error) {
return c.Fake. return c.Fake.
InvokesWatch(core.NewWatchAction(thirdpartyresourcesResource, c.ns, opts)) InvokesWatch(core.NewRootWatchAction(thirdpartyresourcesResource, opts))
} }
...@@ -25,7 +25,7 @@ import ( ...@@ -25,7 +25,7 @@ import (
// ThirdPartyResourcesGetter has a method to return a ThirdPartyResourceInterface. // ThirdPartyResourcesGetter has a method to return a ThirdPartyResourceInterface.
// A group's client should implement this interface. // A group's client should implement this interface.
type ThirdPartyResourcesGetter interface { type ThirdPartyResourcesGetter interface {
ThirdPartyResources(namespace string) ThirdPartyResourceInterface ThirdPartyResources() ThirdPartyResourceInterface
} }
// ThirdPartyResourceInterface has methods to work with ThirdPartyResource resources. // ThirdPartyResourceInterface has methods to work with ThirdPartyResource resources.
...@@ -43,14 +43,12 @@ type ThirdPartyResourceInterface interface { ...@@ -43,14 +43,12 @@ type ThirdPartyResourceInterface interface {
// thirdPartyResources implements ThirdPartyResourceInterface // thirdPartyResources implements ThirdPartyResourceInterface
type thirdPartyResources struct { type thirdPartyResources struct {
client *ExtensionsClient client *ExtensionsClient
ns string
} }
// newThirdPartyResources returns a ThirdPartyResources // newThirdPartyResources returns a ThirdPartyResources
func newThirdPartyResources(c *ExtensionsClient, namespace string) *thirdPartyResources { func newThirdPartyResources(c *ExtensionsClient) *thirdPartyResources {
return &thirdPartyResources{ return &thirdPartyResources{
client: c, client: c,
ns: namespace,
} }
} }
...@@ -58,7 +56,6 @@ func newThirdPartyResources(c *ExtensionsClient, namespace string) *thirdPartyRe ...@@ -58,7 +56,6 @@ func newThirdPartyResources(c *ExtensionsClient, namespace string) *thirdPartyRe
func (c *thirdPartyResources) Create(thirdPartyResource *v1beta1.ThirdPartyResource) (result *v1beta1.ThirdPartyResource, err error) { func (c *thirdPartyResources) Create(thirdPartyResource *v1beta1.ThirdPartyResource) (result *v1beta1.ThirdPartyResource, err error) {
result = &v1beta1.ThirdPartyResource{} result = &v1beta1.ThirdPartyResource{}
err = c.client.Post(). err = c.client.Post().
Namespace(c.ns).
Resource("thirdpartyresources"). Resource("thirdpartyresources").
Body(thirdPartyResource). Body(thirdPartyResource).
Do(). Do().
...@@ -70,7 +67,6 @@ func (c *thirdPartyResources) Create(thirdPartyResource *v1beta1.ThirdPartyResou ...@@ -70,7 +67,6 @@ func (c *thirdPartyResources) Create(thirdPartyResource *v1beta1.ThirdPartyResou
func (c *thirdPartyResources) Update(thirdPartyResource *v1beta1.ThirdPartyResource) (result *v1beta1.ThirdPartyResource, err error) { func (c *thirdPartyResources) Update(thirdPartyResource *v1beta1.ThirdPartyResource) (result *v1beta1.ThirdPartyResource, err error) {
result = &v1beta1.ThirdPartyResource{} result = &v1beta1.ThirdPartyResource{}
err = c.client.Put(). err = c.client.Put().
Namespace(c.ns).
Resource("thirdpartyresources"). Resource("thirdpartyresources").
Name(thirdPartyResource.Name). Name(thirdPartyResource.Name).
Body(thirdPartyResource). Body(thirdPartyResource).
...@@ -82,7 +78,6 @@ func (c *thirdPartyResources) Update(thirdPartyResource *v1beta1.ThirdPartyResou ...@@ -82,7 +78,6 @@ func (c *thirdPartyResources) Update(thirdPartyResource *v1beta1.ThirdPartyResou
// Delete takes name of the thirdPartyResource and deletes it. Returns an error if one occurs. // Delete takes name of the thirdPartyResource and deletes it. Returns an error if one occurs.
func (c *thirdPartyResources) Delete(name string, options *api.DeleteOptions) error { func (c *thirdPartyResources) Delete(name string, options *api.DeleteOptions) error {
return c.client.Delete(). return c.client.Delete().
Namespace(c.ns).
Resource("thirdpartyresources"). Resource("thirdpartyresources").
Name(name). Name(name).
Body(options). Body(options).
...@@ -93,7 +88,6 @@ func (c *thirdPartyResources) Delete(name string, options *api.DeleteOptions) er ...@@ -93,7 +88,6 @@ func (c *thirdPartyResources) Delete(name string, options *api.DeleteOptions) er
// DeleteCollection deletes a collection of objects. // DeleteCollection deletes a collection of objects.
func (c *thirdPartyResources) DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error { func (c *thirdPartyResources) DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error {
return c.client.Delete(). return c.client.Delete().
Namespace(c.ns).
Resource("thirdpartyresources"). Resource("thirdpartyresources").
VersionedParams(&listOptions, api.ParameterCodec). VersionedParams(&listOptions, api.ParameterCodec).
Body(options). Body(options).
...@@ -105,7 +99,6 @@ func (c *thirdPartyResources) DeleteCollection(options *api.DeleteOptions, listO ...@@ -105,7 +99,6 @@ func (c *thirdPartyResources) DeleteCollection(options *api.DeleteOptions, listO
func (c *thirdPartyResources) Get(name string) (result *v1beta1.ThirdPartyResource, err error) { func (c *thirdPartyResources) Get(name string) (result *v1beta1.ThirdPartyResource, err error) {
result = &v1beta1.ThirdPartyResource{} result = &v1beta1.ThirdPartyResource{}
err = c.client.Get(). err = c.client.Get().
Namespace(c.ns).
Resource("thirdpartyresources"). Resource("thirdpartyresources").
Name(name). Name(name).
Do(). Do().
...@@ -117,7 +110,6 @@ func (c *thirdPartyResources) Get(name string) (result *v1beta1.ThirdPartyResour ...@@ -117,7 +110,6 @@ func (c *thirdPartyResources) Get(name string) (result *v1beta1.ThirdPartyResour
func (c *thirdPartyResources) List(opts api.ListOptions) (result *v1beta1.ThirdPartyResourceList, err error) { func (c *thirdPartyResources) List(opts api.ListOptions) (result *v1beta1.ThirdPartyResourceList, err error) {
result = &v1beta1.ThirdPartyResourceList{} result = &v1beta1.ThirdPartyResourceList{}
err = c.client.Get(). err = c.client.Get().
Namespace(c.ns).
Resource("thirdpartyresources"). Resource("thirdpartyresources").
VersionedParams(&opts, api.ParameterCodec). VersionedParams(&opts, api.ParameterCodec).
Do(). Do().
...@@ -129,7 +121,6 @@ func (c *thirdPartyResources) List(opts api.ListOptions) (result *v1beta1.ThirdP ...@@ -129,7 +121,6 @@ func (c *thirdPartyResources) List(opts api.ListOptions) (result *v1beta1.ThirdP
func (c *thirdPartyResources) Watch(opts api.ListOptions) (watch.Interface, error) { func (c *thirdPartyResources) Watch(opts api.ListOptions) (watch.Interface, error) {
return c.client.Get(). return c.client.Get().
Prefix("watch"). Prefix("watch").
Namespace(c.ns).
Resource("thirdpartyresources"). Resource("thirdpartyresources").
VersionedParams(&opts, api.ParameterCodec). VersionedParams(&opts, api.ParameterCodec).
Watch() Watch()
......
...@@ -66,8 +66,8 @@ func (c *ExtensionsClient) Scales(namespace string) ScaleInterface { ...@@ -66,8 +66,8 @@ func (c *ExtensionsClient) Scales(namespace string) ScaleInterface {
return newScales(c, namespace) return newScales(c, namespace)
} }
func (c *ExtensionsClient) ThirdPartyResources(namespace string) ThirdPartyResourceInterface { func (c *ExtensionsClient) ThirdPartyResources() ThirdPartyResourceInterface {
return newThirdPartyResources(c, namespace) return newThirdPartyResources(c)
} }
// NewForConfig creates a new ExtensionsClient for the given config. // NewForConfig creates a new ExtensionsClient for the given config.
......
...@@ -53,6 +53,6 @@ func (c *FakeExtensions) Scales(namespace string) v1beta1.ScaleInterface { ...@@ -53,6 +53,6 @@ func (c *FakeExtensions) Scales(namespace string) v1beta1.ScaleInterface {
return &FakeScales{c, namespace} return &FakeScales{c, namespace}
} }
func (c *FakeExtensions) ThirdPartyResources(namespace string) v1beta1.ThirdPartyResourceInterface { func (c *FakeExtensions) ThirdPartyResources() v1beta1.ThirdPartyResourceInterface {
return &FakeThirdPartyResources{c, namespace} return &FakeThirdPartyResources{c}
} }
...@@ -28,14 +28,13 @@ import ( ...@@ -28,14 +28,13 @@ import (
// FakeThirdPartyResources implements ThirdPartyResourceInterface // FakeThirdPartyResources implements ThirdPartyResourceInterface
type FakeThirdPartyResources struct { type FakeThirdPartyResources struct {
Fake *FakeExtensions Fake *FakeExtensions
ns string
} }
var thirdpartyresourcesResource = unversioned.GroupVersionResource{Group: "extensions", Version: "v1beta1", Resource: "thirdpartyresources"} var thirdpartyresourcesResource = unversioned.GroupVersionResource{Group: "extensions", Version: "v1beta1", Resource: "thirdpartyresources"}
func (c *FakeThirdPartyResources) Create(thirdPartyResource *v1beta1.ThirdPartyResource) (result *v1beta1.ThirdPartyResource, err error) { func (c *FakeThirdPartyResources) Create(thirdPartyResource *v1beta1.ThirdPartyResource) (result *v1beta1.ThirdPartyResource, err error) {
obj, err := c.Fake. obj, err := c.Fake.
Invokes(core.NewCreateAction(thirdpartyresourcesResource, c.ns, thirdPartyResource), &v1beta1.ThirdPartyResource{}) Invokes(core.NewRootCreateAction(thirdpartyresourcesResource, thirdPartyResource), &v1beta1.ThirdPartyResource{})
if obj == nil { if obj == nil {
return nil, err return nil, err
...@@ -45,7 +44,7 @@ func (c *FakeThirdPartyResources) Create(thirdPartyResource *v1beta1.ThirdPartyR ...@@ -45,7 +44,7 @@ func (c *FakeThirdPartyResources) Create(thirdPartyResource *v1beta1.ThirdPartyR
func (c *FakeThirdPartyResources) Update(thirdPartyResource *v1beta1.ThirdPartyResource) (result *v1beta1.ThirdPartyResource, err error) { func (c *FakeThirdPartyResources) Update(thirdPartyResource *v1beta1.ThirdPartyResource) (result *v1beta1.ThirdPartyResource, err error) {
obj, err := c.Fake. obj, err := c.Fake.
Invokes(core.NewUpdateAction(thirdpartyresourcesResource, c.ns, thirdPartyResource), &v1beta1.ThirdPartyResource{}) Invokes(core.NewRootUpdateAction(thirdpartyresourcesResource, thirdPartyResource), &v1beta1.ThirdPartyResource{})
if obj == nil { if obj == nil {
return nil, err return nil, err
...@@ -55,13 +54,13 @@ func (c *FakeThirdPartyResources) Update(thirdPartyResource *v1beta1.ThirdPartyR ...@@ -55,13 +54,13 @@ func (c *FakeThirdPartyResources) Update(thirdPartyResource *v1beta1.ThirdPartyR
func (c *FakeThirdPartyResources) Delete(name string, options *api.DeleteOptions) error { func (c *FakeThirdPartyResources) Delete(name string, options *api.DeleteOptions) error {
_, err := c.Fake. _, err := c.Fake.
Invokes(core.NewDeleteAction(thirdpartyresourcesResource, c.ns, name), &v1beta1.ThirdPartyResource{}) Invokes(core.NewRootDeleteAction(thirdpartyresourcesResource, name), &v1beta1.ThirdPartyResource{})
return err return err
} }
func (c *FakeThirdPartyResources) DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error { func (c *FakeThirdPartyResources) DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error {
action := core.NewDeleteCollectionAction(thirdpartyresourcesResource, c.ns, listOptions) action := core.NewRootDeleteCollectionAction(thirdpartyresourcesResource, listOptions)
_, err := c.Fake.Invokes(action, &v1beta1.ThirdPartyResourceList{}) _, err := c.Fake.Invokes(action, &v1beta1.ThirdPartyResourceList{})
return err return err
...@@ -69,7 +68,7 @@ func (c *FakeThirdPartyResources) DeleteCollection(options *api.DeleteOptions, l ...@@ -69,7 +68,7 @@ func (c *FakeThirdPartyResources) DeleteCollection(options *api.DeleteOptions, l
func (c *FakeThirdPartyResources) Get(name string) (result *v1beta1.ThirdPartyResource, err error) { func (c *FakeThirdPartyResources) Get(name string) (result *v1beta1.ThirdPartyResource, err error) {
obj, err := c.Fake. obj, err := c.Fake.
Invokes(core.NewGetAction(thirdpartyresourcesResource, c.ns, name), &v1beta1.ThirdPartyResource{}) Invokes(core.NewRootGetAction(thirdpartyresourcesResource, name), &v1beta1.ThirdPartyResource{})
if obj == nil { if obj == nil {
return nil, err return nil, err
...@@ -79,7 +78,7 @@ func (c *FakeThirdPartyResources) Get(name string) (result *v1beta1.ThirdPartyRe ...@@ -79,7 +78,7 @@ func (c *FakeThirdPartyResources) Get(name string) (result *v1beta1.ThirdPartyRe
func (c *FakeThirdPartyResources) List(opts api.ListOptions) (result *v1beta1.ThirdPartyResourceList, err error) { func (c *FakeThirdPartyResources) List(opts api.ListOptions) (result *v1beta1.ThirdPartyResourceList, err error) {
obj, err := c.Fake. obj, err := c.Fake.
Invokes(core.NewListAction(thirdpartyresourcesResource, c.ns, opts), &v1beta1.ThirdPartyResourceList{}) Invokes(core.NewRootListAction(thirdpartyresourcesResource, opts), &v1beta1.ThirdPartyResourceList{})
if obj == nil { if obj == nil {
return nil, err return nil, err
...@@ -101,6 +100,6 @@ func (c *FakeThirdPartyResources) List(opts api.ListOptions) (result *v1beta1.Th ...@@ -101,6 +100,6 @@ func (c *FakeThirdPartyResources) List(opts api.ListOptions) (result *v1beta1.Th
// Watch returns a watch.Interface that watches the requested thirdPartyResources. // Watch returns a watch.Interface that watches the requested thirdPartyResources.
func (c *FakeThirdPartyResources) Watch(opts api.ListOptions) (watch.Interface, error) { func (c *FakeThirdPartyResources) Watch(opts api.ListOptions) (watch.Interface, error) {
return c.Fake. return c.Fake.
InvokesWatch(core.NewWatchAction(thirdpartyresourcesResource, c.ns, opts)) InvokesWatch(core.NewRootWatchAction(thirdpartyresourcesResource, opts))
} }
...@@ -25,7 +25,7 @@ import ( ...@@ -25,7 +25,7 @@ import (
// ThirdPartyResourcesGetter has a method to return a ThirdPartyResourceInterface. // ThirdPartyResourcesGetter has a method to return a ThirdPartyResourceInterface.
// A group's client should implement this interface. // A group's client should implement this interface.
type ThirdPartyResourcesGetter interface { type ThirdPartyResourcesGetter interface {
ThirdPartyResources(namespace string) ThirdPartyResourceInterface ThirdPartyResources() ThirdPartyResourceInterface
} }
// ThirdPartyResourceInterface has methods to work with ThirdPartyResource resources. // ThirdPartyResourceInterface has methods to work with ThirdPartyResource resources.
...@@ -47,10 +47,9 @@ type thirdPartyResources struct { ...@@ -47,10 +47,9 @@ type thirdPartyResources struct {
} }
// newThirdPartyResources returns a ThirdPartyResources // newThirdPartyResources returns a ThirdPartyResources
func newThirdPartyResources(c *ExtensionsClient, namespace string) *thirdPartyResources { func newThirdPartyResources(c *ExtensionsClient) *thirdPartyResources {
return &thirdPartyResources{ return &thirdPartyResources{
client: c, client: c,
ns: namespace,
} }
} }
...@@ -58,7 +57,6 @@ func newThirdPartyResources(c *ExtensionsClient, namespace string) *thirdPartyRe ...@@ -58,7 +57,6 @@ func newThirdPartyResources(c *ExtensionsClient, namespace string) *thirdPartyRe
func (c *thirdPartyResources) Create(thirdPartyResource *v1beta1.ThirdPartyResource) (result *v1beta1.ThirdPartyResource, err error) { func (c *thirdPartyResources) Create(thirdPartyResource *v1beta1.ThirdPartyResource) (result *v1beta1.ThirdPartyResource, err error) {
result = &v1beta1.ThirdPartyResource{} result = &v1beta1.ThirdPartyResource{}
err = c.client.Post(). err = c.client.Post().
Namespace(c.ns).
Resource("thirdpartyresources"). Resource("thirdpartyresources").
Body(thirdPartyResource). Body(thirdPartyResource).
Do(). Do().
...@@ -70,7 +68,6 @@ func (c *thirdPartyResources) Create(thirdPartyResource *v1beta1.ThirdPartyResou ...@@ -70,7 +68,6 @@ func (c *thirdPartyResources) Create(thirdPartyResource *v1beta1.ThirdPartyResou
func (c *thirdPartyResources) Update(thirdPartyResource *v1beta1.ThirdPartyResource) (result *v1beta1.ThirdPartyResource, err error) { func (c *thirdPartyResources) Update(thirdPartyResource *v1beta1.ThirdPartyResource) (result *v1beta1.ThirdPartyResource, err error) {
result = &v1beta1.ThirdPartyResource{} result = &v1beta1.ThirdPartyResource{}
err = c.client.Put(). err = c.client.Put().
Namespace(c.ns).
Resource("thirdpartyresources"). Resource("thirdpartyresources").
Name(thirdPartyResource.Name). Name(thirdPartyResource.Name).
Body(thirdPartyResource). Body(thirdPartyResource).
...@@ -82,7 +79,6 @@ func (c *thirdPartyResources) Update(thirdPartyResource *v1beta1.ThirdPartyResou ...@@ -82,7 +79,6 @@ func (c *thirdPartyResources) Update(thirdPartyResource *v1beta1.ThirdPartyResou
// Delete takes name of the thirdPartyResource and deletes it. Returns an error if one occurs. // Delete takes name of the thirdPartyResource and deletes it. Returns an error if one occurs.
func (c *thirdPartyResources) Delete(name string, options *api.DeleteOptions) error { func (c *thirdPartyResources) Delete(name string, options *api.DeleteOptions) error {
return c.client.Delete(). return c.client.Delete().
Namespace(c.ns).
Resource("thirdpartyresources"). Resource("thirdpartyresources").
Name(name). Name(name).
Body(options). Body(options).
...@@ -93,7 +89,6 @@ func (c *thirdPartyResources) Delete(name string, options *api.DeleteOptions) er ...@@ -93,7 +89,6 @@ func (c *thirdPartyResources) Delete(name string, options *api.DeleteOptions) er
// DeleteCollection deletes a collection of objects. // DeleteCollection deletes a collection of objects.
func (c *thirdPartyResources) DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error { func (c *thirdPartyResources) DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error {
return c.client.Delete(). return c.client.Delete().
Namespace(c.ns).
Resource("thirdpartyresources"). Resource("thirdpartyresources").
VersionedParams(&listOptions, api.ParameterCodec). VersionedParams(&listOptions, api.ParameterCodec).
Body(options). Body(options).
...@@ -105,7 +100,6 @@ func (c *thirdPartyResources) DeleteCollection(options *api.DeleteOptions, listO ...@@ -105,7 +100,6 @@ func (c *thirdPartyResources) DeleteCollection(options *api.DeleteOptions, listO
func (c *thirdPartyResources) Get(name string) (result *v1beta1.ThirdPartyResource, err error) { func (c *thirdPartyResources) Get(name string) (result *v1beta1.ThirdPartyResource, err error) {
result = &v1beta1.ThirdPartyResource{} result = &v1beta1.ThirdPartyResource{}
err = c.client.Get(). err = c.client.Get().
Namespace(c.ns).
Resource("thirdpartyresources"). Resource("thirdpartyresources").
Name(name). Name(name).
Do(). Do().
...@@ -117,7 +111,6 @@ func (c *thirdPartyResources) Get(name string) (result *v1beta1.ThirdPartyResour ...@@ -117,7 +111,6 @@ func (c *thirdPartyResources) Get(name string) (result *v1beta1.ThirdPartyResour
func (c *thirdPartyResources) List(opts api.ListOptions) (result *v1beta1.ThirdPartyResourceList, err error) { func (c *thirdPartyResources) List(opts api.ListOptions) (result *v1beta1.ThirdPartyResourceList, err error) {
result = &v1beta1.ThirdPartyResourceList{} result = &v1beta1.ThirdPartyResourceList{}
err = c.client.Get(). err = c.client.Get().
Namespace(c.ns).
Resource("thirdpartyresources"). Resource("thirdpartyresources").
VersionedParams(&opts, api.ParameterCodec). VersionedParams(&opts, api.ParameterCodec).
Do(). Do().
...@@ -129,7 +122,6 @@ func (c *thirdPartyResources) List(opts api.ListOptions) (result *v1beta1.ThirdP ...@@ -129,7 +122,6 @@ func (c *thirdPartyResources) List(opts api.ListOptions) (result *v1beta1.ThirdP
func (c *thirdPartyResources) Watch(opts api.ListOptions) (watch.Interface, error) { func (c *thirdPartyResources) Watch(opts api.ListOptions) (watch.Interface, error) {
return c.client.Get(). return c.client.Get().
Prefix("watch"). Prefix("watch").
Namespace(c.ns).
Resource("thirdpartyresources"). Resource("thirdpartyresources").
VersionedParams(&opts, api.ParameterCodec). VersionedParams(&opts, api.ParameterCodec).
Watch() Watch()
......
...@@ -74,8 +74,8 @@ func (c *ExtensionsClient) Ingress(namespace string) IngressInterface { ...@@ -74,8 +74,8 @@ func (c *ExtensionsClient) Ingress(namespace string) IngressInterface {
return newIngress(c, namespace) return newIngress(c, namespace)
} }
func (c *ExtensionsClient) ThirdPartyResources(namespace string) ThirdPartyResourceInterface { func (c *ExtensionsClient) ThirdPartyResources() ThirdPartyResourceInterface {
return newThirdPartyResources(c, namespace) return newThirdPartyResources(c)
} }
func (c *ExtensionsClient) ReplicaSets(namespace string) ReplicaSetInterface { func (c *ExtensionsClient) ReplicaSets(namespace string) ReplicaSetInterface {
......
...@@ -26,15 +26,14 @@ import ( ...@@ -26,15 +26,14 @@ import (
// FakeThirdPartyResources implements ThirdPartyResourceInterface. Meant to be embedded into a struct to get a default // FakeThirdPartyResources implements ThirdPartyResourceInterface. Meant to be embedded into a struct to get a default
// implementation. This makes faking out just the method you want to test easier. // implementation. This makes faking out just the method you want to test easier.
type FakeThirdPartyResources struct { type FakeThirdPartyResources struct {
Fake *FakeExperimental Fake *FakeExperimental
Namespace string
} }
// Ensure statically that FakeThirdPartyResources implements DaemonInterface. // Ensure statically that FakeThirdPartyResources implements DaemonInterface.
var _ kclientlib.ThirdPartyResourceInterface = &FakeThirdPartyResources{} var _ kclientlib.ThirdPartyResourceInterface = &FakeThirdPartyResources{}
func (c *FakeThirdPartyResources) Get(name string) (*extensions.ThirdPartyResource, error) { func (c *FakeThirdPartyResources) Get(name string) (*extensions.ThirdPartyResource, error) {
obj, err := c.Fake.Invokes(NewGetAction("thirdpartyresources", c.Namespace, name), &extensions.ThirdPartyResource{}) obj, err := c.Fake.Invokes(NewGetAction("thirdpartyresources", "", name), &extensions.ThirdPartyResource{})
if obj == nil { if obj == nil {
return nil, err return nil, err
} }
...@@ -42,7 +41,7 @@ func (c *FakeThirdPartyResources) Get(name string) (*extensions.ThirdPartyResour ...@@ -42,7 +41,7 @@ func (c *FakeThirdPartyResources) Get(name string) (*extensions.ThirdPartyResour
} }
func (c *FakeThirdPartyResources) List(opts api.ListOptions) (*extensions.ThirdPartyResourceList, error) { func (c *FakeThirdPartyResources) List(opts api.ListOptions) (*extensions.ThirdPartyResourceList, error) {
obj, err := c.Fake.Invokes(NewListAction("thirdpartyresources", c.Namespace, opts), &extensions.ThirdPartyResourceList{}) obj, err := c.Fake.Invokes(NewListAction("thirdpartyresources", "", opts), &extensions.ThirdPartyResourceList{})
if obj == nil { if obj == nil {
return nil, err return nil, err
} }
...@@ -50,7 +49,7 @@ func (c *FakeThirdPartyResources) List(opts api.ListOptions) (*extensions.ThirdP ...@@ -50,7 +49,7 @@ func (c *FakeThirdPartyResources) List(opts api.ListOptions) (*extensions.ThirdP
} }
func (c *FakeThirdPartyResources) Create(daemon *extensions.ThirdPartyResource) (*extensions.ThirdPartyResource, error) { func (c *FakeThirdPartyResources) Create(daemon *extensions.ThirdPartyResource) (*extensions.ThirdPartyResource, error) {
obj, err := c.Fake.Invokes(NewCreateAction("thirdpartyresources", c.Namespace, daemon), &extensions.ThirdPartyResource{}) obj, err := c.Fake.Invokes(NewCreateAction("thirdpartyresources", "", daemon), &extensions.ThirdPartyResource{})
if obj == nil { if obj == nil {
return nil, err return nil, err
} }
...@@ -58,7 +57,7 @@ func (c *FakeThirdPartyResources) Create(daemon *extensions.ThirdPartyResource) ...@@ -58,7 +57,7 @@ func (c *FakeThirdPartyResources) Create(daemon *extensions.ThirdPartyResource)
} }
func (c *FakeThirdPartyResources) Update(daemon *extensions.ThirdPartyResource) (*extensions.ThirdPartyResource, error) { func (c *FakeThirdPartyResources) Update(daemon *extensions.ThirdPartyResource) (*extensions.ThirdPartyResource, error) {
obj, err := c.Fake.Invokes(NewUpdateAction("thirdpartyresources", c.Namespace, daemon), &extensions.ThirdPartyResource{}) obj, err := c.Fake.Invokes(NewUpdateAction("thirdpartyresources", "", daemon), &extensions.ThirdPartyResource{})
if obj == nil { if obj == nil {
return nil, err return nil, err
} }
...@@ -66,7 +65,7 @@ func (c *FakeThirdPartyResources) Update(daemon *extensions.ThirdPartyResource) ...@@ -66,7 +65,7 @@ func (c *FakeThirdPartyResources) Update(daemon *extensions.ThirdPartyResource)
} }
func (c *FakeThirdPartyResources) UpdateStatus(daemon *extensions.ThirdPartyResource) (*extensions.ThirdPartyResource, error) { func (c *FakeThirdPartyResources) UpdateStatus(daemon *extensions.ThirdPartyResource) (*extensions.ThirdPartyResource, error) {
obj, err := c.Fake.Invokes(NewUpdateSubresourceAction("thirdpartyresources", "status", c.Namespace, daemon), &extensions.ThirdPartyResource{}) obj, err := c.Fake.Invokes(NewUpdateSubresourceAction("thirdpartyresources", "status", "", daemon), &extensions.ThirdPartyResource{})
if obj == nil { if obj == nil {
return nil, err return nil, err
} }
...@@ -74,10 +73,10 @@ func (c *FakeThirdPartyResources) UpdateStatus(daemon *extensions.ThirdPartyReso ...@@ -74,10 +73,10 @@ func (c *FakeThirdPartyResources) UpdateStatus(daemon *extensions.ThirdPartyReso
} }
func (c *FakeThirdPartyResources) Delete(name string) error { func (c *FakeThirdPartyResources) Delete(name string) error {
_, err := c.Fake.Invokes(NewDeleteAction("thirdpartyresources", c.Namespace, name), &extensions.ThirdPartyResource{}) _, err := c.Fake.Invokes(NewDeleteAction("thirdpartyresources", "", name), &extensions.ThirdPartyResource{})
return err return err
} }
func (c *FakeThirdPartyResources) Watch(opts api.ListOptions) (watch.Interface, error) { func (c *FakeThirdPartyResources) Watch(opts api.ListOptions) (watch.Interface, error) {
return c.Fake.InvokesWatch(NewWatchAction("thirdpartyresources", c.Namespace, opts)) return c.Fake.InvokesWatch(NewWatchAction("thirdpartyresources", "", opts))
} }
...@@ -374,8 +374,8 @@ func (c *FakeExperimental) Ingress(namespace string) client.IngressInterface { ...@@ -374,8 +374,8 @@ func (c *FakeExperimental) Ingress(namespace string) client.IngressInterface {
return &FakeIngress{Fake: c, Namespace: namespace} return &FakeIngress{Fake: c, Namespace: namespace}
} }
func (c *FakeExperimental) ThirdPartyResources(namespace string) client.ThirdPartyResourceInterface { func (c *FakeExperimental) ThirdPartyResources() client.ThirdPartyResourceInterface {
return &FakeThirdPartyResources{Fake: c, Namespace: namespace} return &FakeThirdPartyResources{Fake: c}
} }
func (c *FakeExperimental) ReplicaSets(namespace string) client.ReplicaSetInterface { func (c *FakeExperimental) ReplicaSets(namespace string) client.ReplicaSetInterface {
......
...@@ -24,7 +24,7 @@ import ( ...@@ -24,7 +24,7 @@ import (
// ThirdPartyResourceNamespacer has methods to work with ThirdPartyResource resources in a namespace // ThirdPartyResourceNamespacer has methods to work with ThirdPartyResource resources in a namespace
type ThirdPartyResourceNamespacer interface { type ThirdPartyResourceNamespacer interface {
ThirdPartyResources(namespace string) ThirdPartyResourceInterface ThirdPartyResources() ThirdPartyResourceInterface
} }
type ThirdPartyResourceInterface interface { type ThirdPartyResourceInterface interface {
...@@ -39,12 +39,11 @@ type ThirdPartyResourceInterface interface { ...@@ -39,12 +39,11 @@ type ThirdPartyResourceInterface interface {
// thirdPartyResources implements DaemonsSetsNamespacer interface // thirdPartyResources implements DaemonsSetsNamespacer interface
type thirdPartyResources struct { type thirdPartyResources struct {
r *ExtensionsClient r *ExtensionsClient
ns string
} }
func newThirdPartyResources(c *ExtensionsClient, namespace string) *thirdPartyResources { func newThirdPartyResources(c *ExtensionsClient) *thirdPartyResources {
return &thirdPartyResources{c, namespace} return &thirdPartyResources{c}
} }
// Ensure statically that thirdPartyResources implements ThirdPartyResourcesInterface. // Ensure statically that thirdPartyResources implements ThirdPartyResourcesInterface.
...@@ -52,48 +51,47 @@ var _ ThirdPartyResourceInterface = &thirdPartyResources{} ...@@ -52,48 +51,47 @@ var _ ThirdPartyResourceInterface = &thirdPartyResources{}
func (c *thirdPartyResources) List(opts api.ListOptions) (result *extensions.ThirdPartyResourceList, err error) { func (c *thirdPartyResources) List(opts api.ListOptions) (result *extensions.ThirdPartyResourceList, err error) {
result = &extensions.ThirdPartyResourceList{} result = &extensions.ThirdPartyResourceList{}
err = c.r.Get().Namespace(c.ns).Resource("thirdpartyresources").VersionedParams(&opts, api.ParameterCodec).Do().Into(result) err = c.r.Get().Resource("thirdpartyresources").VersionedParams(&opts, api.ParameterCodec).Do().Into(result)
return return
} }
// Get returns information about a particular third party resource. // Get returns information about a particular third party resource.
func (c *thirdPartyResources) Get(name string) (result *extensions.ThirdPartyResource, err error) { func (c *thirdPartyResources) Get(name string) (result *extensions.ThirdPartyResource, err error) {
result = &extensions.ThirdPartyResource{} result = &extensions.ThirdPartyResource{}
err = c.r.Get().Namespace(c.ns).Resource("thirdpartyresources").Name(name).Do().Into(result) err = c.r.Get().Resource("thirdpartyresources").Name(name).Do().Into(result)
return return
} }
// Create creates a new third party resource. // Create creates a new third party resource.
func (c *thirdPartyResources) Create(resource *extensions.ThirdPartyResource) (result *extensions.ThirdPartyResource, err error) { func (c *thirdPartyResources) Create(resource *extensions.ThirdPartyResource) (result *extensions.ThirdPartyResource, err error) {
result = &extensions.ThirdPartyResource{} result = &extensions.ThirdPartyResource{}
err = c.r.Post().Namespace(c.ns).Resource("thirdpartyresources").Body(resource).Do().Into(result) err = c.r.Post().Resource("thirdpartyresources").Body(resource).Do().Into(result)
return return
} }
// Update updates an existing third party resource. // Update updates an existing third party resource.
func (c *thirdPartyResources) Update(resource *extensions.ThirdPartyResource) (result *extensions.ThirdPartyResource, err error) { func (c *thirdPartyResources) Update(resource *extensions.ThirdPartyResource) (result *extensions.ThirdPartyResource, err error) {
result = &extensions.ThirdPartyResource{} result = &extensions.ThirdPartyResource{}
err = c.r.Put().Namespace(c.ns).Resource("thirdpartyresources").Name(resource.Name).Body(resource).Do().Into(result) err = c.r.Put().Resource("thirdpartyresources").Name(resource.Name).Body(resource).Do().Into(result)
return return
} }
// UpdateStatus updates an existing third party resource status // UpdateStatus updates an existing third party resource status
func (c *thirdPartyResources) UpdateStatus(resource *extensions.ThirdPartyResource) (result *extensions.ThirdPartyResource, err error) { func (c *thirdPartyResources) UpdateStatus(resource *extensions.ThirdPartyResource) (result *extensions.ThirdPartyResource, err error) {
result = &extensions.ThirdPartyResource{} result = &extensions.ThirdPartyResource{}
err = c.r.Put().Namespace(c.ns).Resource("thirdpartyresources").Name(resource.Name).SubResource("status").Body(resource).Do().Into(result) err = c.r.Put().Resource("thirdpartyresources").Name(resource.Name).SubResource("status").Body(resource).Do().Into(result)
return return
} }
// Delete deletes an existing third party resource. // Delete deletes an existing third party resource.
func (c *thirdPartyResources) Delete(name string) error { func (c *thirdPartyResources) Delete(name string) error {
return c.r.Delete().Namespace(c.ns).Resource("thirdpartyresources").Name(name).Do().Error() return c.r.Delete().Resource("thirdpartyresources").Name(name).Do().Error()
} }
// Watch returns a watch.Interface that watches the requested third party resources. // Watch returns a watch.Interface that watches the requested third party resources.
func (c *thirdPartyResources) Watch(opts api.ListOptions) (watch.Interface, error) { func (c *thirdPartyResources) Watch(opts api.ListOptions) (watch.Interface, error) {
return c.r.Get(). return c.r.Get().
Prefix("watch"). Prefix("watch").
Namespace(c.ns).
Resource("thirdpartyresources"). Resource("thirdpartyresources").
VersionedParams(&opts, api.ParameterCodec). VersionedParams(&opts, api.ParameterCodec).
Watch() Watch()
......
...@@ -30,11 +30,10 @@ func getThirdPartyResourceName() string { ...@@ -30,11 +30,10 @@ func getThirdPartyResourceName() string {
} }
func TestListThirdPartyResources(t *testing.T) { func TestListThirdPartyResources(t *testing.T) {
ns := api.NamespaceAll
c := &simple.Client{ c := &simple.Client{
Request: simple.Request{ Request: simple.Request{
Method: "GET", Method: "GET",
Path: testapi.Extensions.ResourcePath(getThirdPartyResourceName(), ns, ""), Path: testapi.Extensions.ResourcePath(getThirdPartyResourceName(), "", ""),
}, },
Response: simple.Response{StatusCode: 200, Response: simple.Response{StatusCode: 200,
Body: &extensions.ThirdPartyResourceList{ Body: &extensions.ThirdPartyResourceList{
...@@ -53,16 +52,15 @@ func TestListThirdPartyResources(t *testing.T) { ...@@ -53,16 +52,15 @@ func TestListThirdPartyResources(t *testing.T) {
}, },
}, },
} }
receivedDSs, err := c.Setup(t).Extensions().ThirdPartyResources(ns).List(api.ListOptions{}) receivedDSs, err := c.Setup(t).Extensions().ThirdPartyResources().List(api.ListOptions{})
defer c.Close() defer c.Close()
c.Validate(t, receivedDSs, err) c.Validate(t, receivedDSs, err)
} }
func TestGetThirdPartyResource(t *testing.T) { func TestGetThirdPartyResource(t *testing.T) {
ns := api.NamespaceDefault
c := &simple.Client{ c := &simple.Client{
Request: simple.Request{Method: "GET", Path: testapi.Extensions.ResourcePath(getThirdPartyResourceName(), ns, "foo"), Query: simple.BuildQueryValues(nil)}, Request: simple.Request{Method: "GET", Path: testapi.Extensions.ResourcePath(getThirdPartyResourceName(), "", "foo"), Query: simple.BuildQueryValues(nil)},
Response: simple.Response{ Response: simple.Response{
StatusCode: 200, StatusCode: 200,
Body: &extensions.ThirdPartyResource{ Body: &extensions.ThirdPartyResource{
...@@ -77,15 +75,14 @@ func TestGetThirdPartyResource(t *testing.T) { ...@@ -77,15 +75,14 @@ func TestGetThirdPartyResource(t *testing.T) {
}, },
}, },
} }
receivedThirdPartyResource, err := c.Setup(t).Extensions().ThirdPartyResources(ns).Get("foo") receivedThirdPartyResource, err := c.Setup(t).Extensions().ThirdPartyResources().Get("foo")
defer c.Close() defer c.Close()
c.Validate(t, receivedThirdPartyResource, err) c.Validate(t, receivedThirdPartyResource, err)
} }
func TestGetThirdPartyResourceWithNoName(t *testing.T) { func TestGetThirdPartyResourceWithNoName(t *testing.T) {
ns := api.NamespaceDefault
c := &simple.Client{Error: true} c := &simple.Client{Error: true}
receivedPod, err := c.Setup(t).Extensions().ThirdPartyResources(ns).Get("") receivedPod, err := c.Setup(t).Extensions().ThirdPartyResources().Get("")
defer c.Close() defer c.Close()
if (err != nil) && (err.Error() != simple.NameRequiredError) { if (err != nil) && (err.Error() != simple.NameRequiredError) {
t.Errorf("Expected error: %v, but got %v", simple.NameRequiredError, err) t.Errorf("Expected error: %v, but got %v", simple.NameRequiredError, err)
...@@ -95,12 +92,11 @@ func TestGetThirdPartyResourceWithNoName(t *testing.T) { ...@@ -95,12 +92,11 @@ func TestGetThirdPartyResourceWithNoName(t *testing.T) {
} }
func TestUpdateThirdPartyResource(t *testing.T) { func TestUpdateThirdPartyResource(t *testing.T) {
ns := api.NamespaceDefault
requestThirdPartyResource := &extensions.ThirdPartyResource{ requestThirdPartyResource := &extensions.ThirdPartyResource{
ObjectMeta: api.ObjectMeta{Name: "foo", ResourceVersion: "1"}, ObjectMeta: api.ObjectMeta{Name: "foo", ResourceVersion: "1"},
} }
c := &simple.Client{ c := &simple.Client{
Request: simple.Request{Method: "PUT", Path: testapi.Extensions.ResourcePath(getThirdPartyResourceName(), ns, "foo"), Query: simple.BuildQueryValues(nil)}, Request: simple.Request{Method: "PUT", Path: testapi.Extensions.ResourcePath(getThirdPartyResourceName(), "", "foo"), Query: simple.BuildQueryValues(nil)},
Response: simple.Response{ Response: simple.Response{
StatusCode: 200, StatusCode: 200,
Body: &extensions.ThirdPartyResource{ Body: &extensions.ThirdPartyResource{
...@@ -115,18 +111,17 @@ func TestUpdateThirdPartyResource(t *testing.T) { ...@@ -115,18 +111,17 @@ func TestUpdateThirdPartyResource(t *testing.T) {
}, },
}, },
} }
receivedThirdPartyResource, err := c.Setup(t).Extensions().ThirdPartyResources(ns).Update(requestThirdPartyResource) receivedThirdPartyResource, err := c.Setup(t).Extensions().ThirdPartyResources().Update(requestThirdPartyResource)
defer c.Close() defer c.Close()
c.Validate(t, receivedThirdPartyResource, err) c.Validate(t, receivedThirdPartyResource, err)
} }
func TestUpdateThirdPartyResourceUpdateStatus(t *testing.T) { func TestUpdateThirdPartyResourceUpdateStatus(t *testing.T) {
ns := api.NamespaceDefault
requestThirdPartyResource := &extensions.ThirdPartyResource{ requestThirdPartyResource := &extensions.ThirdPartyResource{
ObjectMeta: api.ObjectMeta{Name: "foo", ResourceVersion: "1"}, ObjectMeta: api.ObjectMeta{Name: "foo", ResourceVersion: "1"},
} }
c := &simple.Client{ c := &simple.Client{
Request: simple.Request{Method: "PUT", Path: testapi.Extensions.ResourcePath(getThirdPartyResourceName(), ns, "foo") + "/status", Query: simple.BuildQueryValues(nil)}, Request: simple.Request{Method: "PUT", Path: testapi.Extensions.ResourcePath(getThirdPartyResourceName(), "", "foo") + "/status", Query: simple.BuildQueryValues(nil)},
Response: simple.Response{ Response: simple.Response{
StatusCode: 200, StatusCode: 200,
Body: &extensions.ThirdPartyResource{ Body: &extensions.ThirdPartyResource{
...@@ -141,29 +136,27 @@ func TestUpdateThirdPartyResourceUpdateStatus(t *testing.T) { ...@@ -141,29 +136,27 @@ func TestUpdateThirdPartyResourceUpdateStatus(t *testing.T) {
}, },
}, },
} }
receivedThirdPartyResource, err := c.Setup(t).Extensions().ThirdPartyResources(ns).UpdateStatus(requestThirdPartyResource) receivedThirdPartyResource, err := c.Setup(t).Extensions().ThirdPartyResources().UpdateStatus(requestThirdPartyResource)
defer c.Close() defer c.Close()
c.Validate(t, receivedThirdPartyResource, err) c.Validate(t, receivedThirdPartyResource, err)
} }
func TestDeleteThirdPartyResource(t *testing.T) { func TestDeleteThirdPartyResource(t *testing.T) {
ns := api.NamespaceDefault
c := &simple.Client{ c := &simple.Client{
Request: simple.Request{Method: "DELETE", Path: testapi.Extensions.ResourcePath(getThirdPartyResourceName(), ns, "foo"), Query: simple.BuildQueryValues(nil)}, Request: simple.Request{Method: "DELETE", Path: testapi.Extensions.ResourcePath(getThirdPartyResourceName(), "", "foo"), Query: simple.BuildQueryValues(nil)},
Response: simple.Response{StatusCode: 200}, Response: simple.Response{StatusCode: 200},
} }
err := c.Setup(t).Extensions().ThirdPartyResources(ns).Delete("foo") err := c.Setup(t).Extensions().ThirdPartyResources().Delete("foo")
defer c.Close() defer c.Close()
c.Validate(t, nil, err) c.Validate(t, nil, err)
} }
func TestCreateThirdPartyResource(t *testing.T) { func TestCreateThirdPartyResource(t *testing.T) {
ns := api.NamespaceDefault
requestThirdPartyResource := &extensions.ThirdPartyResource{ requestThirdPartyResource := &extensions.ThirdPartyResource{
ObjectMeta: api.ObjectMeta{Name: "foo"}, ObjectMeta: api.ObjectMeta{Name: "foo"},
} }
c := &simple.Client{ c := &simple.Client{
Request: simple.Request{Method: "POST", Path: testapi.Extensions.ResourcePath(getThirdPartyResourceName(), ns, ""), Body: requestThirdPartyResource, Query: simple.BuildQueryValues(nil)}, Request: simple.Request{Method: "POST", Path: testapi.Extensions.ResourcePath(getThirdPartyResourceName(), "", ""), Body: requestThirdPartyResource, Query: simple.BuildQueryValues(nil)},
Response: simple.Response{ Response: simple.Response{
StatusCode: 200, StatusCode: 200,
Body: &extensions.ThirdPartyResource{ Body: &extensions.ThirdPartyResource{
...@@ -178,7 +171,7 @@ func TestCreateThirdPartyResource(t *testing.T) { ...@@ -178,7 +171,7 @@ func TestCreateThirdPartyResource(t *testing.T) {
}, },
}, },
} }
receivedThirdPartyResource, err := c.Setup(t).Extensions().ThirdPartyResources(ns).Create(requestThirdPartyResource) receivedThirdPartyResource, err := c.Setup(t).Extensions().ThirdPartyResources().Create(requestThirdPartyResource)
defer c.Close() defer c.Close()
c.Validate(t, receivedThirdPartyResource, err) c.Validate(t, receivedThirdPartyResource, err)
} }
...@@ -43,10 +43,10 @@ func NewREST(opts generic.RESTOptions) *REST { ...@@ -43,10 +43,10 @@ func NewREST(opts generic.RESTOptions) *REST {
NewFunc: func() runtime.Object { return &extensions.ThirdPartyResource{} }, NewFunc: func() runtime.Object { return &extensions.ThirdPartyResource{} },
NewListFunc: func() runtime.Object { return &extensions.ThirdPartyResourceList{} }, NewListFunc: func() runtime.Object { return &extensions.ThirdPartyResourceList{} },
KeyRootFunc: func(ctx api.Context) string { KeyRootFunc: func(ctx api.Context) string {
return registry.NamespaceKeyRootFunc(ctx, prefix) return prefix
}, },
KeyFunc: func(ctx api.Context, id string) (string, error) { KeyFunc: func(ctx api.Context, id string) (string, error) {
return registry.NamespaceKeyFunc(ctx, prefix, id) return registry.NoNamespaceKeyFunc(ctx, prefix, id)
}, },
ObjectNameFunc: func(obj runtime.Object) (string, error) { ObjectNameFunc: func(obj runtime.Object) (string, error) {
return obj.(*extensions.ThirdPartyResource).Name, nil return obj.(*extensions.ThirdPartyResource).Name, nil
......
...@@ -40,8 +40,7 @@ func newStorage(t *testing.T) (*REST, *etcdtesting.EtcdTestServer) { ...@@ -40,8 +40,7 @@ func newStorage(t *testing.T) (*REST, *etcdtesting.EtcdTestServer) {
func validNewThirdPartyResource(name string) *extensions.ThirdPartyResource { func validNewThirdPartyResource(name string) *extensions.ThirdPartyResource {
return &extensions.ThirdPartyResource{ return &extensions.ThirdPartyResource{
ObjectMeta: api.ObjectMeta{ ObjectMeta: api.ObjectMeta{
Name: name, Name: name,
Namespace: api.NamespaceDefault,
}, },
Versions: []extensions.APIVersion{ Versions: []extensions.APIVersion{
{ {
...@@ -54,9 +53,9 @@ func validNewThirdPartyResource(name string) *extensions.ThirdPartyResource { ...@@ -54,9 +53,9 @@ func validNewThirdPartyResource(name string) *extensions.ThirdPartyResource {
func TestCreate(t *testing.T) { func TestCreate(t *testing.T) {
storage, server := newStorage(t) storage, server := newStorage(t)
defer server.Terminate(t) defer server.Terminate(t)
test := registrytest.New(t, storage.Store) test := registrytest.New(t, storage.Store).ClusterScope()
rsrc := validNewThirdPartyResource("foo") rsrc := validNewThirdPartyResource("foo")
rsrc.ObjectMeta = api.ObjectMeta{} rsrc.ObjectMeta = api.ObjectMeta{GenerateName: "foo-"}
test.TestCreate( test.TestCreate(
// valid // valid
rsrc, rsrc,
...@@ -68,7 +67,7 @@ func TestCreate(t *testing.T) { ...@@ -68,7 +67,7 @@ func TestCreate(t *testing.T) {
func TestUpdate(t *testing.T) { func TestUpdate(t *testing.T) {
storage, server := newStorage(t) storage, server := newStorage(t)
defer server.Terminate(t) defer server.Terminate(t)
test := registrytest.New(t, storage.Store) test := registrytest.New(t, storage.Store).ClusterScope()
test.TestUpdate( test.TestUpdate(
// valid // valid
validNewThirdPartyResource("foo"), validNewThirdPartyResource("foo"),
...@@ -84,28 +83,28 @@ func TestUpdate(t *testing.T) { ...@@ -84,28 +83,28 @@ func TestUpdate(t *testing.T) {
func TestDelete(t *testing.T) { func TestDelete(t *testing.T) {
storage, server := newStorage(t) storage, server := newStorage(t)
defer server.Terminate(t) defer server.Terminate(t)
test := registrytest.New(t, storage.Store) test := registrytest.New(t, storage.Store).ClusterScope()
test.TestDelete(validNewThirdPartyResource("foo")) test.TestDelete(validNewThirdPartyResource("foo"))
} }
func TestGet(t *testing.T) { func TestGet(t *testing.T) {
storage, server := newStorage(t) storage, server := newStorage(t)
defer server.Terminate(t) defer server.Terminate(t)
test := registrytest.New(t, storage.Store) test := registrytest.New(t, storage.Store).ClusterScope()
test.TestGet(validNewThirdPartyResource("foo")) test.TestGet(validNewThirdPartyResource("foo"))
} }
func TestList(t *testing.T) { func TestList(t *testing.T) {
storage, server := newStorage(t) storage, server := newStorage(t)
defer server.Terminate(t) defer server.Terminate(t)
test := registrytest.New(t, storage.Store) test := registrytest.New(t, storage.Store).ClusterScope()
test.TestList(validNewThirdPartyResource("foo")) test.TestList(validNewThirdPartyResource("foo"))
} }
func TestWatch(t *testing.T) { func TestWatch(t *testing.T) {
storage, server := newStorage(t) storage, server := newStorage(t)
defer server.Terminate(t) defer server.Terminate(t)
test := registrytest.New(t, storage.Store) test := registrytest.New(t, storage.Store).ClusterScope()
test.TestWatch( test.TestWatch(
validNewThirdPartyResource("foo"), validNewThirdPartyResource("foo"),
// matching labels // matching labels
......
...@@ -45,7 +45,7 @@ var _ = rest.RESTCreateStrategy(Strategy) ...@@ -45,7 +45,7 @@ var _ = rest.RESTCreateStrategy(Strategy)
var _ = rest.RESTUpdateStrategy(Strategy) var _ = rest.RESTUpdateStrategy(Strategy)
func (strategy) NamespaceScoped() bool { func (strategy) NamespaceScoped() bool {
return true return false
} }
func (strategy) PrepareForCreate(obj runtime.Object) { func (strategy) PrepareForCreate(obj runtime.Object) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment