mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-03 09:22:44 +00:00
Add patch status to Node internalclientset
This commit is contained in:
parent
e3e919ca20
commit
926bb4cca0
@ -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
|
||||||
|
}
|
@ -22,8 +22,6 @@ type EndpointsExpansion interface{}
|
|||||||
|
|
||||||
type LimitRangeExpansion interface{}
|
type LimitRangeExpansion interface{}
|
||||||
|
|
||||||
type NodeExpansion interface{}
|
|
||||||
|
|
||||||
type PersistentVolumeExpansion interface{}
|
type PersistentVolumeExpansion interface{}
|
||||||
|
|
||||||
type PersistentVolumeClaimExpansion interface{}
|
type PersistentVolumeClaimExpansion interface{}
|
||||||
|
@ -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
|
||||||
|
}
|
@ -137,6 +137,15 @@ func NewPatchAction(resource unversioned.GroupVersionResource, namespace string,
|
|||||||
return action
|
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 {
|
func NewRootUpdateSubresourceAction(resource unversioned.GroupVersionResource, subresource string, object runtime.Object) UpdateActionImpl {
|
||||||
action := UpdateActionImpl{}
|
action := UpdateActionImpl{}
|
||||||
action.Verb = "update"
|
action.Verb = "update"
|
||||||
|
@ -157,6 +157,11 @@ func (m *FakeNodeHandler) UpdateStatus(node *api.Node) (*api.Node, error) {
|
|||||||
return node, nil
|
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) {
|
func (m *FakeNodeHandler) Watch(opts api.ListOptions) (watch.Interface, error) {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user