Skip to content

Commit 235ed24

Browse files
author
OpenShift Bot
authored
Merge pull request #11709 from ncdc/kube_1_4_cherry_picks
Merged by openshift-bot
2 parents eebbc14 + b4597a4 commit 235ed24

File tree

358 files changed

+28136
-23742
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

358 files changed

+28136
-23742
lines changed

Godeps/Godeps.json

+370-219
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
package release_v1_4
2+
3+
import (
4+
"github.com/golang/glog"
5+
v1core "github.com/openshift/origin/pkg/authorization/client/clientset_generated/release_v1_4/typed/core/v1"
6+
restclient "k8s.io/kubernetes/pkg/client/restclient"
7+
discovery "k8s.io/kubernetes/pkg/client/typed/discovery"
8+
"k8s.io/kubernetes/pkg/util/flowcontrol"
9+
)
10+
11+
type Interface interface {
12+
Discovery() discovery.DiscoveryInterface
13+
Core() v1core.CoreInterface
14+
}
15+
16+
// Clientset contains the clients for groups. Each group has exactly one
17+
// version included in a Clientset.
18+
type Clientset struct {
19+
*discovery.DiscoveryClient
20+
*v1core.CoreClient
21+
}
22+
23+
// Core retrieves the CoreClient
24+
func (c *Clientset) Core() v1core.CoreInterface {
25+
if c == nil {
26+
return nil
27+
}
28+
return c.CoreClient
29+
}
30+
31+
// Discovery retrieves the DiscoveryClient
32+
func (c *Clientset) Discovery() discovery.DiscoveryInterface {
33+
return c.DiscoveryClient
34+
}
35+
36+
// NewForConfig creates a new Clientset for the given config.
37+
func NewForConfig(c *restclient.Config) (*Clientset, error) {
38+
configShallowCopy := *c
39+
if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 {
40+
configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst)
41+
}
42+
var clientset Clientset
43+
var err error
44+
clientset.CoreClient, err = v1core.NewForConfig(&configShallowCopy)
45+
if err != nil {
46+
return nil, err
47+
}
48+
49+
clientset.DiscoveryClient, err = discovery.NewDiscoveryClientForConfig(&configShallowCopy)
50+
if err != nil {
51+
glog.Errorf("failed to create the DiscoveryClient: %v", err)
52+
return nil, err
53+
}
54+
return &clientset, nil
55+
}
56+
57+
// NewForConfigOrDie creates a new Clientset for the given config and
58+
// panics if there is an error in the config.
59+
func NewForConfigOrDie(c *restclient.Config) *Clientset {
60+
var clientset Clientset
61+
clientset.CoreClient = v1core.NewForConfigOrDie(c)
62+
63+
clientset.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c)
64+
return &clientset
65+
}
66+
67+
// New creates a new Clientset for the given RESTClient.
68+
func New(c *restclient.RESTClient) *Clientset {
69+
var clientset Clientset
70+
clientset.CoreClient = v1core.New(c)
71+
72+
clientset.DiscoveryClient = discovery.NewDiscoveryClient(c)
73+
return &clientset
74+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// This package is generated by client-gen with arguments: --clientset-api-path=/oapi --clientset-name=release_v1_4 --clientset-path=github.com/openshift/origin/pkg/authorization/client/clientset_generated --go-header-file=hack/boilerplate.txt --input=[api/v1] --input-base=github.com/openshift/origin/pkg/authorization/api --output-base=../../..
2+
3+
// This package has the automatically generated clientset.
4+
package release_v1_4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
package fake
2+
3+
import (
4+
clientset "github.com/openshift/origin/pkg/authorization/client/clientset_generated/release_v1_4"
5+
v1core "github.com/openshift/origin/pkg/authorization/client/clientset_generated/release_v1_4/typed/core/v1"
6+
fakev1core "github.com/openshift/origin/pkg/authorization/client/clientset_generated/release_v1_4/typed/core/v1/fake"
7+
"k8s.io/kubernetes/pkg/api"
8+
"k8s.io/kubernetes/pkg/apimachinery/registered"
9+
"k8s.io/kubernetes/pkg/client/testing/core"
10+
"k8s.io/kubernetes/pkg/client/typed/discovery"
11+
fakediscovery "k8s.io/kubernetes/pkg/client/typed/discovery/fake"
12+
"k8s.io/kubernetes/pkg/runtime"
13+
"k8s.io/kubernetes/pkg/watch"
14+
)
15+
16+
// NewSimpleClientset returns a clientset that will respond with the provided objects.
17+
// It's backed by a very simple object tracker that processes creates, updates and deletions as-is,
18+
// without applying any validations and/or defaults. It shouldn't be considered a replacement
19+
// for a real clientset and is mostly useful in simple unit tests.
20+
func NewSimpleClientset(objects ...runtime.Object) *Clientset {
21+
o := core.NewObjectTracker(api.Scheme, api.Codecs.UniversalDecoder())
22+
for _, obj := range objects {
23+
if err := o.Add(obj); err != nil {
24+
panic(err)
25+
}
26+
}
27+
28+
fakePtr := core.Fake{}
29+
fakePtr.AddReactor("*", "*", core.ObjectReaction(o, registered.RESTMapper()))
30+
31+
fakePtr.AddWatchReactor("*", core.DefaultWatchReactor(watch.NewFake(), nil))
32+
33+
return &Clientset{fakePtr}
34+
}
35+
36+
// Clientset implements clientset.Interface. Meant to be embedded into a
37+
// struct to get a default implementation. This makes faking out just the method
38+
// you want to test easier.
39+
type Clientset struct {
40+
core.Fake
41+
}
42+
43+
func (c *Clientset) Discovery() discovery.DiscoveryInterface {
44+
return &fakediscovery.FakeDiscovery{Fake: &c.Fake}
45+
}
46+
47+
var _ clientset.Interface = &Clientset{}
48+
49+
// Core retrieves the CoreClient
50+
func (c *Clientset) Core() v1core.CoreInterface {
51+
return &fakev1core.FakeCore{Fake: &c.Fake}
52+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// This package is generated by client-gen with arguments: --clientset-api-path=/oapi --clientset-name=release_v1_4 --clientset-path=github.com/openshift/origin/pkg/authorization/client/clientset_generated --go-header-file=hack/boilerplate.txt --input=[api/v1] --input-base=github.com/openshift/origin/pkg/authorization/api --output-base=../../..
2+
3+
// This package has the automatically generated fake clientset.
4+
package fake
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
package v1
2+
3+
import (
4+
api "k8s.io/kubernetes/pkg/api"
5+
registered "k8s.io/kubernetes/pkg/apimachinery/registered"
6+
restclient "k8s.io/kubernetes/pkg/client/restclient"
7+
serializer "k8s.io/kubernetes/pkg/runtime/serializer"
8+
)
9+
10+
type CoreInterface interface {
11+
GetRESTClient() *restclient.RESTClient
12+
PoliciesGetter
13+
}
14+
15+
// CoreClient is used to interact with features provided by the Core group.
16+
type CoreClient struct {
17+
*restclient.RESTClient
18+
}
19+
20+
func (c *CoreClient) Policies(namespace string) PolicyInterface {
21+
return newPolicies(c, namespace)
22+
}
23+
24+
// NewForConfig creates a new CoreClient for the given config.
25+
func NewForConfig(c *restclient.Config) (*CoreClient, error) {
26+
config := *c
27+
if err := setConfigDefaults(&config); err != nil {
28+
return nil, err
29+
}
30+
client, err := restclient.RESTClientFor(&config)
31+
if err != nil {
32+
return nil, err
33+
}
34+
return &CoreClient{client}, nil
35+
}
36+
37+
// NewForConfigOrDie creates a new CoreClient for the given config and
38+
// panics if there is an error in the config.
39+
func NewForConfigOrDie(c *restclient.Config) *CoreClient {
40+
client, err := NewForConfig(c)
41+
if err != nil {
42+
panic(err)
43+
}
44+
return client
45+
}
46+
47+
// New creates a new CoreClient for the given RESTClient.
48+
func New(c *restclient.RESTClient) *CoreClient {
49+
return &CoreClient{c}
50+
}
51+
52+
func setConfigDefaults(config *restclient.Config) error {
53+
// if core group is not registered, return an error
54+
g, err := registered.Group("")
55+
if err != nil {
56+
return err
57+
}
58+
config.APIPath = "/oapi"
59+
if config.UserAgent == "" {
60+
config.UserAgent = restclient.DefaultKubernetesUserAgent()
61+
}
62+
// TODO: Unconditionally set the config.Version, until we fix the config.
63+
//if config.Version == "" {
64+
copyGroupVersion := g.GroupVersion
65+
config.GroupVersion = &copyGroupVersion
66+
//}
67+
68+
config.NegotiatedSerializer = serializer.DirectCodecFactory{CodecFactory: api.Codecs}
69+
70+
return nil
71+
}
72+
73+
// GetRESTClient returns a RESTClient that is used to communicate
74+
// with API server by this client implementation.
75+
func (c *CoreClient) GetRESTClient() *restclient.RESTClient {
76+
if c == nil {
77+
return nil
78+
}
79+
return c.RESTClient
80+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// This package is generated by client-gen with arguments: --clientset-api-path=/oapi --clientset-name=release_v1_4 --clientset-path=github.com/openshift/origin/pkg/authorization/client/clientset_generated --go-header-file=hack/boilerplate.txt --input=[api/v1] --input-base=github.com/openshift/origin/pkg/authorization/api --output-base=../../..
2+
3+
// This package has the automatically generated typed clients.
4+
package v1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// This package is generated by client-gen with arguments: --clientset-api-path=/oapi --clientset-name=release_v1_4 --clientset-path=github.com/openshift/origin/pkg/authorization/client/clientset_generated --go-header-file=hack/boilerplate.txt --input=[api/v1] --input-base=github.com/openshift/origin/pkg/authorization/api --output-base=../../..
2+
3+
// Package fake has the automatically generated clients.
4+
package fake
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package fake
2+
3+
import (
4+
v1 "github.com/openshift/origin/pkg/authorization/client/clientset_generated/release_v1_4/typed/core/v1"
5+
restclient "k8s.io/kubernetes/pkg/client/restclient"
6+
core "k8s.io/kubernetes/pkg/client/testing/core"
7+
)
8+
9+
type FakeCore struct {
10+
*core.Fake
11+
}
12+
13+
func (c *FakeCore) Policies(namespace string) v1.PolicyInterface {
14+
return &FakePolicies{c, namespace}
15+
}
16+
17+
// GetRESTClient returns a RESTClient that is used to communicate
18+
// with API server by this client implementation.
19+
func (c *FakeCore) GetRESTClient() *restclient.RESTClient {
20+
return nil
21+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
package fake
2+
3+
import (
4+
v1 "github.com/openshift/origin/pkg/authorization/api/v1"
5+
api "k8s.io/kubernetes/pkg/api"
6+
unversioned "k8s.io/kubernetes/pkg/api/unversioned"
7+
core "k8s.io/kubernetes/pkg/client/testing/core"
8+
labels "k8s.io/kubernetes/pkg/labels"
9+
watch "k8s.io/kubernetes/pkg/watch"
10+
)
11+
12+
// FakePolicies implements PolicyInterface
13+
type FakePolicies struct {
14+
Fake *FakeCore
15+
ns string
16+
}
17+
18+
var policiesResource = unversioned.GroupVersionResource{Group: "", Version: "v1", Resource: "policies"}
19+
20+
func (c *FakePolicies) Create(policy *v1.Policy) (result *v1.Policy, err error) {
21+
obj, err := c.Fake.
22+
Invokes(core.NewCreateAction(policiesResource, c.ns, policy), &v1.Policy{})
23+
24+
if obj == nil {
25+
return nil, err
26+
}
27+
return obj.(*v1.Policy), err
28+
}
29+
30+
func (c *FakePolicies) Update(policy *v1.Policy) (result *v1.Policy, err error) {
31+
obj, err := c.Fake.
32+
Invokes(core.NewUpdateAction(policiesResource, c.ns, policy), &v1.Policy{})
33+
34+
if obj == nil {
35+
return nil, err
36+
}
37+
return obj.(*v1.Policy), err
38+
}
39+
40+
func (c *FakePolicies) Delete(name string, options *api.DeleteOptions) error {
41+
_, err := c.Fake.
42+
Invokes(core.NewDeleteAction(policiesResource, c.ns, name), &v1.Policy{})
43+
44+
return err
45+
}
46+
47+
func (c *FakePolicies) DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error {
48+
action := core.NewDeleteCollectionAction(policiesResource, c.ns, listOptions)
49+
50+
_, err := c.Fake.Invokes(action, &v1.PolicyList{})
51+
return err
52+
}
53+
54+
func (c *FakePolicies) Get(name string) (result *v1.Policy, err error) {
55+
obj, err := c.Fake.
56+
Invokes(core.NewGetAction(policiesResource, c.ns, name), &v1.Policy{})
57+
58+
if obj == nil {
59+
return nil, err
60+
}
61+
return obj.(*v1.Policy), err
62+
}
63+
64+
func (c *FakePolicies) List(opts api.ListOptions) (result *v1.PolicyList, err error) {
65+
obj, err := c.Fake.
66+
Invokes(core.NewListAction(policiesResource, c.ns, opts), &v1.PolicyList{})
67+
68+
if obj == nil {
69+
return nil, err
70+
}
71+
72+
label := opts.LabelSelector
73+
if label == nil {
74+
label = labels.Everything()
75+
}
76+
list := &v1.PolicyList{}
77+
for _, item := range obj.(*v1.PolicyList).Items {
78+
if label.Matches(labels.Set(item.Labels)) {
79+
list.Items = append(list.Items, item)
80+
}
81+
}
82+
return list, err
83+
}
84+
85+
// Watch returns a watch.Interface that watches the requested policies.
86+
func (c *FakePolicies) Watch(opts api.ListOptions) (watch.Interface, error) {
87+
return c.Fake.
88+
InvokesWatch(core.NewWatchAction(policiesResource, c.ns, opts))
89+
90+
}
91+
92+
// Patch applies the patch and returns the patched policy.
93+
func (c *FakePolicies) Patch(name string, pt api.PatchType, data []byte, subresources ...string) (result *v1.Policy, err error) {
94+
obj, err := c.Fake.
95+
Invokes(core.NewPatchSubresourceAction(policiesResource, c.ns, name, data, subresources...), &v1.Policy{})
96+
97+
if obj == nil {
98+
return nil, err
99+
}
100+
return obj.(*v1.Policy), err
101+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
package v1
2+
3+
type PolicyExpansion interface{}

0 commit comments

Comments
 (0)