mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-28 05:57:25 +00:00
Merge pull request #24117 from XiaoningDing/federation-client
Automatic merge from submit-queue Federation client for cluster generate v1alpha1 and unversioned client for federation/clusters #23653, requires #23847, #23998 @nikhiljindal @quinton-hoole @caesarxuchao
This commit is contained in:
commit
8fba6de835
@ -28,32 +28,45 @@ import (
|
|||||||
|
|
||||||
"github.com/golang/glog"
|
"github.com/golang/glog"
|
||||||
flag "github.com/spf13/pflag"
|
flag "github.com/spf13/pflag"
|
||||||
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
test = flag.BoolP("test", "t", false, "set this flag to generate the client code for the testdata")
|
test = flag.BoolP("test", "t", false, "set this flag to generate the client code for the testdata")
|
||||||
inputVersions = flag.StringSlice("input", []string{"api/", "extensions/", "batch/"}, "group/versions that client-gen will generate clients for. At most one version per group is allowed. Specified in the format \"group1/version1,group2/version2...\". Default to \"api/,extensions/,batch/\"")
|
inputVersions = flag.StringSlice("input", []string{"api/", "extensions/", "batch/"}, "group/versions that client-gen will generate clients for. At most one version per group is allowed. Specified in the format \"group1/version1,group2/version2...\". Default to \"api/,extensions/,batch/\"")
|
||||||
|
basePath = flag.String("input-base", "k8s.io/kubernetes/pkg/apis", "base path to look for the api group. Default to \"k8s.io/kubernetes/pkg/apis\"")
|
||||||
clientsetName = flag.StringP("clientset-name", "n", "internalclientset", "the name of the generated clientset package.")
|
clientsetName = flag.StringP("clientset-name", "n", "internalclientset", "the name of the generated clientset package.")
|
||||||
clientsetPath = flag.String("clientset-path", "k8s.io/kubernetes/pkg/client/clientset_generated/", "the generated clientset will be output to <clientset-path>/<clientset-name>. Default to \"k8s.io/kubernetes/pkg/client/clientset_generated/\"")
|
clientsetPath = flag.String("clientset-path", "k8s.io/kubernetes/pkg/client/clientset_generated/", "the generated clientset will be output to <clientset-path>/<clientset-name>. Default to \"k8s.io/kubernetes/pkg/client/clientset_generated/\"")
|
||||||
clientsetOnly = flag.Bool("clientset-only", false, "when set, client-gen only generates the clientset shell, without generating the individual typed clients")
|
clientsetOnly = flag.Bool("clientset-only", false, "when set, client-gen only generates the clientset shell, without generating the individual typed clients")
|
||||||
fakeClient = flag.Bool("fake-clientset", true, "when set, client-gen will generate the fake clientset that can be used in tests")
|
fakeClient = flag.Bool("fake-clientset", true, "when set, client-gen will generate the fake clientset that can be used in tests")
|
||||||
)
|
)
|
||||||
|
|
||||||
func versionToPath(group string, version string) (path string) {
|
func versionToPath(gvPath string, group string, version string) (path string) {
|
||||||
const base = "k8s.io/kubernetes/pkg"
|
|
||||||
// special case for the core group
|
// special case for the core group
|
||||||
if group == "api" {
|
if group == "api" {
|
||||||
path = filepath.Join(base, "api", version)
|
path = filepath.Join(*basePath, "../api", version)
|
||||||
} else {
|
} else {
|
||||||
path = filepath.Join(base, "apis", group, version)
|
path = filepath.Join(*basePath, gvPath, group, version)
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func parsePathGroupVersion(pgvString string) (gvPath string, gvString string) {
|
||||||
|
subs := strings.Split(pgvString, "/")
|
||||||
|
length := len(subs)
|
||||||
|
switch length {
|
||||||
|
case 0, 1, 2:
|
||||||
|
return "", pgvString
|
||||||
|
default:
|
||||||
|
return strings.Join(subs[:length-2], "/"), strings.Join(subs[length-2:], "/")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func parseInputVersions() (paths []string, groupVersions []unversioned.GroupVersion, gvToPath map[unversioned.GroupVersion]string, err error) {
|
func parseInputVersions() (paths []string, groupVersions []unversioned.GroupVersion, gvToPath map[unversioned.GroupVersion]string, err error) {
|
||||||
var visitedGroups = make(map[string]struct{})
|
var visitedGroups = make(map[string]struct{})
|
||||||
gvToPath = make(map[unversioned.GroupVersion]string)
|
gvToPath = make(map[unversioned.GroupVersion]string)
|
||||||
for _, gvString := range *inputVersions {
|
for _, input := range *inputVersions {
|
||||||
|
gvPath, gvString := parsePathGroupVersion(input)
|
||||||
gv, err := unversioned.ParseGroupVersion(gvString)
|
gv, err := unversioned.ParseGroupVersion(gvString)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, nil, err
|
return nil, nil, nil, err
|
||||||
@ -64,7 +77,7 @@ func parseInputVersions() (paths []string, groupVersions []unversioned.GroupVers
|
|||||||
}
|
}
|
||||||
visitedGroups[gv.Group] = struct{}{}
|
visitedGroups[gv.Group] = struct{}{}
|
||||||
groupVersions = append(groupVersions, gv)
|
groupVersions = append(groupVersions, gv)
|
||||||
path := versionToPath(gv.Group, gv.Version)
|
path := versionToPath(gvPath, gv.Group, gv.Version)
|
||||||
paths = append(paths, path)
|
paths = append(paths, path)
|
||||||
gvToPath[gv] = path
|
gvToPath[gv] = path
|
||||||
}
|
}
|
||||||
@ -122,6 +135,8 @@ func main() {
|
|||||||
FakeClient: *fakeClient,
|
FakeClient: *fakeClient,
|
||||||
CmdArgs: cmdArgs,
|
CmdArgs: cmdArgs,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fmt.Printf("==arguments: %v\n", arguments)
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := arguments.Execute(
|
if err := arguments.Execute(
|
||||||
|
@ -77,6 +77,8 @@ type ClusterStatus struct {
|
|||||||
ClusterMeta `json:",inline"`
|
ClusterMeta `json:",inline"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// +genclient=true,nonNamespaced=true
|
||||||
|
|
||||||
// Information about a registered cluster in a federated kubernetes setup. Clusters are not namespaced and have unique names in the federation.
|
// Information about a registered cluster in a federated kubernetes setup. Clusters are not namespaced and have unique names in the federation.
|
||||||
type Cluster struct {
|
type Cluster struct {
|
||||||
unversioned.TypeMeta `json:",inline"`
|
unversioned.TypeMeta `json:",inline"`
|
||||||
|
@ -77,6 +77,8 @@ type ClusterStatus struct {
|
|||||||
ClusterMeta `json:",inline" protobuf:"bytes,4,opt,name=clusterMeta"`
|
ClusterMeta `json:",inline" protobuf:"bytes,4,opt,name=clusterMeta"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// +genclient=true,nonNamespaced=true
|
||||||
|
|
||||||
// Information about a registered cluster in a federated kubernetes setup. Clusters are not namespaced and have unique names in the federation.
|
// Information about a registered cluster in a federated kubernetes setup. Clusters are not namespaced and have unique names in the federation.
|
||||||
type Cluster struct {
|
type Cluster struct {
|
||||||
unversioned.TypeMeta `json:",inline"`
|
unversioned.TypeMeta `json:",inline"`
|
||||||
|
@ -0,0 +1,86 @@
|
|||||||
|
/*
|
||||||
|
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 federation_internalclientset
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/golang/glog"
|
||||||
|
unversionedfederation "k8s.io/kubernetes/federation/client/clientset_generated/federation_internalclientset/typed/federation/unversioned"
|
||||||
|
restclient "k8s.io/kubernetes/pkg/client/restclient"
|
||||||
|
discovery "k8s.io/kubernetes/pkg/client/typed/discovery"
|
||||||
|
"k8s.io/kubernetes/pkg/util/flowcontrol"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Interface interface {
|
||||||
|
Discovery() discovery.DiscoveryInterface
|
||||||
|
Federation() unversionedfederation.FederationInterface
|
||||||
|
}
|
||||||
|
|
||||||
|
// Clientset contains the clients for groups. Each group has exactly one
|
||||||
|
// version included in a Clientset.
|
||||||
|
type Clientset struct {
|
||||||
|
*discovery.DiscoveryClient
|
||||||
|
*unversionedfederation.FederationClient
|
||||||
|
}
|
||||||
|
|
||||||
|
// Federation retrieves the FederationClient
|
||||||
|
func (c *Clientset) Federation() unversionedfederation.FederationInterface {
|
||||||
|
return c.FederationClient
|
||||||
|
}
|
||||||
|
|
||||||
|
// Discovery retrieves the DiscoveryClient
|
||||||
|
func (c *Clientset) Discovery() discovery.DiscoveryInterface {
|
||||||
|
return c.DiscoveryClient
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewForConfig creates a new Clientset for the given config.
|
||||||
|
func NewForConfig(c *restclient.Config) (*Clientset, error) {
|
||||||
|
configShallowCopy := *c
|
||||||
|
if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 {
|
||||||
|
configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst)
|
||||||
|
}
|
||||||
|
var clientset Clientset
|
||||||
|
var err error
|
||||||
|
clientset.FederationClient, err = unversionedfederation.NewForConfig(&configShallowCopy)
|
||||||
|
if err != nil {
|
||||||
|
return &clientset, err
|
||||||
|
}
|
||||||
|
|
||||||
|
clientset.DiscoveryClient, err = discovery.NewDiscoveryClientForConfig(&configShallowCopy)
|
||||||
|
if err != nil {
|
||||||
|
glog.Errorf("failed to create the DiscoveryClient: %v", err)
|
||||||
|
}
|
||||||
|
return &clientset, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewForConfigOrDie creates a new Clientset for the given config and
|
||||||
|
// panics if there is an error in the config.
|
||||||
|
func NewForConfigOrDie(c *restclient.Config) *Clientset {
|
||||||
|
var clientset Clientset
|
||||||
|
clientset.FederationClient = unversionedfederation.NewForConfigOrDie(c)
|
||||||
|
|
||||||
|
clientset.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c)
|
||||||
|
return &clientset
|
||||||
|
}
|
||||||
|
|
||||||
|
// New creates a new Clientset for the given RESTClient.
|
||||||
|
func New(c *restclient.RESTClient) *Clientset {
|
||||||
|
var clientset Clientset
|
||||||
|
clientset.FederationClient = unversionedfederation.New(c)
|
||||||
|
|
||||||
|
clientset.DiscoveryClient = discovery.NewDiscoveryClient(c)
|
||||||
|
return &clientset
|
||||||
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
/*
|
||||||
|
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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// This package is generated by client-gen with arguments: --clientset-name=federation_internalclientset --clientset-path=k8s.io/kubernetes/federation/client/clientset_generated --input=[federation/] --input-base=k8s.io/kubernetes/federation/apis
|
||||||
|
|
||||||
|
// This package has the automatically generated clientset.
|
||||||
|
package federation_internalclientset
|
@ -0,0 +1,65 @@
|
|||||||
|
/*
|
||||||
|
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 (
|
||||||
|
clientset "k8s.io/kubernetes/federation/client/clientset_generated/federation_internalclientset"
|
||||||
|
unversionedfederation "k8s.io/kubernetes/federation/client/clientset_generated/federation_internalclientset/typed/federation/unversioned"
|
||||||
|
fakeunversionedfederation "k8s.io/kubernetes/federation/client/clientset_generated/federation_internalclientset/typed/federation/unversioned/fake"
|
||||||
|
"k8s.io/kubernetes/pkg/api"
|
||||||
|
"k8s.io/kubernetes/pkg/apimachinery/registered"
|
||||||
|
"k8s.io/kubernetes/pkg/client/testing/core"
|
||||||
|
"k8s.io/kubernetes/pkg/client/typed/discovery"
|
||||||
|
fakediscovery "k8s.io/kubernetes/pkg/client/typed/discovery/fake"
|
||||||
|
"k8s.io/kubernetes/pkg/runtime"
|
||||||
|
"k8s.io/kubernetes/pkg/watch"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Clientset returns a clientset that will respond with the provided objects
|
||||||
|
func NewSimpleClientset(objects ...runtime.Object) *Clientset {
|
||||||
|
o := core.NewObjects(api.Scheme, api.Codecs.UniversalDecoder())
|
||||||
|
for _, obj := range objects {
|
||||||
|
if err := o.Add(obj); err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fakePtr := core.Fake{}
|
||||||
|
fakePtr.AddReactor("*", "*", core.ObjectReaction(o, registered.RESTMapper()))
|
||||||
|
|
||||||
|
fakePtr.AddWatchReactor("*", core.DefaultWatchReactor(watch.NewFake(), nil))
|
||||||
|
|
||||||
|
return &Clientset{fakePtr}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Clientset implements clientset.Interface. Meant to be embedded into a
|
||||||
|
// struct to get a default implementation. This makes faking out just the method
|
||||||
|
// you want to test easier.
|
||||||
|
type Clientset struct {
|
||||||
|
core.Fake
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Clientset) Discovery() discovery.DiscoveryInterface {
|
||||||
|
return &fakediscovery.FakeDiscovery{Fake: &c.Fake}
|
||||||
|
}
|
||||||
|
|
||||||
|
var _ clientset.Interface = &Clientset{}
|
||||||
|
|
||||||
|
// Federation retrieves the FederationClient
|
||||||
|
func (c *Clientset) Federation() unversionedfederation.FederationInterface {
|
||||||
|
return &fakeunversionedfederation.FakeFederation{Fake: &c.Fake}
|
||||||
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
/*
|
||||||
|
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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// This package is generated by client-gen with arguments: --clientset-name=federation_internalclientset --clientset-path=k8s.io/kubernetes/federation/client/clientset_generated --input=[federation/] --input-base=k8s.io/kubernetes/federation/apis
|
||||||
|
|
||||||
|
// This package has the automatically generated fake clientset.
|
||||||
|
package fake
|
@ -0,0 +1,25 @@
|
|||||||
|
/*
|
||||||
|
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 federation_internalclientset
|
||||||
|
|
||||||
|
// These imports are the API groups the client will support.
|
||||||
|
import (
|
||||||
|
_ "k8s.io/kubernetes/federation/apis/federation/install"
|
||||||
|
)
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
}
|
@ -0,0 +1,140 @@
|
|||||||
|
/*
|
||||||
|
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 (
|
||||||
|
federation "k8s.io/kubernetes/federation/apis/federation"
|
||||||
|
api "k8s.io/kubernetes/pkg/api"
|
||||||
|
watch "k8s.io/kubernetes/pkg/watch"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ClustersGetter has a method to return a ClusterInterface.
|
||||||
|
// A group's client should implement this interface.
|
||||||
|
type ClustersGetter interface {
|
||||||
|
Clusters() ClusterInterface
|
||||||
|
}
|
||||||
|
|
||||||
|
// ClusterInterface has methods to work with Cluster resources.
|
||||||
|
type ClusterInterface interface {
|
||||||
|
Create(*federation.Cluster) (*federation.Cluster, error)
|
||||||
|
Update(*federation.Cluster) (*federation.Cluster, error)
|
||||||
|
UpdateStatus(*federation.Cluster) (*federation.Cluster, error)
|
||||||
|
Delete(name string, options *api.DeleteOptions) error
|
||||||
|
DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error
|
||||||
|
Get(name string) (*federation.Cluster, error)
|
||||||
|
List(opts api.ListOptions) (*federation.ClusterList, error)
|
||||||
|
Watch(opts api.ListOptions) (watch.Interface, error)
|
||||||
|
ClusterExpansion
|
||||||
|
}
|
||||||
|
|
||||||
|
// clusters implements ClusterInterface
|
||||||
|
type clusters struct {
|
||||||
|
client *FederationClient
|
||||||
|
}
|
||||||
|
|
||||||
|
// newClusters returns a Clusters
|
||||||
|
func newClusters(c *FederationClient) *clusters {
|
||||||
|
return &clusters{
|
||||||
|
client: c,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create takes the representation of a cluster and creates it. Returns the server's representation of the cluster, and an error, if there is any.
|
||||||
|
func (c *clusters) Create(cluster *federation.Cluster) (result *federation.Cluster, err error) {
|
||||||
|
result = &federation.Cluster{}
|
||||||
|
err = c.client.Post().
|
||||||
|
Resource("clusters").
|
||||||
|
Body(cluster).
|
||||||
|
Do().
|
||||||
|
Into(result)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update takes the representation of a cluster and updates it. Returns the server's representation of the cluster, and an error, if there is any.
|
||||||
|
func (c *clusters) Update(cluster *federation.Cluster) (result *federation.Cluster, err error) {
|
||||||
|
result = &federation.Cluster{}
|
||||||
|
err = c.client.Put().
|
||||||
|
Resource("clusters").
|
||||||
|
Name(cluster.Name).
|
||||||
|
Body(cluster).
|
||||||
|
Do().
|
||||||
|
Into(result)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *clusters) UpdateStatus(cluster *federation.Cluster) (result *federation.Cluster, err error) {
|
||||||
|
result = &federation.Cluster{}
|
||||||
|
err = c.client.Put().
|
||||||
|
Resource("clusters").
|
||||||
|
Name(cluster.Name).
|
||||||
|
SubResource("status").
|
||||||
|
Body(cluster).
|
||||||
|
Do().
|
||||||
|
Into(result)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Delete takes name of the cluster and deletes it. Returns an error if one occurs.
|
||||||
|
func (c *clusters) Delete(name string, options *api.DeleteOptions) error {
|
||||||
|
return c.client.Delete().
|
||||||
|
Resource("clusters").
|
||||||
|
Name(name).
|
||||||
|
Body(options).
|
||||||
|
Do().
|
||||||
|
Error()
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeleteCollection deletes a collection of objects.
|
||||||
|
func (c *clusters) DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error {
|
||||||
|
return c.client.Delete().
|
||||||
|
Resource("clusters").
|
||||||
|
VersionedParams(&listOptions, api.ParameterCodec).
|
||||||
|
Body(options).
|
||||||
|
Do().
|
||||||
|
Error()
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get takes name of the cluster, and returns the corresponding cluster object, and an error if there is any.
|
||||||
|
func (c *clusters) Get(name string) (result *federation.Cluster, err error) {
|
||||||
|
result = &federation.Cluster{}
|
||||||
|
err = c.client.Get().
|
||||||
|
Resource("clusters").
|
||||||
|
Name(name).
|
||||||
|
Do().
|
||||||
|
Into(result)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// List takes label and field selectors, and returns the list of Clusters that match those selectors.
|
||||||
|
func (c *clusters) List(opts api.ListOptions) (result *federation.ClusterList, err error) {
|
||||||
|
result = &federation.ClusterList{}
|
||||||
|
err = c.client.Get().
|
||||||
|
Resource("clusters").
|
||||||
|
VersionedParams(&opts, api.ParameterCodec).
|
||||||
|
Do().
|
||||||
|
Into(result)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Watch returns a watch.Interface that watches the requested clusters.
|
||||||
|
func (c *clusters) Watch(opts api.ListOptions) (watch.Interface, error) {
|
||||||
|
return c.client.Get().
|
||||||
|
Prefix("watch").
|
||||||
|
Resource("clusters").
|
||||||
|
VersionedParams(&opts, api.ParameterCodec).
|
||||||
|
Watch()
|
||||||
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
/*
|
||||||
|
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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// This package is generated by client-gen with arguments: --clientset-name=federation_internalclientset --clientset-path=k8s.io/kubernetes/federation/client/clientset_generated --input=[federation/] --input-base=k8s.io/kubernetes/federation/apis
|
||||||
|
|
||||||
|
// This package has the automatically generated typed clients.
|
||||||
|
package unversioned
|
@ -0,0 +1,20 @@
|
|||||||
|
/*
|
||||||
|
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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// This package is generated by client-gen with arguments: --clientset-name=federation_internalclientset --clientset-path=k8s.io/kubernetes/federation/client/clientset_generated --input=[federation/] --input-base=k8s.io/kubernetes/federation/apis
|
||||||
|
|
||||||
|
// Package fake has the automatically generated clients.
|
||||||
|
package fake
|
@ -0,0 +1,108 @@
|
|||||||
|
/*
|
||||||
|
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 (
|
||||||
|
federation "k8s.io/kubernetes/federation/apis/federation"
|
||||||
|
api "k8s.io/kubernetes/pkg/api"
|
||||||
|
unversioned "k8s.io/kubernetes/pkg/api/unversioned"
|
||||||
|
core "k8s.io/kubernetes/pkg/client/testing/core"
|
||||||
|
labels "k8s.io/kubernetes/pkg/labels"
|
||||||
|
watch "k8s.io/kubernetes/pkg/watch"
|
||||||
|
)
|
||||||
|
|
||||||
|
// FakeClusters implements ClusterInterface
|
||||||
|
type FakeClusters struct {
|
||||||
|
Fake *FakeFederation
|
||||||
|
}
|
||||||
|
|
||||||
|
var clustersResource = unversioned.GroupVersionResource{Group: "federation", Version: "", Resource: "clusters"}
|
||||||
|
|
||||||
|
func (c *FakeClusters) Create(cluster *federation.Cluster) (result *federation.Cluster, err error) {
|
||||||
|
obj, err := c.Fake.
|
||||||
|
Invokes(core.NewRootCreateAction(clustersResource, cluster), &federation.Cluster{})
|
||||||
|
if obj == nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return obj.(*federation.Cluster), err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *FakeClusters) Update(cluster *federation.Cluster) (result *federation.Cluster, err error) {
|
||||||
|
obj, err := c.Fake.
|
||||||
|
Invokes(core.NewRootUpdateAction(clustersResource, cluster), &federation.Cluster{})
|
||||||
|
if obj == nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return obj.(*federation.Cluster), err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *FakeClusters) UpdateStatus(cluster *federation.Cluster) (*federation.Cluster, error) {
|
||||||
|
obj, err := c.Fake.
|
||||||
|
Invokes(core.NewRootUpdateSubresourceAction(clustersResource, "status", cluster), &federation.Cluster{})
|
||||||
|
if obj == nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return obj.(*federation.Cluster), err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *FakeClusters) Delete(name string, options *api.DeleteOptions) error {
|
||||||
|
_, err := c.Fake.
|
||||||
|
Invokes(core.NewRootDeleteAction(clustersResource, name), &federation.Cluster{})
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *FakeClusters) DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error {
|
||||||
|
action := core.NewRootDeleteCollectionAction(clustersResource, listOptions)
|
||||||
|
|
||||||
|
_, err := c.Fake.Invokes(action, &federation.ClusterList{})
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *FakeClusters) Get(name string) (result *federation.Cluster, err error) {
|
||||||
|
obj, err := c.Fake.
|
||||||
|
Invokes(core.NewRootGetAction(clustersResource, name), &federation.Cluster{})
|
||||||
|
if obj == nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return obj.(*federation.Cluster), err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *FakeClusters) List(opts api.ListOptions) (result *federation.ClusterList, err error) {
|
||||||
|
obj, err := c.Fake.
|
||||||
|
Invokes(core.NewRootListAction(clustersResource, opts), &federation.ClusterList{})
|
||||||
|
if obj == nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
label := opts.LabelSelector
|
||||||
|
if label == nil {
|
||||||
|
label = labels.Everything()
|
||||||
|
}
|
||||||
|
list := &federation.ClusterList{}
|
||||||
|
for _, item := range obj.(*federation.ClusterList).Items {
|
||||||
|
if label.Matches(labels.Set(item.Labels)) {
|
||||||
|
list.Items = append(list.Items, item)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return list, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// Watch returns a watch.Interface that watches the requested clusters.
|
||||||
|
func (c *FakeClusters) Watch(opts api.ListOptions) (watch.Interface, error) {
|
||||||
|
return c.Fake.
|
||||||
|
InvokesWatch(core.NewRootWatchAction(clustersResource, opts))
|
||||||
|
}
|
@ -0,0 +1,30 @@
|
|||||||
|
/*
|
||||||
|
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 (
|
||||||
|
unversioned "k8s.io/kubernetes/federation/client/clientset_generated/federation_internalclientset/typed/federation/unversioned"
|
||||||
|
core "k8s.io/kubernetes/pkg/client/testing/core"
|
||||||
|
)
|
||||||
|
|
||||||
|
type FakeFederation struct {
|
||||||
|
*core.Fake
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *FakeFederation) Clusters() unversioned.ClusterInterface {
|
||||||
|
return &FakeClusters{c}
|
||||||
|
}
|
@ -0,0 +1,90 @@
|
|||||||
|
/*
|
||||||
|
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 (
|
||||||
|
api "k8s.io/kubernetes/pkg/api"
|
||||||
|
registered "k8s.io/kubernetes/pkg/apimachinery/registered"
|
||||||
|
restclient "k8s.io/kubernetes/pkg/client/restclient"
|
||||||
|
)
|
||||||
|
|
||||||
|
type FederationInterface interface {
|
||||||
|
ClustersGetter
|
||||||
|
}
|
||||||
|
|
||||||
|
// FederationClient is used to interact with features provided by the Federation group.
|
||||||
|
type FederationClient struct {
|
||||||
|
*restclient.RESTClient
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *FederationClient) Clusters() ClusterInterface {
|
||||||
|
return newClusters(c)
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewForConfig creates a new FederationClient for the given config.
|
||||||
|
func NewForConfig(c *restclient.Config) (*FederationClient, error) {
|
||||||
|
config := *c
|
||||||
|
if err := setConfigDefaults(&config); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
client, err := restclient.RESTClientFor(&config)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return &FederationClient{client}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewForConfigOrDie creates a new FederationClient for the given config and
|
||||||
|
// panics if there is an error in the config.
|
||||||
|
func NewForConfigOrDie(c *restclient.Config) *FederationClient {
|
||||||
|
client, err := NewForConfig(c)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
return client
|
||||||
|
}
|
||||||
|
|
||||||
|
// New creates a new FederationClient for the given RESTClient.
|
||||||
|
func New(c *restclient.RESTClient) *FederationClient {
|
||||||
|
return &FederationClient{c}
|
||||||
|
}
|
||||||
|
|
||||||
|
func setConfigDefaults(config *restclient.Config) error {
|
||||||
|
// if federation group is not registered, return an error
|
||||||
|
g, err := registered.Group("federation")
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
config.APIPath = "/apis"
|
||||||
|
if config.UserAgent == "" {
|
||||||
|
config.UserAgent = restclient.DefaultKubernetesUserAgent()
|
||||||
|
}
|
||||||
|
// TODO: Unconditionally set the config.Version, until we fix the config.
|
||||||
|
//if config.Version == "" {
|
||||||
|
copyGroupVersion := g.GroupVersion
|
||||||
|
config.GroupVersion = ©GroupVersion
|
||||||
|
//}
|
||||||
|
|
||||||
|
config.Codec = api.Codecs.LegacyCodec(*config.GroupVersion)
|
||||||
|
if config.QPS == 0 {
|
||||||
|
config.QPS = 5
|
||||||
|
}
|
||||||
|
if config.Burst == 0 {
|
||||||
|
config.Burst = 10
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
@ -0,0 +1,19 @@
|
|||||||
|
/*
|
||||||
|
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
|
||||||
|
|
||||||
|
type ClusterExpansion interface{}
|
@ -0,0 +1,86 @@
|
|||||||
|
/*
|
||||||
|
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 federation_release_1_3
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/golang/glog"
|
||||||
|
v1alpha1federation "k8s.io/kubernetes/federation/client/clientset_generated/federation_release_1_3/typed/federation/v1alpha1"
|
||||||
|
restclient "k8s.io/kubernetes/pkg/client/restclient"
|
||||||
|
discovery "k8s.io/kubernetes/pkg/client/typed/discovery"
|
||||||
|
"k8s.io/kubernetes/pkg/util/flowcontrol"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Interface interface {
|
||||||
|
Discovery() discovery.DiscoveryInterface
|
||||||
|
Federation() v1alpha1federation.FederationInterface
|
||||||
|
}
|
||||||
|
|
||||||
|
// Clientset contains the clients for groups. Each group has exactly one
|
||||||
|
// version included in a Clientset.
|
||||||
|
type Clientset struct {
|
||||||
|
*discovery.DiscoveryClient
|
||||||
|
*v1alpha1federation.FederationClient
|
||||||
|
}
|
||||||
|
|
||||||
|
// Federation retrieves the FederationClient
|
||||||
|
func (c *Clientset) Federation() v1alpha1federation.FederationInterface {
|
||||||
|
return c.FederationClient
|
||||||
|
}
|
||||||
|
|
||||||
|
// Discovery retrieves the DiscoveryClient
|
||||||
|
func (c *Clientset) Discovery() discovery.DiscoveryInterface {
|
||||||
|
return c.DiscoveryClient
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewForConfig creates a new Clientset for the given config.
|
||||||
|
func NewForConfig(c *restclient.Config) (*Clientset, error) {
|
||||||
|
configShallowCopy := *c
|
||||||
|
if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 {
|
||||||
|
configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst)
|
||||||
|
}
|
||||||
|
var clientset Clientset
|
||||||
|
var err error
|
||||||
|
clientset.FederationClient, err = v1alpha1federation.NewForConfig(&configShallowCopy)
|
||||||
|
if err != nil {
|
||||||
|
return &clientset, err
|
||||||
|
}
|
||||||
|
|
||||||
|
clientset.DiscoveryClient, err = discovery.NewDiscoveryClientForConfig(&configShallowCopy)
|
||||||
|
if err != nil {
|
||||||
|
glog.Errorf("failed to create the DiscoveryClient: %v", err)
|
||||||
|
}
|
||||||
|
return &clientset, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewForConfigOrDie creates a new Clientset for the given config and
|
||||||
|
// panics if there is an error in the config.
|
||||||
|
func NewForConfigOrDie(c *restclient.Config) *Clientset {
|
||||||
|
var clientset Clientset
|
||||||
|
clientset.FederationClient = v1alpha1federation.NewForConfigOrDie(c)
|
||||||
|
|
||||||
|
clientset.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c)
|
||||||
|
return &clientset
|
||||||
|
}
|
||||||
|
|
||||||
|
// New creates a new Clientset for the given RESTClient.
|
||||||
|
func New(c *restclient.RESTClient) *Clientset {
|
||||||
|
var clientset Clientset
|
||||||
|
clientset.FederationClient = v1alpha1federation.New(c)
|
||||||
|
|
||||||
|
clientset.DiscoveryClient = discovery.NewDiscoveryClient(c)
|
||||||
|
return &clientset
|
||||||
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
/*
|
||||||
|
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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// This package is generated by client-gen with arguments: --clientset-name=federation_release_1_3 --clientset-path=k8s.io/kubernetes/federation/client/clientset_generated --input=[federation/v1alpha1] --input-base=k8s.io/kubernetes/federation/apis
|
||||||
|
|
||||||
|
// This package has the automatically generated clientset.
|
||||||
|
package federation_release_1_3
|
@ -0,0 +1,65 @@
|
|||||||
|
/*
|
||||||
|
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 (
|
||||||
|
clientset "k8s.io/kubernetes/federation/client/clientset_generated/federation_release_1_3"
|
||||||
|
v1alpha1federation "k8s.io/kubernetes/federation/client/clientset_generated/federation_release_1_3/typed/federation/v1alpha1"
|
||||||
|
fakev1alpha1federation "k8s.io/kubernetes/federation/client/clientset_generated/federation_release_1_3/typed/federation/v1alpha1/fake"
|
||||||
|
"k8s.io/kubernetes/pkg/api"
|
||||||
|
"k8s.io/kubernetes/pkg/apimachinery/registered"
|
||||||
|
"k8s.io/kubernetes/pkg/client/testing/core"
|
||||||
|
"k8s.io/kubernetes/pkg/client/typed/discovery"
|
||||||
|
fakediscovery "k8s.io/kubernetes/pkg/client/typed/discovery/fake"
|
||||||
|
"k8s.io/kubernetes/pkg/runtime"
|
||||||
|
"k8s.io/kubernetes/pkg/watch"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Clientset returns a clientset that will respond with the provided objects
|
||||||
|
func NewSimpleClientset(objects ...runtime.Object) *Clientset {
|
||||||
|
o := core.NewObjects(api.Scheme, api.Codecs.UniversalDecoder())
|
||||||
|
for _, obj := range objects {
|
||||||
|
if err := o.Add(obj); err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fakePtr := core.Fake{}
|
||||||
|
fakePtr.AddReactor("*", "*", core.ObjectReaction(o, registered.RESTMapper()))
|
||||||
|
|
||||||
|
fakePtr.AddWatchReactor("*", core.DefaultWatchReactor(watch.NewFake(), nil))
|
||||||
|
|
||||||
|
return &Clientset{fakePtr}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Clientset implements clientset.Interface. Meant to be embedded into a
|
||||||
|
// struct to get a default implementation. This makes faking out just the method
|
||||||
|
// you want to test easier.
|
||||||
|
type Clientset struct {
|
||||||
|
core.Fake
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Clientset) Discovery() discovery.DiscoveryInterface {
|
||||||
|
return &fakediscovery.FakeDiscovery{Fake: &c.Fake}
|
||||||
|
}
|
||||||
|
|
||||||
|
var _ clientset.Interface = &Clientset{}
|
||||||
|
|
||||||
|
// Federation retrieves the FederationClient
|
||||||
|
func (c *Clientset) Federation() v1alpha1federation.FederationInterface {
|
||||||
|
return &fakev1alpha1federation.FakeFederation{Fake: &c.Fake}
|
||||||
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
/*
|
||||||
|
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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// This package is generated by client-gen with arguments: --clientset-name=federation_release_1_3 --clientset-path=k8s.io/kubernetes/federation/client/clientset_generated --input=[federation/v1alpha1] --input-base=k8s.io/kubernetes/federation/apis
|
||||||
|
|
||||||
|
// This package has the automatically generated fake clientset.
|
||||||
|
package fake
|
@ -0,0 +1,25 @@
|
|||||||
|
/*
|
||||||
|
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 federation_release_1_3
|
||||||
|
|
||||||
|
// These imports are the API groups the client will support.
|
||||||
|
import (
|
||||||
|
_ "k8s.io/kubernetes/federation/apis/federation/install"
|
||||||
|
)
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
}
|
@ -0,0 +1,140 @@
|
|||||||
|
/*
|
||||||
|
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 v1alpha1
|
||||||
|
|
||||||
|
import (
|
||||||
|
v1alpha1 "k8s.io/kubernetes/federation/apis/federation/v1alpha1"
|
||||||
|
api "k8s.io/kubernetes/pkg/api"
|
||||||
|
watch "k8s.io/kubernetes/pkg/watch"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ClustersGetter has a method to return a ClusterInterface.
|
||||||
|
// A group's client should implement this interface.
|
||||||
|
type ClustersGetter interface {
|
||||||
|
Clusters() ClusterInterface
|
||||||
|
}
|
||||||
|
|
||||||
|
// ClusterInterface has methods to work with Cluster resources.
|
||||||
|
type ClusterInterface interface {
|
||||||
|
Create(*v1alpha1.Cluster) (*v1alpha1.Cluster, error)
|
||||||
|
Update(*v1alpha1.Cluster) (*v1alpha1.Cluster, error)
|
||||||
|
UpdateStatus(*v1alpha1.Cluster) (*v1alpha1.Cluster, error)
|
||||||
|
Delete(name string, options *api.DeleteOptions) error
|
||||||
|
DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error
|
||||||
|
Get(name string) (*v1alpha1.Cluster, error)
|
||||||
|
List(opts api.ListOptions) (*v1alpha1.ClusterList, error)
|
||||||
|
Watch(opts api.ListOptions) (watch.Interface, error)
|
||||||
|
ClusterExpansion
|
||||||
|
}
|
||||||
|
|
||||||
|
// clusters implements ClusterInterface
|
||||||
|
type clusters struct {
|
||||||
|
client *FederationClient
|
||||||
|
}
|
||||||
|
|
||||||
|
// newClusters returns a Clusters
|
||||||
|
func newClusters(c *FederationClient) *clusters {
|
||||||
|
return &clusters{
|
||||||
|
client: c,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create takes the representation of a cluster and creates it. Returns the server's representation of the cluster, and an error, if there is any.
|
||||||
|
func (c *clusters) Create(cluster *v1alpha1.Cluster) (result *v1alpha1.Cluster, err error) {
|
||||||
|
result = &v1alpha1.Cluster{}
|
||||||
|
err = c.client.Post().
|
||||||
|
Resource("clusters").
|
||||||
|
Body(cluster).
|
||||||
|
Do().
|
||||||
|
Into(result)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update takes the representation of a cluster and updates it. Returns the server's representation of the cluster, and an error, if there is any.
|
||||||
|
func (c *clusters) Update(cluster *v1alpha1.Cluster) (result *v1alpha1.Cluster, err error) {
|
||||||
|
result = &v1alpha1.Cluster{}
|
||||||
|
err = c.client.Put().
|
||||||
|
Resource("clusters").
|
||||||
|
Name(cluster.Name).
|
||||||
|
Body(cluster).
|
||||||
|
Do().
|
||||||
|
Into(result)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *clusters) UpdateStatus(cluster *v1alpha1.Cluster) (result *v1alpha1.Cluster, err error) {
|
||||||
|
result = &v1alpha1.Cluster{}
|
||||||
|
err = c.client.Put().
|
||||||
|
Resource("clusters").
|
||||||
|
Name(cluster.Name).
|
||||||
|
SubResource("status").
|
||||||
|
Body(cluster).
|
||||||
|
Do().
|
||||||
|
Into(result)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Delete takes name of the cluster and deletes it. Returns an error if one occurs.
|
||||||
|
func (c *clusters) Delete(name string, options *api.DeleteOptions) error {
|
||||||
|
return c.client.Delete().
|
||||||
|
Resource("clusters").
|
||||||
|
Name(name).
|
||||||
|
Body(options).
|
||||||
|
Do().
|
||||||
|
Error()
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeleteCollection deletes a collection of objects.
|
||||||
|
func (c *clusters) DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error {
|
||||||
|
return c.client.Delete().
|
||||||
|
Resource("clusters").
|
||||||
|
VersionedParams(&listOptions, api.ParameterCodec).
|
||||||
|
Body(options).
|
||||||
|
Do().
|
||||||
|
Error()
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get takes name of the cluster, and returns the corresponding cluster object, and an error if there is any.
|
||||||
|
func (c *clusters) Get(name string) (result *v1alpha1.Cluster, err error) {
|
||||||
|
result = &v1alpha1.Cluster{}
|
||||||
|
err = c.client.Get().
|
||||||
|
Resource("clusters").
|
||||||
|
Name(name).
|
||||||
|
Do().
|
||||||
|
Into(result)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// List takes label and field selectors, and returns the list of Clusters that match those selectors.
|
||||||
|
func (c *clusters) List(opts api.ListOptions) (result *v1alpha1.ClusterList, err error) {
|
||||||
|
result = &v1alpha1.ClusterList{}
|
||||||
|
err = c.client.Get().
|
||||||
|
Resource("clusters").
|
||||||
|
VersionedParams(&opts, api.ParameterCodec).
|
||||||
|
Do().
|
||||||
|
Into(result)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Watch returns a watch.Interface that watches the requested clusters.
|
||||||
|
func (c *clusters) Watch(opts api.ListOptions) (watch.Interface, error) {
|
||||||
|
return c.client.Get().
|
||||||
|
Prefix("watch").
|
||||||
|
Resource("clusters").
|
||||||
|
VersionedParams(&opts, api.ParameterCodec).
|
||||||
|
Watch()
|
||||||
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
/*
|
||||||
|
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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// This package is generated by client-gen with arguments: --clientset-name=federation_release_1_3 --clientset-path=k8s.io/kubernetes/federation/client/clientset_generated --input=[federation/v1alpha1] --input-base=k8s.io/kubernetes/federation/apis
|
||||||
|
|
||||||
|
// This package has the automatically generated typed clients.
|
||||||
|
package v1alpha1
|
@ -0,0 +1,20 @@
|
|||||||
|
/*
|
||||||
|
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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// This package is generated by client-gen with arguments: --clientset-name=federation_release_1_3 --clientset-path=k8s.io/kubernetes/federation/client/clientset_generated --input=[federation/v1alpha1] --input-base=k8s.io/kubernetes/federation/apis
|
||||||
|
|
||||||
|
// Package fake has the automatically generated clients.
|
||||||
|
package fake
|
@ -0,0 +1,108 @@
|
|||||||
|
/*
|
||||||
|
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 (
|
||||||
|
v1alpha1 "k8s.io/kubernetes/federation/apis/federation/v1alpha1"
|
||||||
|
api "k8s.io/kubernetes/pkg/api"
|
||||||
|
unversioned "k8s.io/kubernetes/pkg/api/unversioned"
|
||||||
|
core "k8s.io/kubernetes/pkg/client/testing/core"
|
||||||
|
labels "k8s.io/kubernetes/pkg/labels"
|
||||||
|
watch "k8s.io/kubernetes/pkg/watch"
|
||||||
|
)
|
||||||
|
|
||||||
|
// FakeClusters implements ClusterInterface
|
||||||
|
type FakeClusters struct {
|
||||||
|
Fake *FakeFederation
|
||||||
|
}
|
||||||
|
|
||||||
|
var clustersResource = unversioned.GroupVersionResource{Group: "federation", Version: "v1alpha1", Resource: "clusters"}
|
||||||
|
|
||||||
|
func (c *FakeClusters) Create(cluster *v1alpha1.Cluster) (result *v1alpha1.Cluster, err error) {
|
||||||
|
obj, err := c.Fake.
|
||||||
|
Invokes(core.NewRootCreateAction(clustersResource, cluster), &v1alpha1.Cluster{})
|
||||||
|
if obj == nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return obj.(*v1alpha1.Cluster), err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *FakeClusters) Update(cluster *v1alpha1.Cluster) (result *v1alpha1.Cluster, err error) {
|
||||||
|
obj, err := c.Fake.
|
||||||
|
Invokes(core.NewRootUpdateAction(clustersResource, cluster), &v1alpha1.Cluster{})
|
||||||
|
if obj == nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return obj.(*v1alpha1.Cluster), err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *FakeClusters) UpdateStatus(cluster *v1alpha1.Cluster) (*v1alpha1.Cluster, error) {
|
||||||
|
obj, err := c.Fake.
|
||||||
|
Invokes(core.NewRootUpdateSubresourceAction(clustersResource, "status", cluster), &v1alpha1.Cluster{})
|
||||||
|
if obj == nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return obj.(*v1alpha1.Cluster), err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *FakeClusters) Delete(name string, options *api.DeleteOptions) error {
|
||||||
|
_, err := c.Fake.
|
||||||
|
Invokes(core.NewRootDeleteAction(clustersResource, name), &v1alpha1.Cluster{})
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *FakeClusters) DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error {
|
||||||
|
action := core.NewRootDeleteCollectionAction(clustersResource, listOptions)
|
||||||
|
|
||||||
|
_, err := c.Fake.Invokes(action, &v1alpha1.ClusterList{})
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *FakeClusters) Get(name string) (result *v1alpha1.Cluster, err error) {
|
||||||
|
obj, err := c.Fake.
|
||||||
|
Invokes(core.NewRootGetAction(clustersResource, name), &v1alpha1.Cluster{})
|
||||||
|
if obj == nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return obj.(*v1alpha1.Cluster), err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *FakeClusters) List(opts api.ListOptions) (result *v1alpha1.ClusterList, err error) {
|
||||||
|
obj, err := c.Fake.
|
||||||
|
Invokes(core.NewRootListAction(clustersResource, opts), &v1alpha1.ClusterList{})
|
||||||
|
if obj == nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
label := opts.LabelSelector
|
||||||
|
if label == nil {
|
||||||
|
label = labels.Everything()
|
||||||
|
}
|
||||||
|
list := &v1alpha1.ClusterList{}
|
||||||
|
for _, item := range obj.(*v1alpha1.ClusterList).Items {
|
||||||
|
if label.Matches(labels.Set(item.Labels)) {
|
||||||
|
list.Items = append(list.Items, item)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return list, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// Watch returns a watch.Interface that watches the requested clusters.
|
||||||
|
func (c *FakeClusters) Watch(opts api.ListOptions) (watch.Interface, error) {
|
||||||
|
return c.Fake.
|
||||||
|
InvokesWatch(core.NewRootWatchAction(clustersResource, opts))
|
||||||
|
}
|
@ -0,0 +1,30 @@
|
|||||||
|
/*
|
||||||
|
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 (
|
||||||
|
v1alpha1 "k8s.io/kubernetes/federation/client/clientset_generated/federation_release_1_3/typed/federation/v1alpha1"
|
||||||
|
core "k8s.io/kubernetes/pkg/client/testing/core"
|
||||||
|
)
|
||||||
|
|
||||||
|
type FakeFederation struct {
|
||||||
|
*core.Fake
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *FakeFederation) Clusters() v1alpha1.ClusterInterface {
|
||||||
|
return &FakeClusters{c}
|
||||||
|
}
|
@ -0,0 +1,96 @@
|
|||||||
|
/*
|
||||||
|
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 v1alpha1
|
||||||
|
|
||||||
|
import (
|
||||||
|
fmt "fmt"
|
||||||
|
api "k8s.io/kubernetes/pkg/api"
|
||||||
|
registered "k8s.io/kubernetes/pkg/apimachinery/registered"
|
||||||
|
restclient "k8s.io/kubernetes/pkg/client/restclient"
|
||||||
|
)
|
||||||
|
|
||||||
|
type FederationInterface interface {
|
||||||
|
ClustersGetter
|
||||||
|
}
|
||||||
|
|
||||||
|
// FederationClient is used to interact with features provided by the Federation group.
|
||||||
|
type FederationClient struct {
|
||||||
|
*restclient.RESTClient
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *FederationClient) Clusters() ClusterInterface {
|
||||||
|
return newClusters(c)
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewForConfig creates a new FederationClient for the given config.
|
||||||
|
func NewForConfig(c *restclient.Config) (*FederationClient, error) {
|
||||||
|
config := *c
|
||||||
|
if err := setConfigDefaults(&config); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
client, err := restclient.RESTClientFor(&config)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return &FederationClient{client}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewForConfigOrDie creates a new FederationClient for the given config and
|
||||||
|
// panics if there is an error in the config.
|
||||||
|
func NewForConfigOrDie(c *restclient.Config) *FederationClient {
|
||||||
|
client, err := NewForConfig(c)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
return client
|
||||||
|
}
|
||||||
|
|
||||||
|
// New creates a new FederationClient for the given RESTClient.
|
||||||
|
func New(c *restclient.RESTClient) *FederationClient {
|
||||||
|
return &FederationClient{c}
|
||||||
|
}
|
||||||
|
|
||||||
|
func setConfigDefaults(config *restclient.Config) error {
|
||||||
|
// if federation group is not registered, return an error
|
||||||
|
g, err := registered.Group("federation")
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
config.APIPath = "/apis"
|
||||||
|
if config.UserAgent == "" {
|
||||||
|
config.UserAgent = restclient.DefaultKubernetesUserAgent()
|
||||||
|
}
|
||||||
|
// TODO: Unconditionally set the config.Version, until we fix the config.
|
||||||
|
//if config.Version == "" {
|
||||||
|
copyGroupVersion := g.GroupVersion
|
||||||
|
config.GroupVersion = ©GroupVersion
|
||||||
|
//}
|
||||||
|
|
||||||
|
codec, ok := api.Codecs.SerializerForFileExtension("json")
|
||||||
|
if !ok {
|
||||||
|
return fmt.Errorf("unable to find serializer for JSON")
|
||||||
|
}
|
||||||
|
config.Codec = codec
|
||||||
|
|
||||||
|
if config.QPS == 0 {
|
||||||
|
config.QPS = 5
|
||||||
|
}
|
||||||
|
if config.Burst == 0 {
|
||||||
|
config.Burst = 10
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
@ -0,0 +1,19 @@
|
|||||||
|
/*
|
||||||
|
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 v1alpha1
|
||||||
|
|
||||||
|
type ClusterExpansion interface{}
|
@ -168,6 +168,7 @@ ignore-not-found
|
|||||||
image-gc-high-threshold
|
image-gc-high-threshold
|
||||||
image-gc-low-threshold
|
image-gc-low-threshold
|
||||||
include-extended-apis
|
include-extended-apis
|
||||||
|
input-base
|
||||||
input-dirs
|
input-dirs
|
||||||
insecure-bind-address
|
insecure-bind-address
|
||||||
insecure-port
|
insecure-port
|
||||||
|
Loading…
Reference in New Issue
Block a user