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.CoreV1Client, err = v1core.NewForConfig(&configShallowCopy) if err != nil { return nil, err } clientset.AppsV1beta1Client, err = v1beta1apps.NewForConfig(&configShallowCopy) if err != nil { return nil, err } clientset.AuthenticationV1beta1Client, err = v1beta1authentication.NewForConfig(&configShallowCopy) if err != nil { return nil, err } clientset.AuthorizationV1beta1Client, err = v1beta1authorization.NewForConfig(&configShallowCopy) if err != nil { return nil, err } clientset.AutoscalingV1Client, err = v1autoscaling.NewForConfig(&configShallowCopy) if err != nil { return nil, err } clientset.BatchV1Client, err = v1batch.NewForConfig(&configShallowCopy) if err != nil { return nil, err } clientset.BatchV2alpha1Client, err = v2alpha1batch.NewForConfig(&configShallowCopy) if err != nil { return nil, err } clientset.CertificatesV1alpha1Client, err = v1alpha1certificates.NewForConfig(&configShallowCopy) if err != nil { return nil, err } clientset.ExtensionsV1beta1Client, err = v1beta1extensions.NewForConfig(&configShallowCopy) if err != nil { return nil, err } clientset.PolicyV1beta1Client, err = v1beta1policy.NewForConfig(&configShallowCopy) if err != nil { return nil, err } clientset.RbacV1alpha1Client, err = v1alpha1rbac.NewForConfig(&configShallowCopy) if err != nil { return nil, err } clientset.StorageV1beta1Client, err = v1beta1storage.NewForConfig(&configShallowCopy) if err != nil { return nil, err } clientset.DiscoveryClient, err = discovery.NewDiscoveryClientForConfig(&configShallowCopy) if err != nil { glog.Errorf("failed to create the DiscoveryClient: %v", err) return nil, err } return &clientset, nil }
|