manully sync up to 1634d8f9f72a626b16c55573d78e8da2d75e6356

(merging https://github.com/kubernetes/kubernetes/pull/42084). For the new publish
script to work, client-go has to be synced up to when k8s.io/kubernetes doesn't
include _vendor
This commit is contained in:
Chao Xu
2017-02-28 14:27:37 -08:00
parent 6500775c58
commit 6c315a68f3
1011 changed files with 25255 additions and 320508 deletions

View File

@@ -17,10 +17,9 @@ limitations under the License.
package v1
import (
fmt "fmt"
schema "k8s.io/apimachinery/pkg/runtime/schema"
serializer "k8s.io/apimachinery/pkg/runtime/serializer"
api "k8s.io/client-go/pkg/api"
"k8s.io/client-go/kubernetes/scheme"
v1 "k8s.io/client-go/pkg/apis/batch/v1"
rest "k8s.io/client-go/rest"
)
@@ -67,22 +66,14 @@ func New(c rest.Interface) *BatchV1Client {
}
func setConfigDefaults(config *rest.Config) error {
gv, err := schema.ParseGroupVersion("batch/v1")
if err != nil {
return err
}
// if batch/v1 is not enabled, return an error
if !api.Registry.IsEnabledVersion(gv) {
return fmt.Errorf("batch/v1 is not enabled")
}
gv := v1.SchemeGroupVersion
config.GroupVersion = &gv
config.APIPath = "/apis"
config.NegotiatedSerializer = serializer.DirectCodecFactory{CodecFactory: scheme.Codecs}
if config.UserAgent == "" {
config.UserAgent = rest.DefaultKubernetesUserAgent()
}
copyGroupVersion := gv
config.GroupVersion = &copyGroupVersion
config.NegotiatedSerializer = serializer.DirectCodecFactory{CodecFactory: api.Codecs}
return nil
}

View File

@@ -20,7 +20,7 @@ import (
meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
api "k8s.io/client-go/pkg/api"
scheme "k8s.io/client-go/kubernetes/scheme"
v1 "k8s.io/client-go/pkg/apis/batch/v1"
rest "k8s.io/client-go/rest"
)
@@ -116,7 +116,7 @@ func (c *jobs) DeleteCollection(options *meta_v1.DeleteOptions, listOptions meta
return c.client.Delete().
Namespace(c.ns).
Resource("jobs").
VersionedParams(&listOptions, api.ParameterCodec).
VersionedParams(&listOptions, scheme.ParameterCodec).
Body(options).
Do().
Error()
@@ -129,7 +129,7 @@ func (c *jobs) Get(name string, options meta_v1.GetOptions) (result *v1.Job, err
Namespace(c.ns).
Resource("jobs").
Name(name).
VersionedParams(&options, api.ParameterCodec).
VersionedParams(&options, scheme.ParameterCodec).
Do().
Into(result)
return
@@ -141,7 +141,7 @@ func (c *jobs) List(opts meta_v1.ListOptions) (result *v1.JobList, err error) {
err = c.client.Get().
Namespace(c.ns).
Resource("jobs").
VersionedParams(&opts, api.ParameterCodec).
VersionedParams(&opts, scheme.ParameterCodec).
Do().
Into(result)
return
@@ -149,11 +149,11 @@ func (c *jobs) List(opts meta_v1.ListOptions) (result *v1.JobList, err error) {
// Watch returns a watch.Interface that watches the requested jobs.
func (c *jobs) Watch(opts meta_v1.ListOptions) (watch.Interface, error) {
opts.Watch = true
return c.client.Get().
Prefix("watch").
Namespace(c.ns).
Resource("jobs").
VersionedParams(&opts, api.ParameterCodec).
VersionedParams(&opts, scheme.ParameterCodec).
Watch()
}

View File

@@ -17,10 +17,9 @@ limitations under the License.
package v2alpha1
import (
fmt "fmt"
schema "k8s.io/apimachinery/pkg/runtime/schema"
serializer "k8s.io/apimachinery/pkg/runtime/serializer"
api "k8s.io/client-go/pkg/api"
"k8s.io/client-go/kubernetes/scheme"
v2alpha1 "k8s.io/client-go/pkg/apis/batch/v2alpha1"
rest "k8s.io/client-go/rest"
)
@@ -72,22 +71,14 @@ func New(c rest.Interface) *BatchV2alpha1Client {
}
func setConfigDefaults(config *rest.Config) error {
gv, err := schema.ParseGroupVersion("batch/v2alpha1")
if err != nil {
return err
}
// if batch/v2alpha1 is not enabled, return an error
if !api.Registry.IsEnabledVersion(gv) {
return fmt.Errorf("batch/v2alpha1 is not enabled")
}
gv := v2alpha1.SchemeGroupVersion
config.GroupVersion = &gv
config.APIPath = "/apis"
config.NegotiatedSerializer = serializer.DirectCodecFactory{CodecFactory: scheme.Codecs}
if config.UserAgent == "" {
config.UserAgent = rest.DefaultKubernetesUserAgent()
}
copyGroupVersion := gv
config.GroupVersion = &copyGroupVersion
config.NegotiatedSerializer = serializer.DirectCodecFactory{CodecFactory: api.Codecs}
return nil
}

View File

@@ -20,7 +20,7 @@ import (
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
api "k8s.io/client-go/pkg/api"
scheme "k8s.io/client-go/kubernetes/scheme"
v2alpha1 "k8s.io/client-go/pkg/apis/batch/v2alpha1"
rest "k8s.io/client-go/rest"
)
@@ -116,7 +116,7 @@ func (c *cronJobs) DeleteCollection(options *v1.DeleteOptions, listOptions v1.Li
return c.client.Delete().
Namespace(c.ns).
Resource("cronjobs").
VersionedParams(&listOptions, api.ParameterCodec).
VersionedParams(&listOptions, scheme.ParameterCodec).
Body(options).
Do().
Error()
@@ -129,7 +129,7 @@ func (c *cronJobs) Get(name string, options v1.GetOptions) (result *v2alpha1.Cro
Namespace(c.ns).
Resource("cronjobs").
Name(name).
VersionedParams(&options, api.ParameterCodec).
VersionedParams(&options, scheme.ParameterCodec).
Do().
Into(result)
return
@@ -141,7 +141,7 @@ func (c *cronJobs) List(opts v1.ListOptions) (result *v2alpha1.CronJobList, err
err = c.client.Get().
Namespace(c.ns).
Resource("cronjobs").
VersionedParams(&opts, api.ParameterCodec).
VersionedParams(&opts, scheme.ParameterCodec).
Do().
Into(result)
return
@@ -149,11 +149,11 @@ func (c *cronJobs) List(opts v1.ListOptions) (result *v2alpha1.CronJobList, err
// Watch returns a watch.Interface that watches the requested cronJobs.
func (c *cronJobs) Watch(opts v1.ListOptions) (watch.Interface, error) {
opts.Watch = true
return c.client.Get().
Prefix("watch").
Namespace(c.ns).
Resource("cronjobs").
VersionedParams(&opts, api.ParameterCodec).
VersionedParams(&opts, scheme.ParameterCodec).
Watch()
}

View File

@@ -20,7 +20,7 @@ import (
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
api "k8s.io/client-go/pkg/api"
scheme "k8s.io/client-go/kubernetes/scheme"
v2alpha1 "k8s.io/client-go/pkg/apis/batch/v2alpha1"
rest "k8s.io/client-go/rest"
)
@@ -116,7 +116,7 @@ func (c *jobs) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOp
return c.client.Delete().
Namespace(c.ns).
Resource("jobs").
VersionedParams(&listOptions, api.ParameterCodec).
VersionedParams(&listOptions, scheme.ParameterCodec).
Body(options).
Do().
Error()
@@ -129,7 +129,7 @@ func (c *jobs) Get(name string, options v1.GetOptions) (result *v2alpha1.Job, er
Namespace(c.ns).
Resource("jobs").
Name(name).
VersionedParams(&options, api.ParameterCodec).
VersionedParams(&options, scheme.ParameterCodec).
Do().
Into(result)
return
@@ -141,7 +141,7 @@ func (c *jobs) List(opts v1.ListOptions) (result *v2alpha1.JobList, err error) {
err = c.client.Get().
Namespace(c.ns).
Resource("jobs").
VersionedParams(&opts, api.ParameterCodec).
VersionedParams(&opts, scheme.ParameterCodec).
Do().
Into(result)
return
@@ -149,11 +149,11 @@ func (c *jobs) List(opts v1.ListOptions) (result *v2alpha1.JobList, err error) {
// Watch returns a watch.Interface that watches the requested jobs.
func (c *jobs) Watch(opts v1.ListOptions) (watch.Interface, error) {
opts.Watch = true
return c.client.Get().
Prefix("watch").
Namespace(c.ns).
Resource("jobs").
VersionedParams(&opts, api.ParameterCodec).
VersionedParams(&opts, scheme.ParameterCodec).
Watch()
}