mirror of
https://github.com/kubernetes/client-go.git
synced 2025-09-05 17:10:27 +00:00
published by bot
(https://github.com/kubernetes/contrib/tree/master/mungegithub) copied from https://github.com/kubernetes/kubernetes.git, branch master, last commit is abed7461722c195f8c77b4c502743e012d19d095
This commit is contained in:
@@ -57,7 +57,7 @@ import (
|
||||
// without applying any validations and/or defaults. It shouldn't be considered a replacement
|
||||
// for a real clientset and is mostly useful in simple unit tests.
|
||||
func NewSimpleClientset(objects ...runtime.Object) *Clientset {
|
||||
o := testing.NewObjectTracker(api.Scheme, api.Codecs.UniversalDecoder())
|
||||
o := testing.NewObjectTracker(api.Registry, api.Scheme, api.Codecs.UniversalDecoder())
|
||||
for _, obj := range objects {
|
||||
if err := o.Add(obj); err != nil {
|
||||
panic(err)
|
||||
|
@@ -18,10 +18,10 @@ package fake
|
||||
|
||||
import (
|
||||
authenticationapi "k8s.io/client-go/pkg/apis/authentication/v1beta1"
|
||||
"k8s.io/client-go/testing"
|
||||
core "k8s.io/client-go/testing"
|
||||
)
|
||||
|
||||
func (c *FakeTokenReviews) Create(tokenReview *authenticationapi.TokenReview) (result *authenticationapi.TokenReview, err error) {
|
||||
obj, err := c.Fake.Invokes(testing.NewRootCreateAction(authenticationapi.SchemeGroupVersion.WithResource("tokenreviews"), tokenReview), &authenticationapi.TokenReview{})
|
||||
obj, err := c.Fake.Invokes(core.NewRootCreateAction(authenticationapi.SchemeGroupVersion.WithResource("tokenreviews"), tokenReview), &authenticationapi.TokenReview{})
|
||||
return obj.(*authenticationapi.TokenReview), err
|
||||
}
|
||||
|
@@ -18,10 +18,10 @@ package fake
|
||||
|
||||
import (
|
||||
authorizationapi "k8s.io/client-go/pkg/apis/authorization/v1beta1"
|
||||
"k8s.io/client-go/testing"
|
||||
core "k8s.io/client-go/testing"
|
||||
)
|
||||
|
||||
func (c *FakeLocalSubjectAccessReviews) Create(sar *authorizationapi.LocalSubjectAccessReview) (result *authorizationapi.LocalSubjectAccessReview, err error) {
|
||||
obj, err := c.Fake.Invokes(testing.NewCreateAction(authorizationapi.SchemeGroupVersion.WithResource("localsubjectaccessreviews"), c.ns, sar), &authorizationapi.SubjectAccessReview{})
|
||||
obj, err := c.Fake.Invokes(core.NewCreateAction(authorizationapi.SchemeGroupVersion.WithResource("localsubjectaccessreviews"), c.ns, sar), &authorizationapi.SubjectAccessReview{})
|
||||
return obj.(*authorizationapi.LocalSubjectAccessReview), err
|
||||
}
|
||||
|
@@ -18,10 +18,10 @@ package fake
|
||||
|
||||
import (
|
||||
authorizationapi "k8s.io/client-go/pkg/apis/authorization/v1beta1"
|
||||
"k8s.io/client-go/testing"
|
||||
core "k8s.io/client-go/testing"
|
||||
)
|
||||
|
||||
func (c *FakeSelfSubjectAccessReviews) Create(sar *authorizationapi.SelfSubjectAccessReview) (result *authorizationapi.SelfSubjectAccessReview, err error) {
|
||||
obj, err := c.Fake.Invokes(testing.NewRootCreateAction(authorizationapi.SchemeGroupVersion.WithResource("selfsubjectaccessreviews"), sar), &authorizationapi.SelfSubjectAccessReview{})
|
||||
obj, err := c.Fake.Invokes(core.NewRootCreateAction(authorizationapi.SchemeGroupVersion.WithResource("selfsubjectaccessreviews"), sar), &authorizationapi.SelfSubjectAccessReview{})
|
||||
return obj.(*authorizationapi.SelfSubjectAccessReview), err
|
||||
}
|
||||
|
@@ -18,10 +18,10 @@ package fake
|
||||
|
||||
import (
|
||||
authorizationapi "k8s.io/client-go/pkg/apis/authorization/v1beta1"
|
||||
"k8s.io/client-go/testing"
|
||||
core "k8s.io/client-go/testing"
|
||||
)
|
||||
|
||||
func (c *FakeSubjectAccessReviews) Create(sar *authorizationapi.SubjectAccessReview) (result *authorizationapi.SubjectAccessReview, err error) {
|
||||
obj, err := c.Fake.Invokes(testing.NewRootCreateAction(authorizationapi.SchemeGroupVersion.WithResource("subjectaccessreviews"), sar), &authorizationapi.SubjectAccessReview{})
|
||||
obj, err := c.Fake.Invokes(core.NewRootCreateAction(authorizationapi.SchemeGroupVersion.WithResource("subjectaccessreviews"), sar), &authorizationapi.SubjectAccessReview{})
|
||||
return obj.(*authorizationapi.SubjectAccessReview), err
|
||||
}
|
||||
|
@@ -18,12 +18,12 @@ package fake
|
||||
|
||||
import (
|
||||
certificates "k8s.io/client-go/pkg/apis/certificates/v1beta1"
|
||||
"k8s.io/client-go/testing"
|
||||
core "k8s.io/client-go/testing"
|
||||
)
|
||||
|
||||
func (c *FakeCertificateSigningRequests) UpdateApproval(certificateSigningRequest *certificates.CertificateSigningRequest) (result *certificates.CertificateSigningRequest, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewRootUpdateSubresourceAction(certificatesigningrequestsResource, "approval", certificateSigningRequest), &certificates.CertificateSigningRequest{})
|
||||
Invokes(core.NewRootUpdateSubresourceAction(certificatesigningrequestsResource, "approval", certificateSigningRequest), &certificates.CertificateSigningRequest{})
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@@ -21,13 +21,13 @@ import (
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/client-go/pkg/api"
|
||||
"k8s.io/client-go/pkg/api/v1"
|
||||
"k8s.io/client-go/testing"
|
||||
core "k8s.io/client-go/testing"
|
||||
)
|
||||
|
||||
func (c *FakeEvents) CreateWithEventNamespace(event *v1.Event) (*v1.Event, error) {
|
||||
action := testing.NewRootCreateAction(eventsResource, event)
|
||||
action := core.NewRootCreateAction(eventsResource, event)
|
||||
if c.ns != "" {
|
||||
action = testing.NewCreateAction(eventsResource, c.ns, event)
|
||||
action = core.NewCreateAction(eventsResource, c.ns, event)
|
||||
}
|
||||
obj, err := c.Fake.Invokes(action, event)
|
||||
if obj == nil {
|
||||
@@ -39,9 +39,9 @@ func (c *FakeEvents) CreateWithEventNamespace(event *v1.Event) (*v1.Event, error
|
||||
|
||||
// Update replaces an existing event. Returns the copy of the event the server returns, or an error.
|
||||
func (c *FakeEvents) UpdateWithEventNamespace(event *v1.Event) (*v1.Event, error) {
|
||||
action := testing.NewRootUpdateAction(eventsResource, event)
|
||||
action := core.NewRootUpdateAction(eventsResource, event)
|
||||
if c.ns != "" {
|
||||
action = testing.NewUpdateAction(eventsResource, c.ns, event)
|
||||
action = core.NewUpdateAction(eventsResource, c.ns, event)
|
||||
}
|
||||
obj, err := c.Fake.Invokes(action, event)
|
||||
if obj == nil {
|
||||
@@ -53,9 +53,9 @@ func (c *FakeEvents) UpdateWithEventNamespace(event *v1.Event) (*v1.Event, error
|
||||
|
||||
// PatchWithEventNamespace patches an existing event. Returns the copy of the event the server returns, or an error.
|
||||
func (c *FakeEvents) PatchWithEventNamespace(event *v1.Event, data []byte) (*v1.Event, error) {
|
||||
action := testing.NewRootPatchAction(eventsResource, event.Name, data)
|
||||
action := core.NewRootPatchAction(eventsResource, event.Name, data)
|
||||
if c.ns != "" {
|
||||
action = testing.NewPatchAction(eventsResource, c.ns, event.Name, data)
|
||||
action = core.NewPatchAction(eventsResource, c.ns, event.Name, data)
|
||||
}
|
||||
obj, err := c.Fake.Invokes(action, event)
|
||||
if obj == nil {
|
||||
@@ -67,9 +67,9 @@ func (c *FakeEvents) PatchWithEventNamespace(event *v1.Event, data []byte) (*v1.
|
||||
|
||||
// Search returns a list of events matching the specified object.
|
||||
func (c *FakeEvents) Search(objOrRef runtime.Object) (*v1.EventList, error) {
|
||||
action := testing.NewRootListAction(eventsResource, api.ListOptions{})
|
||||
action := core.NewRootListAction(eventsResource, api.ListOptions{})
|
||||
if c.ns != "" {
|
||||
action = testing.NewListAction(eventsResource, c.ns, api.ListOptions{})
|
||||
action = core.NewListAction(eventsResource, c.ns, api.ListOptions{})
|
||||
}
|
||||
obj, err := c.Fake.Invokes(action, &v1.EventList{})
|
||||
if obj == nil {
|
||||
@@ -80,7 +80,7 @@ func (c *FakeEvents) Search(objOrRef runtime.Object) (*v1.EventList, error) {
|
||||
}
|
||||
|
||||
func (c *FakeEvents) GetFieldSelector(involvedObjectName, involvedObjectNamespace, involvedObjectKind, involvedObjectUID *string) fields.Selector {
|
||||
action := testing.GenericActionImpl{}
|
||||
action := core.GenericActionImpl{}
|
||||
action.Verb = "get-field-selector"
|
||||
action.Resource = eventsResource
|
||||
|
||||
|
@@ -18,11 +18,11 @@ package fake
|
||||
|
||||
import (
|
||||
"k8s.io/client-go/pkg/api/v1"
|
||||
"k8s.io/client-go/testing"
|
||||
core "k8s.io/client-go/testing"
|
||||
)
|
||||
|
||||
func (c *FakeNamespaces) Finalize(namespace *v1.Namespace) (*v1.Namespace, error) {
|
||||
action := testing.CreateActionImpl{}
|
||||
action := core.CreateActionImpl{}
|
||||
action.Verb = "create"
|
||||
action.Resource = namespacesResource
|
||||
action.Subresource = "finalize"
|
||||
|
@@ -18,12 +18,12 @@ package fake
|
||||
|
||||
import (
|
||||
"k8s.io/client-go/pkg/api/v1"
|
||||
"k8s.io/client-go/testing"
|
||||
core "k8s.io/client-go/testing"
|
||||
)
|
||||
|
||||
func (c *FakeNodes) PatchStatus(nodeName string, data []byte) (*v1.Node, error) {
|
||||
obj, err := c.Fake.Invokes(
|
||||
testing.NewRootPatchSubresourceAction(nodesResource, nodeName, data, "status"), &v1.Node{})
|
||||
core.NewRootPatchSubresourceAction(nodesResource, nodeName, data, "status"), &v1.Node{})
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@@ -20,11 +20,11 @@ import (
|
||||
"k8s.io/client-go/pkg/api/v1"
|
||||
policy "k8s.io/client-go/pkg/apis/policy/v1beta1"
|
||||
restclient "k8s.io/client-go/rest"
|
||||
"k8s.io/client-go/testing"
|
||||
core "k8s.io/client-go/testing"
|
||||
)
|
||||
|
||||
func (c *FakePods) Bind(binding *v1.Binding) error {
|
||||
action := testing.CreateActionImpl{}
|
||||
action := core.CreateActionImpl{}
|
||||
action.Verb = "create"
|
||||
action.Resource = podsResource
|
||||
action.Subresource = "bindings"
|
||||
@@ -35,7 +35,7 @@ func (c *FakePods) Bind(binding *v1.Binding) error {
|
||||
}
|
||||
|
||||
func (c *FakePods) GetLogs(name string, opts *v1.PodLogOptions) *restclient.Request {
|
||||
action := testing.GenericActionImpl{}
|
||||
action := core.GenericActionImpl{}
|
||||
action.Verb = "get"
|
||||
action.Namespace = c.ns
|
||||
action.Resource = podsResource
|
||||
@@ -47,7 +47,7 @@ func (c *FakePods) GetLogs(name string, opts *v1.PodLogOptions) *restclient.Requ
|
||||
}
|
||||
|
||||
func (c *FakePods) Evict(eviction *policy.Eviction) error {
|
||||
action := testing.CreateActionImpl{}
|
||||
action := core.CreateActionImpl{}
|
||||
action.Verb = "create"
|
||||
action.Resource = podsResource
|
||||
action.Subresource = "eviction"
|
||||
|
@@ -18,9 +18,9 @@ package fake
|
||||
|
||||
import (
|
||||
restclient "k8s.io/client-go/rest"
|
||||
"k8s.io/client-go/testing"
|
||||
core "k8s.io/client-go/testing"
|
||||
)
|
||||
|
||||
func (c *FakeServices) ProxyGet(scheme, name, port, path string, params map[string]string) restclient.ResponseWrapper {
|
||||
return c.Fake.InvokesProxy(testing.NewProxyGetAction(servicesResource, c.ns, scheme, name, port, path, params))
|
||||
return c.Fake.InvokesProxy(core.NewProxyGetAction(servicesResource, c.ns, scheme, name, port, path, params))
|
||||
}
|
||||
|
@@ -18,11 +18,11 @@ package fake
|
||||
|
||||
import (
|
||||
"k8s.io/client-go/pkg/apis/extensions/v1beta1"
|
||||
"k8s.io/client-go/testing"
|
||||
core "k8s.io/client-go/testing"
|
||||
)
|
||||
|
||||
func (c *FakeDeployments) Rollback(deploymentRollback *v1beta1.DeploymentRollback) error {
|
||||
action := testing.CreateActionImpl{}
|
||||
action := core.CreateActionImpl{}
|
||||
action.Verb = "create"
|
||||
action.Resource = deploymentsResource
|
||||
action.Subresource = "rollback"
|
||||
|
@@ -19,11 +19,11 @@ package fake
|
||||
import (
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
"k8s.io/client-go/pkg/apis/extensions/v1beta1"
|
||||
"k8s.io/client-go/testing"
|
||||
core "k8s.io/client-go/testing"
|
||||
)
|
||||
|
||||
func (c *FakeScales) Get(kind string, name string) (result *v1beta1.Scale, err error) {
|
||||
action := testing.GetActionImpl{}
|
||||
action := core.GetActionImpl{}
|
||||
action.Verb = "get"
|
||||
action.Namespace = c.ns
|
||||
action.Resource = schema.GroupVersionResource{Resource: kind}
|
||||
@@ -35,7 +35,7 @@ func (c *FakeScales) Get(kind string, name string) (result *v1beta1.Scale, err e
|
||||
}
|
||||
|
||||
func (c *FakeScales) Update(kind string, scale *v1beta1.Scale) (result *v1beta1.Scale, err error) {
|
||||
action := testing.UpdateActionImpl{}
|
||||
action := core.UpdateActionImpl{}
|
||||
action.Verb = "update"
|
||||
action.Namespace = c.ns
|
||||
action.Resource = schema.GroupVersionResource{Resource: kind}
|
||||
|
@@ -19,11 +19,11 @@ package fake
|
||||
import (
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
policy "k8s.io/client-go/pkg/apis/policy/v1beta1"
|
||||
testing "k8s.io/client-go/testing"
|
||||
core "k8s.io/client-go/testing"
|
||||
)
|
||||
|
||||
func (c *FakeEvictions) Evict(eviction *policy.Eviction) error {
|
||||
action := testing.GetActionImpl{}
|
||||
action := core.GetActionImpl{}
|
||||
action.Verb = "post"
|
||||
action.Namespace = c.ns
|
||||
action.Resource = schema.GroupVersionResource{Group: "", Version: "", Resource: "pods"}
|
||||
|
Reference in New Issue
Block a user