mirror of
https://github.com/optim-enterprises-bv/kubernetes.git
synced 2025-12-07 16:45:35 +00:00
Update client
This commit is contained in:
@@ -54,7 +54,6 @@ import (
|
||||
fakerbacv1beta1 "k8s.io/client-go/kubernetes/typed/rbac/v1beta1/fake"
|
||||
storagev1beta1 "k8s.io/client-go/kubernetes/typed/storage/v1beta1"
|
||||
fakestoragev1beta1 "k8s.io/client-go/kubernetes/typed/storage/v1beta1/fake"
|
||||
"k8s.io/client-go/pkg/api"
|
||||
"k8s.io/client-go/testing"
|
||||
)
|
||||
|
||||
@@ -63,7 +62,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.Registry, api.Scheme, api.Codecs.UniversalDecoder())
|
||||
o := testing.NewObjectTracker(registry, scheme, codecs.UniversalDecoder())
|
||||
for _, obj := range objects {
|
||||
if err := o.Add(obj); err != nil {
|
||||
panic(err)
|
||||
@@ -71,7 +70,7 @@ func NewSimpleClientset(objects ...runtime.Object) *Clientset {
|
||||
}
|
||||
|
||||
fakePtr := testing.Fake{}
|
||||
fakePtr.AddReactor("*", "*", testing.ObjectReaction(o, api.Registry.RESTMapper()))
|
||||
fakePtr.AddReactor("*", "*", testing.ObjectReaction(o, registry.RESTMapper()))
|
||||
|
||||
fakePtr.AddWatchReactor("*", testing.DefaultWatchReactor(watch.NewFake(), nil))
|
||||
|
||||
|
||||
66
staging/src/k8s.io/client-go/kubernetes/fake/register.go
Normal file
66
staging/src/k8s.io/client-go/kubernetes/fake/register.go
Normal file
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
Copyright 2017 The Kubernetes Authors.
|
||||
|
||||
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 (
|
||||
announced "k8s.io/apimachinery/pkg/apimachinery/announced"
|
||||
registered "k8s.io/apimachinery/pkg/apimachinery/registered"
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||
schema "k8s.io/apimachinery/pkg/runtime/schema"
|
||||
serializer "k8s.io/apimachinery/pkg/runtime/serializer"
|
||||
core "k8s.io/client-go/pkg/api/install"
|
||||
apps "k8s.io/client-go/pkg/apis/apps/install"
|
||||
authentication "k8s.io/client-go/pkg/apis/authentication/install"
|
||||
authorization "k8s.io/client-go/pkg/apis/authorization/install"
|
||||
autoscaling "k8s.io/client-go/pkg/apis/autoscaling/install"
|
||||
batch "k8s.io/client-go/pkg/apis/batch/install"
|
||||
certificates "k8s.io/client-go/pkg/apis/certificates/install"
|
||||
extensions "k8s.io/client-go/pkg/apis/extensions/install"
|
||||
policy "k8s.io/client-go/pkg/apis/policy/install"
|
||||
rbac "k8s.io/client-go/pkg/apis/rbac/install"
|
||||
storage "k8s.io/client-go/pkg/apis/storage/install"
|
||||
os "os"
|
||||
)
|
||||
|
||||
var scheme = runtime.NewScheme()
|
||||
var codecs = serializer.NewCodecFactory(scheme)
|
||||
var parameterCodec = runtime.NewParameterCodec(scheme)
|
||||
|
||||
var registry = registered.NewOrDie(os.Getenv("KUBE_API_VERSIONS"))
|
||||
var groupFactoryRegistry = make(announced.APIGroupFactoryRegistry)
|
||||
|
||||
func init() {
|
||||
v1.AddToGroupVersion(scheme, schema.GroupVersion{Version: "v1"})
|
||||
Install(groupFactoryRegistry, registry, scheme)
|
||||
}
|
||||
|
||||
// Install registers the API group and adds types to a scheme
|
||||
func Install(groupFactoryRegistry announced.APIGroupFactoryRegistry, registry *registered.APIRegistrationManager, scheme *runtime.Scheme) {
|
||||
core.Install(groupFactoryRegistry, registry, scheme)
|
||||
apps.Install(groupFactoryRegistry, registry, scheme)
|
||||
authentication.Install(groupFactoryRegistry, registry, scheme)
|
||||
authorization.Install(groupFactoryRegistry, registry, scheme)
|
||||
autoscaling.Install(groupFactoryRegistry, registry, scheme)
|
||||
batch.Install(groupFactoryRegistry, registry, scheme)
|
||||
certificates.Install(groupFactoryRegistry, registry, scheme)
|
||||
extensions.Install(groupFactoryRegistry, registry, scheme)
|
||||
policy.Install(groupFactoryRegistry, registry, scheme)
|
||||
rbac.Install(groupFactoryRegistry, registry, scheme)
|
||||
storage.Install(groupFactoryRegistry, registry, scheme)
|
||||
|
||||
}
|
||||
@@ -21,7 +21,6 @@ import (
|
||||
"k8s.io/apimachinery/pkg/watch"
|
||||
"k8s.io/client-go/discovery"
|
||||
fakediscovery "k8s.io/client-go/discovery/fake"
|
||||
"k8s.io/client-go/pkg/api"
|
||||
"k8s.io/client-go/testing"
|
||||
clientset "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset"
|
||||
apiregistrationv1alpha1 "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/typed/apiregistration/v1alpha1"
|
||||
@@ -33,7 +32,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.Registry, api.Scheme, api.Codecs.UniversalDecoder())
|
||||
o := testing.NewObjectTracker(registry, scheme, codecs.UniversalDecoder())
|
||||
for _, obj := range objects {
|
||||
if err := o.Add(obj); err != nil {
|
||||
panic(err)
|
||||
@@ -41,7 +40,7 @@ func NewSimpleClientset(objects ...runtime.Object) *Clientset {
|
||||
}
|
||||
|
||||
fakePtr := testing.Fake{}
|
||||
fakePtr.AddReactor("*", "*", testing.ObjectReaction(o, api.Registry.RESTMapper()))
|
||||
fakePtr.AddReactor("*", "*", testing.ObjectReaction(o, registry.RESTMapper()))
|
||||
|
||||
fakePtr.AddWatchReactor("*", testing.DefaultWatchReactor(watch.NewFake(), nil))
|
||||
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
Copyright 2017 The Kubernetes Authors.
|
||||
|
||||
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 (
|
||||
announced "k8s.io/apimachinery/pkg/apimachinery/announced"
|
||||
registered "k8s.io/apimachinery/pkg/apimachinery/registered"
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||
schema "k8s.io/apimachinery/pkg/runtime/schema"
|
||||
serializer "k8s.io/apimachinery/pkg/runtime/serializer"
|
||||
apiregistration "k8s.io/kube-aggregator/pkg/apis/apiregistration/install"
|
||||
os "os"
|
||||
)
|
||||
|
||||
var scheme = runtime.NewScheme()
|
||||
var codecs = serializer.NewCodecFactory(scheme)
|
||||
var parameterCodec = runtime.NewParameterCodec(scheme)
|
||||
|
||||
var registry = registered.NewOrDie(os.Getenv("KUBE_API_VERSIONS"))
|
||||
var groupFactoryRegistry = make(announced.APIGroupFactoryRegistry)
|
||||
|
||||
func init() {
|
||||
v1.AddToGroupVersion(scheme, schema.GroupVersion{Version: "v1"})
|
||||
Install(groupFactoryRegistry, registry, scheme)
|
||||
}
|
||||
|
||||
// Install registers the API group and adds types to a scheme
|
||||
func Install(groupFactoryRegistry announced.APIGroupFactoryRegistry, registry *registered.APIRegistrationManager, scheme *runtime.Scheme) {
|
||||
apiregistration.Install(groupFactoryRegistry, registry, scheme)
|
||||
|
||||
}
|
||||
@@ -21,7 +21,6 @@ import (
|
||||
"k8s.io/apimachinery/pkg/watch"
|
||||
"k8s.io/client-go/discovery"
|
||||
fakediscovery "k8s.io/client-go/discovery/fake"
|
||||
"k8s.io/client-go/pkg/api"
|
||||
"k8s.io/client-go/testing"
|
||||
clientset "k8s.io/kube-aggregator/pkg/client/clientset_generated/internalclientset"
|
||||
apiregistrationinternalversion "k8s.io/kube-aggregator/pkg/client/clientset_generated/internalclientset/typed/apiregistration/internalversion"
|
||||
@@ -33,7 +32,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.Registry, api.Scheme, api.Codecs.UniversalDecoder())
|
||||
o := testing.NewObjectTracker(registry, scheme, codecs.UniversalDecoder())
|
||||
for _, obj := range objects {
|
||||
if err := o.Add(obj); err != nil {
|
||||
panic(err)
|
||||
@@ -41,7 +40,7 @@ func NewSimpleClientset(objects ...runtime.Object) *Clientset {
|
||||
}
|
||||
|
||||
fakePtr := testing.Fake{}
|
||||
fakePtr.AddReactor("*", "*", testing.ObjectReaction(o, api.Registry.RESTMapper()))
|
||||
fakePtr.AddReactor("*", "*", testing.ObjectReaction(o, registry.RESTMapper()))
|
||||
|
||||
fakePtr.AddWatchReactor("*", testing.DefaultWatchReactor(watch.NewFake(), nil))
|
||||
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
Copyright 2017 The Kubernetes Authors.
|
||||
|
||||
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 (
|
||||
announced "k8s.io/apimachinery/pkg/apimachinery/announced"
|
||||
registered "k8s.io/apimachinery/pkg/apimachinery/registered"
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||
schema "k8s.io/apimachinery/pkg/runtime/schema"
|
||||
serializer "k8s.io/apimachinery/pkg/runtime/serializer"
|
||||
apiregistration "k8s.io/kube-aggregator/pkg/apis/apiregistration/install"
|
||||
os "os"
|
||||
)
|
||||
|
||||
var scheme = runtime.NewScheme()
|
||||
var codecs = serializer.NewCodecFactory(scheme)
|
||||
var parameterCodec = runtime.NewParameterCodec(scheme)
|
||||
|
||||
var registry = registered.NewOrDie(os.Getenv("KUBE_API_VERSIONS"))
|
||||
var groupFactoryRegistry = make(announced.APIGroupFactoryRegistry)
|
||||
|
||||
func init() {
|
||||
v1.AddToGroupVersion(scheme, schema.GroupVersion{Version: "v1"})
|
||||
Install(groupFactoryRegistry, registry, scheme)
|
||||
}
|
||||
|
||||
// Install registers the API group and adds types to a scheme
|
||||
func Install(groupFactoryRegistry announced.APIGroupFactoryRegistry, registry *registered.APIRegistrationManager, scheme *runtime.Scheme) {
|
||||
apiregistration.Install(groupFactoryRegistry, registry, scheme)
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user