diff --git a/pkg/client/clientset_generated/internalclientset/typed/core/unversioned/fake/fake_node_expansion.go b/pkg/client/clientset_generated/internalclientset/typed/core/unversioned/fake/fake_node_expansion.go new file mode 100644 index 00000000000..161d5e74593 --- /dev/null +++ b/pkg/client/clientset_generated/internalclientset/typed/core/unversioned/fake/fake_node_expansion.go @@ -0,0 +1,32 @@ +/* +Copyright 2016 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package fake + +import ( + "k8s.io/kubernetes/pkg/api" + "k8s.io/kubernetes/pkg/client/testing/core" +) + +func (c *FakeNodes) PatchStatus(nodeName string, data []byte) (*api.Node, error) { + obj, err := c.Fake.Invokes( + core.NewPatchSubresourceAction(nodesResource, "status"), &api.Node{}) + if obj == nil { + return nil, err + } + + return obj.(*api.Node), err +} diff --git a/pkg/client/clientset_generated/internalclientset/typed/core/unversioned/generated_expansion.go b/pkg/client/clientset_generated/internalclientset/typed/core/unversioned/generated_expansion.go index eeb51962e8b..546f8e7a1d1 100644 --- a/pkg/client/clientset_generated/internalclientset/typed/core/unversioned/generated_expansion.go +++ b/pkg/client/clientset_generated/internalclientset/typed/core/unversioned/generated_expansion.go @@ -22,8 +22,6 @@ type EndpointsExpansion interface{} type LimitRangeExpansion interface{} -type NodeExpansion interface{} - type PersistentVolumeExpansion interface{} type PersistentVolumeClaimExpansion interface{} diff --git a/pkg/client/clientset_generated/internalclientset/typed/core/unversioned/node_expansion.go b/pkg/client/clientset_generated/internalclientset/typed/core/unversioned/node_expansion.go new file mode 100644 index 00000000000..3146cdb357e --- /dev/null +++ b/pkg/client/clientset_generated/internalclientset/typed/core/unversioned/node_expansion.go @@ -0,0 +1,40 @@ +/* +Copyright 2016 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package unversioned + +import "k8s.io/kubernetes/pkg/api" + +// The NodeExpansion interface allows manually adding extra methods to the NodeInterface. +type NodeExpansion interface { + // PatchStatus modifies the status of an existing node. It returns the copy + // of the node that the server returns, or an error. + PatchStatus(nodeName string, data []byte) (*api.Node, error) +} + +// PatchStatus modifies the status of an existing node. It returns the copy of +// the node that the server returns, or an error. +func (c *nodes) PatchStatus(nodeName string, data []byte) (*api.Node, error) { + result := &api.Node{} + err := c.client.Patch(api.StrategicMergePatchType). + Resource("nodes"). + Name(nodeName). + SubResource("status"). + Body(data). + Do(). + Into(result) + return result, err +} diff --git a/pkg/client/testing/core/actions.go b/pkg/client/testing/core/actions.go index 24a707c8a9b..70f5b14fd39 100644 --- a/pkg/client/testing/core/actions.go +++ b/pkg/client/testing/core/actions.go @@ -137,6 +137,15 @@ func NewPatchAction(resource unversioned.GroupVersionResource, namespace string, return action } +func NewPatchSubresourceAction(resource unversioned.GroupVersionResource, subresource string) PatchActionImpl { + action := PatchActionImpl{} + action.Verb = "patch" + action.Resource = resource + action.Subresource = subresource + + return action +} + func NewRootUpdateSubresourceAction(resource unversioned.GroupVersionResource, subresource string, object runtime.Object) UpdateActionImpl { action := UpdateActionImpl{} action.Verb = "update" diff --git a/pkg/controller/node/nodecontroller_test.go b/pkg/controller/node/nodecontroller_test.go index e386004c88e..5c60e028df9 100644 --- a/pkg/controller/node/nodecontroller_test.go +++ b/pkg/controller/node/nodecontroller_test.go @@ -157,6 +157,11 @@ func (m *FakeNodeHandler) UpdateStatus(node *api.Node) (*api.Node, error) { return node, nil } +func (m *FakeNodeHandler) PatchStatus(nodeName string, data []byte) (*api.Node, error) { + m.RequestCount++ + return &api.Node{}, nil +} + func (m *FakeNodeHandler) Watch(opts api.ListOptions) (watch.Interface, error) { return nil, nil }