Commit 6c9a4139 authored by Kubernetes Submit Queue's avatar Kubernetes Submit Queue Committed by GitHub

Merge pull request #38614 from soltysh/remove_ext_jobs

Automatic merge from submit-queue (batch tested with PRs 37468, 36546, 38713, 38902, 38614) Remove extensions/v1beta1 Job Fixes https://github.com/kubernetes/kubernetes/issues/32763. This endpoint was deprecated in 1.5 and was planned to be removed in 1.6. **Release note**: ```release-note Remove extensions/v1beta1 Jobs resource, and job/v1beta1 generator. ```
parents 9929fd3f 4188bb71
...@@ -193,7 +193,6 @@ func Run(s *options.ServerRunOptions) error { ...@@ -193,7 +193,6 @@ func Run(s *options.ServerRunOptions) error {
if err != nil { if err != nil {
return fmt.Errorf("error in initializing storage factory: %s", err) return fmt.Errorf("error in initializing storage factory: %s", err)
} }
storageFactory.AddCohabitatingResources(batch.Resource("jobs"), extensions.Resource("jobs"))
storageFactory.AddCohabitatingResources(autoscaling.Resource("horizontalpodautoscalers"), extensions.Resource("horizontalpodautoscalers")) storageFactory.AddCohabitatingResources(autoscaling.Resource("horizontalpodautoscalers"), extensions.Resource("horizontalpodautoscalers"))
for _, override := range s.Etcd.EtcdServersOverrides { for _, override := range s.Etcd.EtcdServersOverrides {
tokens := strings.Split(override, "#") tokens := strings.Split(override, "#")
......
...@@ -24,9 +24,22 @@ import ( ...@@ -24,9 +24,22 @@ import (
"k8s.io/kubernetes/pkg/apis/batch" "k8s.io/kubernetes/pkg/apis/batch"
clientset "k8s.io/kubernetes/pkg/client/clientset_generated/clientset" clientset "k8s.io/kubernetes/pkg/client/clientset_generated/clientset"
"k8s.io/kubernetes/pkg/controller/cronjob" "k8s.io/kubernetes/pkg/controller/cronjob"
"k8s.io/kubernetes/pkg/controller/job"
"k8s.io/kubernetes/pkg/runtime/schema" "k8s.io/kubernetes/pkg/runtime/schema"
) )
func startJobController(ctx ControllerContext) (bool, error) {
if !ctx.AvailableResources[schema.GroupVersionResource{Group: "batch", Version: "v1", Resource: "jobs"}] {
return false, nil
}
go job.NewJobController(
ctx.InformerFactory.Pods().Informer(),
ctx.InformerFactory.Jobs(),
ctx.ClientBuilder.ClientOrDie("job-controller"),
).Run(int(ctx.Options.ConcurrentJobSyncs), ctx.Stop)
return true, nil
}
func startCronJobController(ctx ControllerContext) (bool, error) { func startCronJobController(ctx ControllerContext) (bool, error) {
if !ctx.AvailableResources[schema.GroupVersionResource{Group: "batch", Version: "v2alpha1", Resource: "cronjobs"}] { if !ctx.AvailableResources[schema.GroupVersionResource{Group: "batch", Version: "v2alpha1", Resource: "cronjobs"}] {
return false, nil return false, nil
......
...@@ -23,7 +23,6 @@ package app ...@@ -23,7 +23,6 @@ package app
import ( import (
"k8s.io/kubernetes/pkg/controller/daemon" "k8s.io/kubernetes/pkg/controller/daemon"
"k8s.io/kubernetes/pkg/controller/deployment" "k8s.io/kubernetes/pkg/controller/deployment"
"k8s.io/kubernetes/pkg/controller/job"
replicaset "k8s.io/kubernetes/pkg/controller/replicaset" replicaset "k8s.io/kubernetes/pkg/controller/replicaset"
"k8s.io/kubernetes/pkg/runtime/schema" "k8s.io/kubernetes/pkg/runtime/schema"
) )
...@@ -42,18 +41,6 @@ func startDaemonSetController(ctx ControllerContext) (bool, error) { ...@@ -42,18 +41,6 @@ func startDaemonSetController(ctx ControllerContext) (bool, error) {
return true, nil return true, nil
} }
func startJobController(ctx ControllerContext) (bool, error) {
if !ctx.AvailableResources[schema.GroupVersionResource{Group: "extensions", Version: "v1beta1", Resource: "jobs"}] {
return false, nil
}
go job.NewJobController(
ctx.InformerFactory.Pods().Informer(),
ctx.InformerFactory.Jobs(),
ctx.ClientBuilder.ClientOrDie("job-controller"),
).Run(int(ctx.Options.ConcurrentJobSyncs), ctx.Stop)
return true, nil
}
func startDeploymentController(ctx ControllerContext) (bool, error) { func startDeploymentController(ctx ControllerContext) (bool, error) {
if !ctx.AvailableResources[schema.GroupVersionResource{Group: "extensions", Version: "v1beta1", Resource: "deployments"}] { if !ctx.AvailableResources[schema.GroupVersionResource{Group: "extensions", Version: "v1beta1", Resource: "deployments"}] {
return false, nil return false, nil
......
...@@ -67,36 +67,36 @@ func NewForConfig(c *restclient.Config) (*Clientset, error) { ...@@ -67,36 +67,36 @@ func NewForConfig(c *restclient.Config) (*Clientset, error) {
if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 { if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 {
configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst) configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst)
} }
var clientset Clientset var cs Clientset
var err error var err error
clientset.ApiregistrationV1alpha1Client, err = v1alpha1apiregistration.NewForConfig(&configShallowCopy) cs.ApiregistrationV1alpha1Client, err = v1alpha1apiregistration.NewForConfig(&configShallowCopy)
if err != nil { if err != nil {
return nil, err return nil, err
} }
clientset.DiscoveryClient, err = discovery.NewDiscoveryClientForConfig(&configShallowCopy) cs.DiscoveryClient, err = discovery.NewDiscoveryClientForConfig(&configShallowCopy)
if err != nil { if err != nil {
glog.Errorf("failed to create the DiscoveryClient: %v", err) glog.Errorf("failed to create the DiscoveryClient: %v", err)
return nil, err return nil, err
} }
return &clientset, nil return &cs, nil
} }
// NewForConfigOrDie creates a new Clientset for the given config and // NewForConfigOrDie creates a new Clientset for the given config and
// panics if there is an error in the config. // panics if there is an error in the config.
func NewForConfigOrDie(c *restclient.Config) *Clientset { func NewForConfigOrDie(c *restclient.Config) *Clientset {
var clientset Clientset var cs Clientset
clientset.ApiregistrationV1alpha1Client = v1alpha1apiregistration.NewForConfigOrDie(c) cs.ApiregistrationV1alpha1Client = v1alpha1apiregistration.NewForConfigOrDie(c)
clientset.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c) cs.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c)
return &clientset return &cs
} }
// New creates a new Clientset for the given RESTClient. // New creates a new Clientset for the given RESTClient.
func New(c restclient.Interface) *Clientset { func New(c restclient.Interface) *Clientset {
var clientset Clientset var cs Clientset
clientset.ApiregistrationV1alpha1Client = v1alpha1apiregistration.New(c) cs.ApiregistrationV1alpha1Client = v1alpha1apiregistration.New(c)
clientset.DiscoveryClient = discovery.NewDiscoveryClient(c) cs.DiscoveryClient = discovery.NewDiscoveryClient(c)
return &clientset return &cs
} }
...@@ -56,36 +56,36 @@ func NewForConfig(c *restclient.Config) (*Clientset, error) { ...@@ -56,36 +56,36 @@ func NewForConfig(c *restclient.Config) (*Clientset, error) {
if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 { if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 {
configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst) configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst)
} }
var clientset Clientset var cs Clientset
var err error var err error
clientset.ApiregistrationClient, err = internalversionapiregistration.NewForConfig(&configShallowCopy) cs.ApiregistrationClient, err = internalversionapiregistration.NewForConfig(&configShallowCopy)
if err != nil { if err != nil {
return nil, err return nil, err
} }
clientset.DiscoveryClient, err = discovery.NewDiscoveryClientForConfig(&configShallowCopy) cs.DiscoveryClient, err = discovery.NewDiscoveryClientForConfig(&configShallowCopy)
if err != nil { if err != nil {
glog.Errorf("failed to create the DiscoveryClient: %v", err) glog.Errorf("failed to create the DiscoveryClient: %v", err)
return nil, err return nil, err
} }
return &clientset, nil return &cs, nil
} }
// NewForConfigOrDie creates a new Clientset for the given config and // NewForConfigOrDie creates a new Clientset for the given config and
// panics if there is an error in the config. // panics if there is an error in the config.
func NewForConfigOrDie(c *restclient.Config) *Clientset { func NewForConfigOrDie(c *restclient.Config) *Clientset {
var clientset Clientset var cs Clientset
clientset.ApiregistrationClient = internalversionapiregistration.NewForConfigOrDie(c) cs.ApiregistrationClient = internalversionapiregistration.NewForConfigOrDie(c)
clientset.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c) cs.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c)
return &clientset return &cs
} }
// New creates a new Clientset for the given RESTClient. // New creates a new Clientset for the given RESTClient.
func New(c restclient.Interface) *Clientset { func New(c restclient.Interface) *Clientset {
var clientset Clientset var cs Clientset
clientset.ApiregistrationClient = internalversionapiregistration.New(c) cs.ApiregistrationClient = internalversionapiregistration.New(c)
clientset.DiscoveryClient = discovery.NewDiscoveryClient(c) cs.DiscoveryClient = discovery.NewDiscoveryClient(c)
return &clientset return &cs
} }
...@@ -160,19 +160,19 @@ func NewForConfig(c *$.Config|raw$) (*Clientset, error) { ...@@ -160,19 +160,19 @@ func NewForConfig(c *$.Config|raw$) (*Clientset, error) {
if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 { if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 {
configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst) configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst)
} }
var clientset Clientset var cs Clientset
var err error var err error
$range .allGroups$ clientset.$.GroupVersion$Client, err =$.PackageName$.NewForConfig(&configShallowCopy) $range .allGroups$ cs.$.GroupVersion$Client, err =$.PackageName$.NewForConfig(&configShallowCopy)
if err!=nil { if err!=nil {
return nil, err return nil, err
} }
$end$ $end$
clientset.DiscoveryClient, err = $.NewDiscoveryClientForConfig|raw$(&configShallowCopy) cs.DiscoveryClient, err = $.NewDiscoveryClientForConfig|raw$(&configShallowCopy)
if err!=nil { if err!=nil {
glog.Errorf("failed to create the DiscoveryClient: %v", err) glog.Errorf("failed to create the DiscoveryClient: %v", err)
return nil, err return nil, err
} }
return &clientset, nil return &cs, nil
} }
` `
...@@ -180,21 +180,21 @@ var newClientsetForConfigOrDieTemplate = ` ...@@ -180,21 +180,21 @@ var newClientsetForConfigOrDieTemplate = `
// NewForConfigOrDie creates a new Clientset for the given config and // NewForConfigOrDie creates a new Clientset for the given config and
// panics if there is an error in the config. // panics if there is an error in the config.
func NewForConfigOrDie(c *$.Config|raw$) *Clientset { func NewForConfigOrDie(c *$.Config|raw$) *Clientset {
var clientset Clientset var cs Clientset
$range .allGroups$ clientset.$.GroupVersion$Client =$.PackageName$.NewForConfigOrDie(c) $range .allGroups$ cs.$.GroupVersion$Client =$.PackageName$.NewForConfigOrDie(c)
$end$ $end$
clientset.DiscoveryClient = $.NewDiscoveryClientForConfigOrDie|raw$(c) cs.DiscoveryClient = $.NewDiscoveryClientForConfigOrDie|raw$(c)
return &clientset return &cs
} }
` `
var newClientsetForRESTClientTemplate = ` var newClientsetForRESTClientTemplate = `
// New creates a new Clientset for the given RESTClient. // New creates a new Clientset for the given RESTClient.
func New(c $.RESTClientInterface|raw$) *Clientset { func New(c $.RESTClientInterface|raw$) *Clientset {
var clientset Clientset var cs Clientset
$range .allGroups$ clientset.$.GroupVersion$Client =$.PackageName$.New(c) $range .allGroups$ cs.$.GroupVersion$Client =$.PackageName$.New(c)
$end$ $end$
clientset.DiscoveryClient = $.NewDiscoveryClient|raw$(c) cs.DiscoveryClient = $.NewDiscoveryClient|raw$(c)
return &clientset return &cs
} }
` `
...@@ -56,36 +56,36 @@ func NewForConfig(c *restclient.Config) (*Clientset, error) { ...@@ -56,36 +56,36 @@ func NewForConfig(c *restclient.Config) (*Clientset, error) {
if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 { if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 {
configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst) configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst)
} }
var clientset Clientset var cs Clientset
var err error var err error
clientset.TestgroupClient, err = internalversiontestgroup.NewForConfig(&configShallowCopy) cs.TestgroupClient, err = internalversiontestgroup.NewForConfig(&configShallowCopy)
if err != nil { if err != nil {
return nil, err return nil, err
} }
clientset.DiscoveryClient, err = discovery.NewDiscoveryClientForConfig(&configShallowCopy) cs.DiscoveryClient, err = discovery.NewDiscoveryClientForConfig(&configShallowCopy)
if err != nil { if err != nil {
glog.Errorf("failed to create the DiscoveryClient: %v", err) glog.Errorf("failed to create the DiscoveryClient: %v", err)
return nil, err return nil, err
} }
return &clientset, nil return &cs, nil
} }
// NewForConfigOrDie creates a new Clientset for the given config and // NewForConfigOrDie creates a new Clientset for the given config and
// panics if there is an error in the config. // panics if there is an error in the config.
func NewForConfigOrDie(c *restclient.Config) *Clientset { func NewForConfigOrDie(c *restclient.Config) *Clientset {
var clientset Clientset var cs Clientset
clientset.TestgroupClient = internalversiontestgroup.NewForConfigOrDie(c) cs.TestgroupClient = internalversiontestgroup.NewForConfigOrDie(c)
clientset.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c) cs.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c)
return &clientset return &cs
} }
// New creates a new Clientset for the given RESTClient. // New creates a new Clientset for the given RESTClient.
func New(c restclient.Interface) *Clientset { func New(c restclient.Interface) *Clientset {
var clientset Clientset var cs Clientset
clientset.TestgroupClient = internalversiontestgroup.New(c) cs.TestgroupClient = internalversiontestgroup.New(c)
clientset.DiscoveryClient = discovery.NewDiscoveryClient(c) cs.DiscoveryClient = discovery.NewDiscoveryClient(c)
return &clientset return &cs
} }
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -133,54 +133,54 @@ func NewForConfig(c *restclient.Config) (*Clientset, error) { ...@@ -133,54 +133,54 @@ func NewForConfig(c *restclient.Config) (*Clientset, error) {
if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 { if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 {
configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst) configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst)
} }
var clientset Clientset var cs Clientset
var err error var err error
clientset.CoreV1Client, err = v1core.NewForConfig(&configShallowCopy) cs.CoreV1Client, err = v1core.NewForConfig(&configShallowCopy)
if err != nil { if err != nil {
return nil, err return nil, err
} }
clientset.BatchV1Client, err = v1batch.NewForConfig(&configShallowCopy) cs.BatchV1Client, err = v1batch.NewForConfig(&configShallowCopy)
if err != nil { if err != nil {
return nil, err return nil, err
} }
clientset.ExtensionsV1beta1Client, err = v1beta1extensions.NewForConfig(&configShallowCopy) cs.ExtensionsV1beta1Client, err = v1beta1extensions.NewForConfig(&configShallowCopy)
if err != nil { if err != nil {
return nil, err return nil, err
} }
clientset.FederationV1beta1Client, err = v1beta1federation.NewForConfig(&configShallowCopy) cs.FederationV1beta1Client, err = v1beta1federation.NewForConfig(&configShallowCopy)
if err != nil { if err != nil {
return nil, err return nil, err
} }
clientset.DiscoveryClient, err = discovery.NewDiscoveryClientForConfig(&configShallowCopy) cs.DiscoveryClient, err = discovery.NewDiscoveryClientForConfig(&configShallowCopy)
if err != nil { if err != nil {
glog.Errorf("failed to create the DiscoveryClient: %v", err) glog.Errorf("failed to create the DiscoveryClient: %v", err)
return nil, err return nil, err
} }
return &clientset, nil return &cs, nil
} }
// NewForConfigOrDie creates a new Clientset for the given config and // NewForConfigOrDie creates a new Clientset for the given config and
// panics if there is an error in the config. // panics if there is an error in the config.
func NewForConfigOrDie(c *restclient.Config) *Clientset { func NewForConfigOrDie(c *restclient.Config) *Clientset {
var clientset Clientset var cs Clientset
clientset.CoreV1Client = v1core.NewForConfigOrDie(c) cs.CoreV1Client = v1core.NewForConfigOrDie(c)
clientset.BatchV1Client = v1batch.NewForConfigOrDie(c) cs.BatchV1Client = v1batch.NewForConfigOrDie(c)
clientset.ExtensionsV1beta1Client = v1beta1extensions.NewForConfigOrDie(c) cs.ExtensionsV1beta1Client = v1beta1extensions.NewForConfigOrDie(c)
clientset.FederationV1beta1Client = v1beta1federation.NewForConfigOrDie(c) cs.FederationV1beta1Client = v1beta1federation.NewForConfigOrDie(c)
clientset.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c) cs.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c)
return &clientset return &cs
} }
// New creates a new Clientset for the given RESTClient. // New creates a new Clientset for the given RESTClient.
func New(c restclient.Interface) *Clientset { func New(c restclient.Interface) *Clientset {
var clientset Clientset var cs Clientset
clientset.CoreV1Client = v1core.New(c) cs.CoreV1Client = v1core.New(c)
clientset.BatchV1Client = v1batch.New(c) cs.BatchV1Client = v1batch.New(c)
clientset.ExtensionsV1beta1Client = v1beta1extensions.New(c) cs.ExtensionsV1beta1Client = v1beta1extensions.New(c)
clientset.FederationV1beta1Client = v1beta1federation.New(c) cs.FederationV1beta1Client = v1beta1federation.New(c)
clientset.DiscoveryClient = discovery.NewDiscoveryClient(c) cs.DiscoveryClient = discovery.NewDiscoveryClient(c)
return &clientset return &cs
} }
...@@ -92,54 +92,54 @@ func NewForConfig(c *restclient.Config) (*Clientset, error) { ...@@ -92,54 +92,54 @@ func NewForConfig(c *restclient.Config) (*Clientset, error) {
if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 { if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 {
configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst) configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst)
} }
var clientset Clientset var cs Clientset
var err error var err error
clientset.CoreClient, err = internalversioncore.NewForConfig(&configShallowCopy) cs.CoreClient, err = internalversioncore.NewForConfig(&configShallowCopy)
if err != nil { if err != nil {
return nil, err return nil, err
} }
clientset.BatchClient, err = internalversionbatch.NewForConfig(&configShallowCopy) cs.BatchClient, err = internalversionbatch.NewForConfig(&configShallowCopy)
if err != nil { if err != nil {
return nil, err return nil, err
} }
clientset.ExtensionsClient, err = internalversionextensions.NewForConfig(&configShallowCopy) cs.ExtensionsClient, err = internalversionextensions.NewForConfig(&configShallowCopy)
if err != nil { if err != nil {
return nil, err return nil, err
} }
clientset.FederationClient, err = internalversionfederation.NewForConfig(&configShallowCopy) cs.FederationClient, err = internalversionfederation.NewForConfig(&configShallowCopy)
if err != nil { if err != nil {
return nil, err return nil, err
} }
clientset.DiscoveryClient, err = discovery.NewDiscoveryClientForConfig(&configShallowCopy) cs.DiscoveryClient, err = discovery.NewDiscoveryClientForConfig(&configShallowCopy)
if err != nil { if err != nil {
glog.Errorf("failed to create the DiscoveryClient: %v", err) glog.Errorf("failed to create the DiscoveryClient: %v", err)
return nil, err return nil, err
} }
return &clientset, nil return &cs, nil
} }
// NewForConfigOrDie creates a new Clientset for the given config and // NewForConfigOrDie creates a new Clientset for the given config and
// panics if there is an error in the config. // panics if there is an error in the config.
func NewForConfigOrDie(c *restclient.Config) *Clientset { func NewForConfigOrDie(c *restclient.Config) *Clientset {
var clientset Clientset var cs Clientset
clientset.CoreClient = internalversioncore.NewForConfigOrDie(c) cs.CoreClient = internalversioncore.NewForConfigOrDie(c)
clientset.BatchClient = internalversionbatch.NewForConfigOrDie(c) cs.BatchClient = internalversionbatch.NewForConfigOrDie(c)
clientset.ExtensionsClient = internalversionextensions.NewForConfigOrDie(c) cs.ExtensionsClient = internalversionextensions.NewForConfigOrDie(c)
clientset.FederationClient = internalversionfederation.NewForConfigOrDie(c) cs.FederationClient = internalversionfederation.NewForConfigOrDie(c)
clientset.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c) cs.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c)
return &clientset return &cs
} }
// New creates a new Clientset for the given RESTClient. // New creates a new Clientset for the given RESTClient.
func New(c restclient.Interface) *Clientset { func New(c restclient.Interface) *Clientset {
var clientset Clientset var cs Clientset
clientset.CoreClient = internalversioncore.New(c) cs.CoreClient = internalversioncore.New(c)
clientset.BatchClient = internalversionbatch.New(c) cs.BatchClient = internalversionbatch.New(c)
clientset.ExtensionsClient = internalversionextensions.New(c) cs.ExtensionsClient = internalversionextensions.New(c)
clientset.FederationClient = internalversionfederation.New(c) cs.FederationClient = internalversionfederation.New(c)
clientset.DiscoveryClient = discovery.NewDiscoveryClient(c) cs.DiscoveryClient = discovery.NewDiscoveryClient(c)
return &clientset return &cs
} }
...@@ -1198,12 +1198,6 @@ __EOF__ ...@@ -1198,12 +1198,6 @@ __EOF__
# Pre-Condition: no Job exists # Pre-Condition: no Job exists
kube::test::get_object_assert jobs "{{range.items}}{{$id_field}}:{{end}}" '' kube::test::get_object_assert jobs "{{range.items}}{{$id_field}}:{{end}}" ''
# Command # Command
kubectl run pi --generator=job/v1beta1 "--image=$IMAGE_PERL" --restart=OnFailure -- perl -Mbignum=bpi -wle 'print bpi(20)' "${kube_flags[@]}"
# Post-Condition: Job "pi" is created
kube::test::get_object_assert jobs "{{range.items}}{{$id_field}}:{{end}}" 'pi:'
# Clean up
kubectl delete jobs pi "${kube_flags[@]}"
# Command
kubectl run pi --generator=job/v1 "--image=$IMAGE_PERL" --restart=OnFailure -- perl -Mbignum=bpi -wle 'print bpi(20)' "${kube_flags[@]}" kubectl run pi --generator=job/v1 "--image=$IMAGE_PERL" --restart=OnFailure -- perl -Mbignum=bpi -wle 'print bpi(20)' "${kube_flags[@]}"
# Post-Condition: Job "pi" is created # Post-Condition: Job "pi" is created
kube::test::get_object_assert jobs "{{range.items}}{{$id_field}}:{{end}}" 'pi:' kube::test::get_object_assert jobs "{{range.items}}{{$id_field}}:{{end}}" 'pi:'
......
...@@ -109,16 +109,14 @@ echo "${ETCD_VERSION}/${STORAGE_BACKEND_ETCD2}" > "${ETCD_DIR}/version.txt" ...@@ -109,16 +109,14 @@ echo "${ETCD_VERSION}/${STORAGE_BACKEND_ETCD2}" > "${ETCD_DIR}/version.txt"
# source_file,resource,namespace,name,old_version,new_version # source_file,resource,namespace,name,old_version,new_version
tests=( tests=(
test/fixtures/doc-yaml/user-guide/job.yaml,jobs,default,pi,extensions/v1beta1,batch/v1
test/fixtures/doc-yaml/user-guide/horizontal-pod-autoscaling/hpa-php-apache.yaml,horizontalpodautoscalers,default,php-apache,extensions/v1beta1,autoscaling/v1 test/fixtures/doc-yaml/user-guide/horizontal-pod-autoscaling/hpa-php-apache.yaml,horizontalpodautoscalers,default,php-apache,extensions/v1beta1,autoscaling/v1
) )
# need to include extensions/v1beta1 in new api version because its internal types are used by jobs # need to include extensions/v1beta1 in new api version because its internal types are used by hpas
# and hpas
KUBE_OLD_API_VERSION="v1,extensions/v1beta1" KUBE_OLD_API_VERSION="v1,extensions/v1beta1"
KUBE_NEW_API_VERSION="v1,extensions/v1beta1,batch/v1,autoscaling/v1" KUBE_NEW_API_VERSION="v1,extensions/v1beta1,autoscaling/v1"
KUBE_OLD_STORAGE_VERSIONS="batch=extensions/v1beta1,autoscaling=extensions/v1beta1" KUBE_OLD_STORAGE_VERSIONS="autoscaling=extensions/v1beta1"
KUBE_NEW_STORAGE_VERSIONS="batch/v1,autoscaling/v1" KUBE_NEW_STORAGE_VERSIONS="autoscaling/v1"
### END TEST DEFINITION CUSTOMIZATION ### ### END TEST DEFINITION CUSTOMIZATION ###
......
...@@ -104,8 +104,6 @@ func TestDefaulting(t *testing.T) { ...@@ -104,8 +104,6 @@ func TestDefaulting(t *testing.T) {
{Group: "extensions", Version: "v1beta1", Kind: "DeploymentList"}: {}, {Group: "extensions", Version: "v1beta1", Kind: "DeploymentList"}: {},
{Group: "extensions", Version: "v1beta1", Kind: "HorizontalPodAutoscaler"}: {}, {Group: "extensions", Version: "v1beta1", Kind: "HorizontalPodAutoscaler"}: {},
{Group: "extensions", Version: "v1beta1", Kind: "HorizontalPodAutoscalerList"}: {}, {Group: "extensions", Version: "v1beta1", Kind: "HorizontalPodAutoscalerList"}: {},
{Group: "extensions", Version: "v1beta1", Kind: "Job"}: {},
{Group: "extensions", Version: "v1beta1", Kind: "JobList"}: {},
{Group: "extensions", Version: "v1beta1", Kind: "ReplicaSet"}: {}, {Group: "extensions", Version: "v1beta1", Kind: "ReplicaSet"}: {},
{Group: "extensions", Version: "v1beta1", Kind: "ReplicaSetList"}: {}, {Group: "extensions", Version: "v1beta1", Kind: "ReplicaSetList"}: {},
{Group: "rbac.authorization.k8s.io", Version: "v1alpha1", Kind: "ClusterRoleBinding"}: {}, {Group: "rbac.authorization.k8s.io", Version: "v1alpha1", Kind: "ClusterRoleBinding"}: {},
......
...@@ -22,7 +22,6 @@ go_library( ...@@ -22,7 +22,6 @@ go_library(
"//pkg/api:go_default_library", "//pkg/api:go_default_library",
"//pkg/api/resource:go_default_library", "//pkg/api/resource:go_default_library",
"//pkg/apis/autoscaling:go_default_library", "//pkg/apis/autoscaling:go_default_library",
"//pkg/apis/batch:go_default_library",
"//pkg/apis/meta/v1:go_default_library", "//pkg/apis/meta/v1:go_default_library",
"//pkg/conversion:go_default_library", "//pkg/conversion:go_default_library",
"//pkg/runtime:go_default_library", "//pkg/runtime:go_default_library",
......
...@@ -19,7 +19,6 @@ package extensions ...@@ -19,7 +19,6 @@ package extensions
import ( import (
"k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/apis/autoscaling" "k8s.io/kubernetes/pkg/apis/autoscaling"
"k8s.io/kubernetes/pkg/apis/batch"
metav1 "k8s.io/kubernetes/pkg/apis/meta/v1" metav1 "k8s.io/kubernetes/pkg/apis/meta/v1"
"k8s.io/kubernetes/pkg/runtime" "k8s.io/kubernetes/pkg/runtime"
"k8s.io/kubernetes/pkg/runtime/schema" "k8s.io/kubernetes/pkg/runtime/schema"
...@@ -55,9 +54,6 @@ func addKnownTypes(scheme *runtime.Scheme) error { ...@@ -55,9 +54,6 @@ func addKnownTypes(scheme *runtime.Scheme) error {
&DeploymentRollback{}, &DeploymentRollback{},
&autoscaling.HorizontalPodAutoscaler{}, &autoscaling.HorizontalPodAutoscaler{},
&autoscaling.HorizontalPodAutoscalerList{}, &autoscaling.HorizontalPodAutoscalerList{},
&batch.Job{},
&batch.JobList{},
&batch.JobTemplate{},
&ReplicationControllerDummy{}, &ReplicationControllerDummy{},
&Scale{}, &Scale{},
&ThirdPartyResource{}, &ThirdPartyResource{},
......
...@@ -29,7 +29,6 @@ go_library( ...@@ -29,7 +29,6 @@ go_library(
"//pkg/api/resource:go_default_library", "//pkg/api/resource:go_default_library",
"//pkg/api/v1:go_default_library", "//pkg/api/v1:go_default_library",
"//pkg/apis/autoscaling:go_default_library", "//pkg/apis/autoscaling:go_default_library",
"//pkg/apis/batch:go_default_library",
"//pkg/apis/extensions:go_default_library", "//pkg/apis/extensions:go_default_library",
"//pkg/apis/meta/v1:go_default_library", "//pkg/apis/meta/v1:go_default_library",
"//pkg/conversion:go_default_library", "//pkg/conversion:go_default_library",
...@@ -46,17 +45,13 @@ go_library( ...@@ -46,17 +45,13 @@ go_library(
go_test( go_test(
name = "go_default_xtest", name = "go_default_xtest",
srcs = [ srcs = ["defaults_test.go"],
"conversion_test.go",
"defaults_test.go",
],
tags = ["automanaged"], tags = ["automanaged"],
deps = [ deps = [
"//pkg/api:go_default_library", "//pkg/api:go_default_library",
"//pkg/api/install:go_default_library", "//pkg/api/install:go_default_library",
"//pkg/api/resource:go_default_library", "//pkg/api/resource:go_default_library",
"//pkg/api/v1:go_default_library", "//pkg/api/v1:go_default_library",
"//pkg/apis/batch:go_default_library",
"//pkg/apis/extensions/install:go_default_library", "//pkg/apis/extensions/install:go_default_library",
"//pkg/apis/extensions/v1beta1:go_default_library", "//pkg/apis/extensions/v1beta1:go_default_library",
"//pkg/apis/meta/v1:go_default_library", "//pkg/apis/meta/v1:go_default_library",
......
...@@ -22,7 +22,6 @@ import ( ...@@ -22,7 +22,6 @@ import (
"k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api"
v1 "k8s.io/kubernetes/pkg/api/v1" v1 "k8s.io/kubernetes/pkg/api/v1"
"k8s.io/kubernetes/pkg/apis/autoscaling" "k8s.io/kubernetes/pkg/apis/autoscaling"
"k8s.io/kubernetes/pkg/apis/batch"
"k8s.io/kubernetes/pkg/apis/extensions" "k8s.io/kubernetes/pkg/apis/extensions"
metav1 "k8s.io/kubernetes/pkg/apis/meta/v1" metav1 "k8s.io/kubernetes/pkg/apis/meta/v1"
"k8s.io/kubernetes/pkg/conversion" "k8s.io/kubernetes/pkg/conversion"
...@@ -48,9 +47,6 @@ func addConversionFuncs(scheme *runtime.Scheme) error { ...@@ -48,9 +47,6 @@ func addConversionFuncs(scheme *runtime.Scheme) error {
Convert_v1beta1_SubresourceReference_To_autoscaling_CrossVersionObjectReference, Convert_v1beta1_SubresourceReference_To_autoscaling_CrossVersionObjectReference,
Convert_autoscaling_HorizontalPodAutoscalerSpec_To_v1beta1_HorizontalPodAutoscalerSpec, Convert_autoscaling_HorizontalPodAutoscalerSpec_To_v1beta1_HorizontalPodAutoscalerSpec,
Convert_v1beta1_HorizontalPodAutoscalerSpec_To_autoscaling_HorizontalPodAutoscalerSpec, Convert_v1beta1_HorizontalPodAutoscalerSpec_To_autoscaling_HorizontalPodAutoscalerSpec,
// batch
Convert_batch_JobSpec_To_v1beta1_JobSpec,
Convert_v1beta1_JobSpec_To_batch_JobSpec,
) )
if err != nil { if err != nil {
return err return err
...@@ -74,16 +70,7 @@ func addConversionFuncs(scheme *runtime.Scheme) error { ...@@ -74,16 +70,7 @@ func addConversionFuncs(scheme *runtime.Scheme) error {
} }
} }
return api.Scheme.AddFieldLabelConversionFunc("extensions/v1beta1", "Job", return nil
func(label, value string) (string, string, error) {
switch label {
case "metadata.name", "metadata.namespace", "status.successful":
return label, value, nil
default:
return "", "", fmt.Errorf("field label not supported: %s", label)
}
},
)
} }
func Convert_extensions_ScaleStatus_To_v1beta1_ScaleStatus(in *extensions.ScaleStatus, out *ScaleStatus, s conversion.Scope) error { func Convert_extensions_ScaleStatus_To_v1beta1_ScaleStatus(in *extensions.ScaleStatus, out *ScaleStatus, s conversion.Scope) error {
...@@ -262,56 +249,6 @@ func Convert_v1beta1_ReplicaSetSpec_To_extensions_ReplicaSetSpec(in *ReplicaSetS ...@@ -262,56 +249,6 @@ func Convert_v1beta1_ReplicaSetSpec_To_extensions_ReplicaSetSpec(in *ReplicaSetS
return nil return nil
} }
func Convert_batch_JobSpec_To_v1beta1_JobSpec(in *batch.JobSpec, out *JobSpec, s conversion.Scope) error {
out.Parallelism = in.Parallelism
out.Completions = in.Completions
out.ActiveDeadlineSeconds = in.ActiveDeadlineSeconds
out.Selector = in.Selector
// BEGIN non-standard conversion
// autoSelector has opposite meaning as manualSelector.
// in both cases, unset means false, and unset is always preferred to false.
// unset vs set-false distinction is not preserved.
manualSelector := in.ManualSelector != nil && *in.ManualSelector
autoSelector := !manualSelector
if autoSelector {
out.AutoSelector = new(bool)
*out.AutoSelector = true
} else {
out.AutoSelector = nil
}
// END non-standard conversion
if err := v1.Convert_api_PodTemplateSpec_To_v1_PodTemplateSpec(&in.Template, &out.Template, s); err != nil {
return err
}
return nil
}
func Convert_v1beta1_JobSpec_To_batch_JobSpec(in *JobSpec, out *batch.JobSpec, s conversion.Scope) error {
out.Parallelism = in.Parallelism
out.Completions = in.Completions
out.ActiveDeadlineSeconds = in.ActiveDeadlineSeconds
out.Selector = in.Selector
// BEGIN non-standard conversion
// autoSelector has opposite meaning as manualSelector.
// in both cases, unset means false, and unset is always preferred to false.
// unset vs set-false distinction is not preserved.
autoSelector := bool(in.AutoSelector != nil && *in.AutoSelector)
manualSelector := !autoSelector
if manualSelector {
out.ManualSelector = new(bool)
*out.ManualSelector = true
} else {
out.ManualSelector = nil
}
// END non-standard conversion
if err := v1.Convert_v1_PodTemplateSpec_To_api_PodTemplateSpec(&in.Template, &out.Template, s); err != nil {
return err
}
return nil
}
func Convert_autoscaling_CrossVersionObjectReference_To_v1beta1_SubresourceReference(in *autoscaling.CrossVersionObjectReference, out *SubresourceReference, s conversion.Scope) error { func Convert_autoscaling_CrossVersionObjectReference_To_v1beta1_SubresourceReference(in *autoscaling.CrossVersionObjectReference, out *SubresourceReference, s conversion.Scope) error {
out.Kind = in.Kind out.Kind = in.Kind
out.Name = in.Name out.Name = in.Name
......
/*
Copyright 2016 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 v1beta1_test
import (
"reflect"
"testing"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/apis/batch"
versioned "k8s.io/kubernetes/pkg/apis/extensions/v1beta1"
)
// TestJobSpecConversion tests that ManualSelector and AutoSelector
// are handled correctly.
func TestJobSpecConversion(t *testing.T) {
pTrue := new(bool)
*pTrue = true
pFalse := new(bool)
*pFalse = false
// False or nil convert to true.
// True converts to nil.
tests := []struct {
in *bool
expectOut *bool
}{
{
in: nil,
expectOut: pTrue,
},
{
in: pFalse,
expectOut: pTrue,
},
{
in: pTrue,
expectOut: nil,
},
}
// Test internal -> v1beta1.
for _, test := range tests {
i := &batch.JobSpec{
ManualSelector: test.in,
}
v := versioned.JobSpec{}
if err := api.Scheme.Convert(i, &v, nil); err != nil {
t.Fatalf("unexpected error: %v", err)
}
if !reflect.DeepEqual(test.expectOut, v.AutoSelector) {
t.Fatalf("want v1beta1.AutoSelector %v, got %v", test.expectOut, v.AutoSelector)
}
}
// Test v1beta1 -> internal.
for _, test := range tests {
i := &versioned.JobSpec{
AutoSelector: test.in,
}
e := batch.JobSpec{}
if err := api.Scheme.Convert(i, &e, nil); err != nil {
t.Fatalf("unexpected error: %v", err)
}
if !reflect.DeepEqual(test.expectOut, e.ManualSelector) {
t.Fatalf("want extensions.ManualSelector %v, got %v", test.expectOut, e.ManualSelector)
}
}
}
...@@ -28,7 +28,6 @@ func addDefaultingFuncs(scheme *runtime.Scheme) error { ...@@ -28,7 +28,6 @@ func addDefaultingFuncs(scheme *runtime.Scheme) error {
return scheme.AddDefaultingFuncs( return scheme.AddDefaultingFuncs(
SetDefaults_DaemonSet, SetDefaults_DaemonSet,
SetDefaults_Deployment, SetDefaults_Deployment,
SetDefaults_Job,
SetDefaults_HorizontalPodAutoscaler, SetDefaults_HorizontalPodAutoscaler,
SetDefaults_ReplicaSet, SetDefaults_ReplicaSet,
SetDefaults_NetworkPolicy, SetDefaults_NetworkPolicy,
...@@ -91,40 +90,6 @@ func SetDefaults_Deployment(obj *Deployment) { ...@@ -91,40 +90,6 @@ func SetDefaults_Deployment(obj *Deployment) {
} }
} }
func SetDefaults_Job(obj *Job) {
labels := obj.Spec.Template.Labels
// TODO: support templates defined elsewhere when we support them in the API
if labels != nil {
// if an autoselector is requested, we'll build the selector later with controller-uid and job-name
autoSelector := bool(obj.Spec.AutoSelector != nil && *obj.Spec.AutoSelector)
// otherwise, we are using a manual selector
manualSelector := !autoSelector
// and default behavior for an unspecified manual selector is to use the pod template labels
if manualSelector && obj.Spec.Selector == nil {
obj.Spec.Selector = &metav1.LabelSelector{
MatchLabels: labels,
}
}
if len(obj.Labels) == 0 {
obj.Labels = labels
}
}
// For a non-parallel job, you can leave both `.spec.completions` and
// `.spec.parallelism` unset. When both are unset, both are defaulted to 1.
if obj.Spec.Completions == nil && obj.Spec.Parallelism == nil {
obj.Spec.Completions = new(int32)
*obj.Spec.Completions = 1
obj.Spec.Parallelism = new(int32)
*obj.Spec.Parallelism = 1
}
if obj.Spec.Parallelism == nil {
obj.Spec.Parallelism = new(int32)
*obj.Spec.Parallelism = 1
}
}
func SetDefaults_HorizontalPodAutoscaler(obj *HorizontalPodAutoscaler) { func SetDefaults_HorizontalPodAutoscaler(obj *HorizontalPodAutoscaler) {
if obj.Spec.MinReplicas == nil { if obj.Spec.MinReplicas == nil {
minReplicas := int32(1) minReplicas := int32(1)
......
...@@ -286,278 +286,6 @@ func TestSetDefaultDeployment(t *testing.T) { ...@@ -286,278 +286,6 @@ func TestSetDefaultDeployment(t *testing.T) {
} }
} }
func TestSetDefaultJob(t *testing.T) {
defaultLabels := map[string]string{"default": "default"}
tests := map[string]struct {
original *Job
expected *Job
expectLabels bool
}{
"both unspecified -> sets both to 1": {
original: &Job{
Spec: JobSpec{
Template: v1.PodTemplateSpec{
ObjectMeta: v1.ObjectMeta{Labels: defaultLabels},
},
},
},
expected: &Job{
Spec: JobSpec{
Completions: newInt32(1),
Parallelism: newInt32(1),
},
},
expectLabels: true,
},
"both unspecified -> sets both to 1 and no default labels": {
original: &Job{
ObjectMeta: v1.ObjectMeta{
Labels: map[string]string{"mylabel": "myvalue"},
},
Spec: JobSpec{
Template: v1.PodTemplateSpec{
ObjectMeta: v1.ObjectMeta{Labels: defaultLabels},
},
},
},
expected: &Job{
Spec: JobSpec{
Completions: newInt32(1),
Parallelism: newInt32(1),
},
},
},
"WQ: Parallelism explicitly 0 and completions unset -> no change": {
original: &Job{
Spec: JobSpec{
Parallelism: newInt32(0),
Template: v1.PodTemplateSpec{
ObjectMeta: v1.ObjectMeta{Labels: defaultLabels},
},
},
},
expected: &Job{
Spec: JobSpec{
Parallelism: newInt32(0),
},
},
expectLabels: true,
},
"WQ: Parallelism explicitly 2 and completions unset -> no change": {
original: &Job{
Spec: JobSpec{
Parallelism: newInt32(2),
Template: v1.PodTemplateSpec{
ObjectMeta: v1.ObjectMeta{Labels: defaultLabels},
},
},
},
expected: &Job{
Spec: JobSpec{
Parallelism: newInt32(2),
},
},
expectLabels: true,
},
"Completions explicitly 2 and parallelism unset -> parallelism is defaulted": {
original: &Job{
Spec: JobSpec{
Completions: newInt32(2),
Template: v1.PodTemplateSpec{
ObjectMeta: v1.ObjectMeta{Labels: defaultLabels},
},
},
},
expected: &Job{
Spec: JobSpec{
Completions: newInt32(2),
Parallelism: newInt32(1),
},
},
expectLabels: true,
},
"Both set -> no change": {
original: &Job{
Spec: JobSpec{
Completions: newInt32(10),
Parallelism: newInt32(11),
Template: v1.PodTemplateSpec{
ObjectMeta: v1.ObjectMeta{Labels: defaultLabels},
},
},
},
expected: &Job{
Spec: JobSpec{
Completions: newInt32(10),
Parallelism: newInt32(11),
Template: v1.PodTemplateSpec{
ObjectMeta: v1.ObjectMeta{Labels: defaultLabels},
},
},
},
expectLabels: true,
},
"Both set, flipped -> no change": {
original: &Job{
Spec: JobSpec{
Completions: newInt32(11),
Parallelism: newInt32(10),
Template: v1.PodTemplateSpec{
ObjectMeta: v1.ObjectMeta{Labels: defaultLabels},
},
},
},
expected: &Job{
Spec: JobSpec{
Completions: newInt32(11),
Parallelism: newInt32(10),
},
},
expectLabels: true,
},
}
for name, test := range tests {
original := test.original
expected := test.expected
obj2 := roundTrip(t, runtime.Object(original))
actual, ok := obj2.(*Job)
if !ok {
t.Errorf("%s: unexpected object: %v", name, actual)
t.FailNow()
}
if (actual.Spec.Completions == nil) != (expected.Spec.Completions == nil) {
t.Errorf("%s: got different *completions than expected: %v %v", name, actual.Spec.Completions, expected.Spec.Completions)
}
if actual.Spec.Completions != nil && expected.Spec.Completions != nil {
if *actual.Spec.Completions != *expected.Spec.Completions {
t.Errorf("%s: got different completions than expected: %d %d", name, *actual.Spec.Completions, *expected.Spec.Completions)
}
}
if (actual.Spec.Parallelism == nil) != (expected.Spec.Parallelism == nil) {
t.Errorf("%s: got different *Parallelism than expected: %v %v", name, actual.Spec.Parallelism, expected.Spec.Parallelism)
}
if actual.Spec.Parallelism != nil && expected.Spec.Parallelism != nil {
if *actual.Spec.Parallelism != *expected.Spec.Parallelism {
t.Errorf("%s: got different parallelism than expected: %d %d", name, *actual.Spec.Parallelism, *expected.Spec.Parallelism)
}
}
if test.expectLabels != reflect.DeepEqual(actual.Labels, actual.Spec.Template.Labels) {
if test.expectLabels {
t.Errorf("%s: expected: %v, got: %v", name, actual.Spec.Template.Labels, actual.Labels)
} else {
t.Errorf("%s: unexpected equality: %v", name, actual.Labels)
}
}
}
}
func TestSetDefaultJobSelector(t *testing.T) {
tests := []struct {
original *Job
expectedSelector *metav1.LabelSelector
}{
// selector set explicitly, nil autoSelector
{
original: &Job{
Spec: JobSpec{
Selector: &metav1.LabelSelector{
MatchLabels: map[string]string{"job": "selector"},
},
},
},
expectedSelector: &metav1.LabelSelector{
MatchLabels: map[string]string{"job": "selector"},
},
},
// selector set explicitly, autoSelector=true
{
original: &Job{
Spec: JobSpec{
Selector: &metav1.LabelSelector{
MatchLabels: map[string]string{"job": "selector"},
},
AutoSelector: newBool(true),
},
},
expectedSelector: &metav1.LabelSelector{
MatchLabels: map[string]string{"job": "selector"},
},
},
// selector set explicitly, autoSelector=false
{
original: &Job{
Spec: JobSpec{
Selector: &metav1.LabelSelector{
MatchLabels: map[string]string{"job": "selector"},
},
AutoSelector: newBool(false),
},
},
expectedSelector: &metav1.LabelSelector{
MatchLabels: map[string]string{"job": "selector"},
},
},
// selector from template labels
{
original: &Job{
Spec: JobSpec{
Template: v1.PodTemplateSpec{
ObjectMeta: v1.ObjectMeta{
Labels: map[string]string{"job": "selector"},
},
},
},
},
expectedSelector: &metav1.LabelSelector{
MatchLabels: map[string]string{"job": "selector"},
},
},
// selector from template labels, autoSelector=false
{
original: &Job{
Spec: JobSpec{
Template: v1.PodTemplateSpec{
ObjectMeta: v1.ObjectMeta{
Labels: map[string]string{"job": "selector"},
},
},
AutoSelector: newBool(false),
},
},
expectedSelector: &metav1.LabelSelector{
MatchLabels: map[string]string{"job": "selector"},
},
},
// selector not copied from template labels, autoSelector=true
{
original: &Job{
Spec: JobSpec{
Template: v1.PodTemplateSpec{
ObjectMeta: v1.ObjectMeta{
Labels: map[string]string{"job": "selector"},
},
},
AutoSelector: newBool(true),
},
},
expectedSelector: nil,
},
}
for i, testcase := range tests {
obj2 := roundTrip(t, runtime.Object(testcase.original))
got, ok := obj2.(*Job)
if !ok {
t.Errorf("%d: unexpected object: %v", i, got)
t.FailNow()
}
if !reflect.DeepEqual(got.Spec.Selector, testcase.expectedSelector) {
t.Errorf("%d: got different selectors %#v %#v", i, got.Spec.Selector, testcase.expectedSelector)
}
}
}
func TestSetDefaultReplicaSet(t *testing.T) { func TestSetDefaultReplicaSet(t *testing.T) {
tests := []struct { tests := []struct {
rs *ReplicaSet rs *ReplicaSet
......
...@@ -541,138 +541,6 @@ message IngressTLS { ...@@ -541,138 +541,6 @@ message IngressTLS {
optional string secretName = 2; optional string secretName = 2;
} }
// Job represents the configuration of a single job.
// DEPRECATED: extensions/v1beta1.Job is deprecated, use batch/v1.Job instead.
message Job {
// Standard object's metadata.
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
// +optional
optional k8s.io.kubernetes.pkg.api.v1.ObjectMeta metadata = 1;
// Spec is a structure defining the expected behavior of a job.
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#spec-and-status
// +optional
optional JobSpec spec = 2;
// Status is a structure describing current status of a job.
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#spec-and-status
// +optional
optional JobStatus status = 3;
}
// JobCondition describes current state of a job.
message JobCondition {
// Type of job condition, Complete or Failed.
optional string type = 1;
// Status of the condition, one of True, False, Unknown.
optional string status = 2;
// Last time the condition was checked.
// +optional
optional k8s.io.kubernetes.pkg.apis.meta.v1.Time lastProbeTime = 3;
// Last time the condition transit from one status to another.
// +optional
optional k8s.io.kubernetes.pkg.apis.meta.v1.Time lastTransitionTime = 4;
// (brief) reason for the condition's last transition.
// +optional
optional string reason = 5;
// Human readable message indicating details about last transition.
// +optional
optional string message = 6;
}
// JobList is a collection of jobs.
// DEPRECATED: extensions/v1beta1.JobList is deprecated, use batch/v1.JobList instead.
message JobList {
// Standard list metadata
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
// +optional
optional k8s.io.kubernetes.pkg.apis.meta.v1.ListMeta metadata = 1;
// Items is the list of Job.
repeated Job items = 2;
}
// JobSpec describes how the job execution will look like.
message JobSpec {
// Parallelism specifies the maximum desired number of pods the job should
// run at any given time. The actual number of pods running in steady state will
// be less than this number when ((.spec.completions - .status.successful) < .spec.parallelism),
// i.e. when the work left to do is less than max parallelism.
// More info: http://kubernetes.io/docs/user-guide/jobs
// +optional
optional int32 parallelism = 1;
// Completions specifies the desired number of successfully finished pods the
// job should be run with. Setting to nil means that the success of any
// pod signals the success of all pods, and allows parallelism to have any positive
// value. Setting to 1 means that parallelism is limited to 1 and the success of that
// pod signals the success of the job.
// More info: http://kubernetes.io/docs/user-guide/jobs
// +optional
optional int32 completions = 2;
// Optional duration in seconds relative to the startTime that the job may be active
// before the system tries to terminate it; value must be positive integer
// +optional
optional int64 activeDeadlineSeconds = 3;
// Selector is a label query over pods that should match the pod count.
// Normally, the system sets this field for you.
// More info: http://kubernetes.io/docs/user-guide/labels#label-selectors
// +optional
optional k8s.io.kubernetes.pkg.apis.meta.v1.LabelSelector selector = 4;
// AutoSelector controls generation of pod labels and pod selectors.
// It was not present in the original extensions/v1beta1 Job definition, but exists
// to allow conversion from batch/v1 Jobs, where it corresponds to, but has the opposite
// meaning as, ManualSelector.
// More info: http://releases.k8s.io/HEAD/docs/design/selector-generation.md
// +optional
optional bool autoSelector = 5;
// Template is the object that describes the pod that will be created when
// executing a job.
// More info: http://kubernetes.io/docs/user-guide/jobs
optional k8s.io.kubernetes.pkg.api.v1.PodTemplateSpec template = 6;
}
// JobStatus represents the current state of a Job.
message JobStatus {
// Conditions represent the latest available observations of an object's current state.
// More info: http://kubernetes.io/docs/user-guide/jobs
// +optional
repeated JobCondition conditions = 1;
// StartTime represents time when the job was acknowledged by the Job Manager.
// It is not guaranteed to be set in happens-before order across separate operations.
// It is represented in RFC3339 form and is in UTC.
// +optional
optional k8s.io.kubernetes.pkg.apis.meta.v1.Time startTime = 2;
// CompletionTime represents time when the job was completed. It is not guaranteed to
// be set in happens-before order across separate operations.
// It is represented in RFC3339 form and is in UTC.
// +optional
optional k8s.io.kubernetes.pkg.apis.meta.v1.Time completionTime = 3;
// Active is the number of actively running pods.
// +optional
optional int32 active = 4;
// Succeeded is the number of pods which reached Phase Succeeded.
// +optional
optional int32 succeeded = 5;
// Failed is the number of pods which reached Phase Failed.
// +optional
optional int32 failed = 6;
}
message NetworkPolicy { message NetworkPolicy {
// Standard object's metadata. // Standard object's metadata.
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata // More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
......
...@@ -48,8 +48,6 @@ func addKnownTypes(scheme *runtime.Scheme) error { ...@@ -48,8 +48,6 @@ func addKnownTypes(scheme *runtime.Scheme) error {
&DeploymentRollback{}, &DeploymentRollback{},
&HorizontalPodAutoscaler{}, &HorizontalPodAutoscaler{},
&HorizontalPodAutoscalerList{}, &HorizontalPodAutoscalerList{},
&Job{},
&JobList{},
&ReplicationControllerDummy{}, &ReplicationControllerDummy{},
&Scale{}, &Scale{},
&ThirdPartyResource{}, &ThirdPartyResource{},
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -616,149 +616,6 @@ type ThirdPartyResourceDataList struct { ...@@ -616,149 +616,6 @@ type ThirdPartyResourceDataList struct {
// +genclient=true // +genclient=true
// Job represents the configuration of a single job.
// DEPRECATED: extensions/v1beta1.Job is deprecated, use batch/v1.Job instead.
type Job struct {
metav1.TypeMeta `json:",inline"`
// Standard object's metadata.
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
// +optional
v1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
// Spec is a structure defining the expected behavior of a job.
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#spec-and-status
// +optional
Spec JobSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"`
// Status is a structure describing current status of a job.
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#spec-and-status
// +optional
Status JobStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"`
}
// JobList is a collection of jobs.
// DEPRECATED: extensions/v1beta1.JobList is deprecated, use batch/v1.JobList instead.
type JobList struct {
metav1.TypeMeta `json:",inline"`
// Standard list metadata
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
// +optional
metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
// Items is the list of Job.
Items []Job `json:"items" protobuf:"bytes,2,rep,name=items"`
}
// JobSpec describes how the job execution will look like.
type JobSpec struct {
// Parallelism specifies the maximum desired number of pods the job should
// run at any given time. The actual number of pods running in steady state will
// be less than this number when ((.spec.completions - .status.successful) < .spec.parallelism),
// i.e. when the work left to do is less than max parallelism.
// More info: http://kubernetes.io/docs/user-guide/jobs
// +optional
Parallelism *int32 `json:"parallelism,omitempty" protobuf:"varint,1,opt,name=parallelism"`
// Completions specifies the desired number of successfully finished pods the
// job should be run with. Setting to nil means that the success of any
// pod signals the success of all pods, and allows parallelism to have any positive
// value. Setting to 1 means that parallelism is limited to 1 and the success of that
// pod signals the success of the job.
// More info: http://kubernetes.io/docs/user-guide/jobs
// +optional
Completions *int32 `json:"completions,omitempty" protobuf:"varint,2,opt,name=completions"`
// Optional duration in seconds relative to the startTime that the job may be active
// before the system tries to terminate it; value must be positive integer
// +optional
ActiveDeadlineSeconds *int64 `json:"activeDeadlineSeconds,omitempty" protobuf:"varint,3,opt,name=activeDeadlineSeconds"`
// Selector is a label query over pods that should match the pod count.
// Normally, the system sets this field for you.
// More info: http://kubernetes.io/docs/user-guide/labels#label-selectors
// +optional
Selector *metav1.LabelSelector `json:"selector,omitempty" protobuf:"bytes,4,opt,name=selector"`
// AutoSelector controls generation of pod labels and pod selectors.
// It was not present in the original extensions/v1beta1 Job definition, but exists
// to allow conversion from batch/v1 Jobs, where it corresponds to, but has the opposite
// meaning as, ManualSelector.
// More info: http://releases.k8s.io/HEAD/docs/design/selector-generation.md
// +optional
AutoSelector *bool `json:"autoSelector,omitempty" protobuf:"varint,5,opt,name=autoSelector"`
// Template is the object that describes the pod that will be created when
// executing a job.
// More info: http://kubernetes.io/docs/user-guide/jobs
Template v1.PodTemplateSpec `json:"template" protobuf:"bytes,6,opt,name=template"`
}
// JobStatus represents the current state of a Job.
type JobStatus struct {
// Conditions represent the latest available observations of an object's current state.
// More info: http://kubernetes.io/docs/user-guide/jobs
// +optional
Conditions []JobCondition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,1,rep,name=conditions"`
// StartTime represents time when the job was acknowledged by the Job Manager.
// It is not guaranteed to be set in happens-before order across separate operations.
// It is represented in RFC3339 form and is in UTC.
// +optional
StartTime *metav1.Time `json:"startTime,omitempty" protobuf:"bytes,2,opt,name=startTime"`
// CompletionTime represents time when the job was completed. It is not guaranteed to
// be set in happens-before order across separate operations.
// It is represented in RFC3339 form and is in UTC.
// +optional
CompletionTime *metav1.Time `json:"completionTime,omitempty" protobuf:"bytes,3,opt,name=completionTime"`
// Active is the number of actively running pods.
// +optional
Active int32 `json:"active,omitempty" protobuf:"varint,4,opt,name=active"`
// Succeeded is the number of pods which reached Phase Succeeded.
// +optional
Succeeded int32 `json:"succeeded,omitempty" protobuf:"varint,5,opt,name=succeeded"`
// Failed is the number of pods which reached Phase Failed.
// +optional
Failed int32 `json:"failed,omitempty" protobuf:"varint,6,opt,name=failed"`
}
type JobConditionType string
// These are valid conditions of a job.
const (
// JobComplete means the job has completed its execution.
JobComplete JobConditionType = "Complete"
// JobFailed means the job has failed its execution.
JobFailed JobConditionType = "Failed"
)
// JobCondition describes current state of a job.
type JobCondition struct {
// Type of job condition, Complete or Failed.
Type JobConditionType `json:"type" protobuf:"bytes,1,opt,name=type,casttype=JobConditionType"`
// Status of the condition, one of True, False, Unknown.
Status v1.ConditionStatus `json:"status" protobuf:"bytes,2,opt,name=status,casttype=k8s.io/kubernetes/pkg/api/v1.ConditionStatus"`
// Last time the condition was checked.
// +optional
LastProbeTime metav1.Time `json:"lastProbeTime,omitempty" protobuf:"bytes,3,opt,name=lastProbeTime"`
// Last time the condition transit from one status to another.
// +optional
LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty" protobuf:"bytes,4,opt,name=lastTransitionTime"`
// (brief) reason for the condition's last transition.
// +optional
Reason string `json:"reason,omitempty" protobuf:"bytes,5,opt,name=reason"`
// Human readable message indicating details about last transition.
// +optional
Message string `json:"message,omitempty" protobuf:"bytes,6,opt,name=message"`
}
// +genclient=true
// Ingress is a collection of rules that allow inbound connections to reach the // Ingress is a collection of rules that allow inbound connections to reach the
// endpoints defined by a backend. An Ingress can be configured to give services // endpoints defined by a backend. An Ingress can be configured to give services
// externally-reachable urls, load balance traffic, terminate SSL, offer name // externally-reachable urls, load balance traffic, terminate SSL, offer name
......
...@@ -366,69 +366,6 @@ func (IngressTLS) SwaggerDoc() map[string]string { ...@@ -366,69 +366,6 @@ func (IngressTLS) SwaggerDoc() map[string]string {
return map_IngressTLS return map_IngressTLS
} }
var map_Job = map[string]string{
"": "Job represents the configuration of a single job. DEPRECATED: extensions/v1beta1.Job is deprecated, use batch/v1.Job instead.",
"metadata": "Standard object's metadata. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata",
"spec": "Spec is a structure defining the expected behavior of a job. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#spec-and-status",
"status": "Status is a structure describing current status of a job. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#spec-and-status",
}
func (Job) SwaggerDoc() map[string]string {
return map_Job
}
var map_JobCondition = map[string]string{
"": "JobCondition describes current state of a job.",
"type": "Type of job condition, Complete or Failed.",
"status": "Status of the condition, one of True, False, Unknown.",
"lastProbeTime": "Last time the condition was checked.",
"lastTransitionTime": "Last time the condition transit from one status to another.",
"reason": "(brief) reason for the condition's last transition.",
"message": "Human readable message indicating details about last transition.",
}
func (JobCondition) SwaggerDoc() map[string]string {
return map_JobCondition
}
var map_JobList = map[string]string{
"": "JobList is a collection of jobs. DEPRECATED: extensions/v1beta1.JobList is deprecated, use batch/v1.JobList instead.",
"metadata": "Standard list metadata More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata",
"items": "Items is the list of Job.",
}
func (JobList) SwaggerDoc() map[string]string {
return map_JobList
}
var map_JobSpec = map[string]string{
"": "JobSpec describes how the job execution will look like.",
"parallelism": "Parallelism specifies the maximum desired number of pods the job should run at any given time. The actual number of pods running in steady state will be less than this number when ((.spec.completions - .status.successful) < .spec.parallelism), i.e. when the work left to do is less than max parallelism. More info: http://kubernetes.io/docs/user-guide/jobs",
"completions": "Completions specifies the desired number of successfully finished pods the job should be run with. Setting to nil means that the success of any pod signals the success of all pods, and allows parallelism to have any positive value. Setting to 1 means that parallelism is limited to 1 and the success of that pod signals the success of the job. More info: http://kubernetes.io/docs/user-guide/jobs",
"activeDeadlineSeconds": "Optional duration in seconds relative to the startTime that the job may be active before the system tries to terminate it; value must be positive integer",
"selector": "Selector is a label query over pods that should match the pod count. Normally, the system sets this field for you. More info: http://kubernetes.io/docs/user-guide/labels#label-selectors",
"autoSelector": "AutoSelector controls generation of pod labels and pod selectors. It was not present in the original extensions/v1beta1 Job definition, but exists to allow conversion from batch/v1 Jobs, where it corresponds to, but has the opposite meaning as, ManualSelector. More info: http://releases.k8s.io/HEAD/docs/design/selector-generation.md",
"template": "Template is the object that describes the pod that will be created when executing a job. More info: http://kubernetes.io/docs/user-guide/jobs",
}
func (JobSpec) SwaggerDoc() map[string]string {
return map_JobSpec
}
var map_JobStatus = map[string]string{
"": "JobStatus represents the current state of a Job.",
"conditions": "Conditions represent the latest available observations of an object's current state. More info: http://kubernetes.io/docs/user-guide/jobs",
"startTime": "StartTime represents time when the job was acknowledged by the Job Manager. It is not guaranteed to be set in happens-before order across separate operations. It is represented in RFC3339 form and is in UTC.",
"completionTime": "CompletionTime represents time when the job was completed. It is not guaranteed to be set in happens-before order across separate operations. It is represented in RFC3339 form and is in UTC.",
"active": "Active is the number of actively running pods.",
"succeeded": "Succeeded is the number of pods which reached Phase Succeeded.",
"failed": "Failed is the number of pods which reached Phase Failed.",
}
func (JobStatus) SwaggerDoc() map[string]string {
return map_JobStatus
}
var map_NetworkPolicy = map[string]string{ var map_NetworkPolicy = map[string]string{
"metadata": "Standard object's metadata. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata", "metadata": "Standard object's metadata. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata",
"spec": "Specification of the desired behavior for this NetworkPolicy.", "spec": "Specification of the desired behavior for this NetworkPolicy.",
......
...@@ -24,7 +24,6 @@ import ( ...@@ -24,7 +24,6 @@ import (
api "k8s.io/kubernetes/pkg/api" api "k8s.io/kubernetes/pkg/api"
api_v1 "k8s.io/kubernetes/pkg/api/v1" api_v1 "k8s.io/kubernetes/pkg/api/v1"
autoscaling "k8s.io/kubernetes/pkg/apis/autoscaling" autoscaling "k8s.io/kubernetes/pkg/apis/autoscaling"
batch "k8s.io/kubernetes/pkg/apis/batch"
extensions "k8s.io/kubernetes/pkg/apis/extensions" extensions "k8s.io/kubernetes/pkg/apis/extensions"
v1 "k8s.io/kubernetes/pkg/apis/meta/v1" v1 "k8s.io/kubernetes/pkg/apis/meta/v1"
conversion "k8s.io/kubernetes/pkg/conversion" conversion "k8s.io/kubernetes/pkg/conversion"
...@@ -107,16 +106,6 @@ func RegisterConversions(scheme *runtime.Scheme) error { ...@@ -107,16 +106,6 @@ func RegisterConversions(scheme *runtime.Scheme) error {
Convert_extensions_IngressStatus_To_v1beta1_IngressStatus, Convert_extensions_IngressStatus_To_v1beta1_IngressStatus,
Convert_v1beta1_IngressTLS_To_extensions_IngressTLS, Convert_v1beta1_IngressTLS_To_extensions_IngressTLS,
Convert_extensions_IngressTLS_To_v1beta1_IngressTLS, Convert_extensions_IngressTLS_To_v1beta1_IngressTLS,
Convert_v1beta1_Job_To_batch_Job,
Convert_batch_Job_To_v1beta1_Job,
Convert_v1beta1_JobCondition_To_batch_JobCondition,
Convert_batch_JobCondition_To_v1beta1_JobCondition,
Convert_v1beta1_JobList_To_batch_JobList,
Convert_batch_JobList_To_v1beta1_JobList,
Convert_v1beta1_JobSpec_To_batch_JobSpec,
Convert_batch_JobSpec_To_v1beta1_JobSpec,
Convert_v1beta1_JobStatus_To_batch_JobStatus,
Convert_batch_JobStatus_To_v1beta1_JobStatus,
Convert_v1beta1_NetworkPolicy_To_extensions_NetworkPolicy, Convert_v1beta1_NetworkPolicy_To_extensions_NetworkPolicy,
Convert_extensions_NetworkPolicy_To_v1beta1_NetworkPolicy, Convert_extensions_NetworkPolicy_To_v1beta1_NetworkPolicy,
Convert_v1beta1_NetworkPolicyIngressRule_To_extensions_NetworkPolicyIngressRule, Convert_v1beta1_NetworkPolicyIngressRule_To_extensions_NetworkPolicyIngressRule,
...@@ -1020,162 +1009,6 @@ func Convert_extensions_IngressTLS_To_v1beta1_IngressTLS(in *extensions.IngressT ...@@ -1020,162 +1009,6 @@ func Convert_extensions_IngressTLS_To_v1beta1_IngressTLS(in *extensions.IngressT
return autoConvert_extensions_IngressTLS_To_v1beta1_IngressTLS(in, out, s) return autoConvert_extensions_IngressTLS_To_v1beta1_IngressTLS(in, out, s)
} }
func autoConvert_v1beta1_Job_To_batch_Job(in *Job, out *batch.Job, s conversion.Scope) error {
// TODO: Inefficient conversion - can we improve it?
if err := s.Convert(&in.ObjectMeta, &out.ObjectMeta, 0); err != nil {
return err
}
if err := Convert_v1beta1_JobSpec_To_batch_JobSpec(&in.Spec, &out.Spec, s); err != nil {
return err
}
if err := Convert_v1beta1_JobStatus_To_batch_JobStatus(&in.Status, &out.Status, s); err != nil {
return err
}
return nil
}
func Convert_v1beta1_Job_To_batch_Job(in *Job, out *batch.Job, s conversion.Scope) error {
return autoConvert_v1beta1_Job_To_batch_Job(in, out, s)
}
func autoConvert_batch_Job_To_v1beta1_Job(in *batch.Job, out *Job, s conversion.Scope) error {
// TODO: Inefficient conversion - can we improve it?
if err := s.Convert(&in.ObjectMeta, &out.ObjectMeta, 0); err != nil {
return err
}
if err := Convert_batch_JobSpec_To_v1beta1_JobSpec(&in.Spec, &out.Spec, s); err != nil {
return err
}
if err := Convert_batch_JobStatus_To_v1beta1_JobStatus(&in.Status, &out.Status, s); err != nil {
return err
}
return nil
}
func Convert_batch_Job_To_v1beta1_Job(in *batch.Job, out *Job, s conversion.Scope) error {
return autoConvert_batch_Job_To_v1beta1_Job(in, out, s)
}
func autoConvert_v1beta1_JobCondition_To_batch_JobCondition(in *JobCondition, out *batch.JobCondition, s conversion.Scope) error {
out.Type = batch.JobConditionType(in.Type)
out.Status = api.ConditionStatus(in.Status)
out.LastProbeTime = in.LastProbeTime
out.LastTransitionTime = in.LastTransitionTime
out.Reason = in.Reason
out.Message = in.Message
return nil
}
func Convert_v1beta1_JobCondition_To_batch_JobCondition(in *JobCondition, out *batch.JobCondition, s conversion.Scope) error {
return autoConvert_v1beta1_JobCondition_To_batch_JobCondition(in, out, s)
}
func autoConvert_batch_JobCondition_To_v1beta1_JobCondition(in *batch.JobCondition, out *JobCondition, s conversion.Scope) error {
out.Type = JobConditionType(in.Type)
out.Status = api_v1.ConditionStatus(in.Status)
out.LastProbeTime = in.LastProbeTime
out.LastTransitionTime = in.LastTransitionTime
out.Reason = in.Reason
out.Message = in.Message
return nil
}
func Convert_batch_JobCondition_To_v1beta1_JobCondition(in *batch.JobCondition, out *JobCondition, s conversion.Scope) error {
return autoConvert_batch_JobCondition_To_v1beta1_JobCondition(in, out, s)
}
func autoConvert_v1beta1_JobList_To_batch_JobList(in *JobList, out *batch.JobList, s conversion.Scope) error {
out.ListMeta = in.ListMeta
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]batch.Job, len(*in))
for i := range *in {
if err := Convert_v1beta1_Job_To_batch_Job(&(*in)[i], &(*out)[i], s); err != nil {
return err
}
}
} else {
out.Items = nil
}
return nil
}
func Convert_v1beta1_JobList_To_batch_JobList(in *JobList, out *batch.JobList, s conversion.Scope) error {
return autoConvert_v1beta1_JobList_To_batch_JobList(in, out, s)
}
func autoConvert_batch_JobList_To_v1beta1_JobList(in *batch.JobList, out *JobList, s conversion.Scope) error {
out.ListMeta = in.ListMeta
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]Job, len(*in))
for i := range *in {
if err := Convert_batch_Job_To_v1beta1_Job(&(*in)[i], &(*out)[i], s); err != nil {
return err
}
}
} else {
out.Items = nil
}
return nil
}
func Convert_batch_JobList_To_v1beta1_JobList(in *batch.JobList, out *JobList, s conversion.Scope) error {
return autoConvert_batch_JobList_To_v1beta1_JobList(in, out, s)
}
func autoConvert_v1beta1_JobSpec_To_batch_JobSpec(in *JobSpec, out *batch.JobSpec, s conversion.Scope) error {
out.Parallelism = (*int32)(unsafe.Pointer(in.Parallelism))
out.Completions = (*int32)(unsafe.Pointer(in.Completions))
out.ActiveDeadlineSeconds = (*int64)(unsafe.Pointer(in.ActiveDeadlineSeconds))
out.Selector = (*v1.LabelSelector)(unsafe.Pointer(in.Selector))
// WARNING: in.AutoSelector requires manual conversion: does not exist in peer-type
if err := api_v1.Convert_v1_PodTemplateSpec_To_api_PodTemplateSpec(&in.Template, &out.Template, s); err != nil {
return err
}
return nil
}
func autoConvert_batch_JobSpec_To_v1beta1_JobSpec(in *batch.JobSpec, out *JobSpec, s conversion.Scope) error {
out.Parallelism = (*int32)(unsafe.Pointer(in.Parallelism))
out.Completions = (*int32)(unsafe.Pointer(in.Completions))
out.ActiveDeadlineSeconds = (*int64)(unsafe.Pointer(in.ActiveDeadlineSeconds))
out.Selector = (*v1.LabelSelector)(unsafe.Pointer(in.Selector))
// WARNING: in.ManualSelector requires manual conversion: does not exist in peer-type
if err := api_v1.Convert_api_PodTemplateSpec_To_v1_PodTemplateSpec(&in.Template, &out.Template, s); err != nil {
return err
}
return nil
}
func autoConvert_v1beta1_JobStatus_To_batch_JobStatus(in *JobStatus, out *batch.JobStatus, s conversion.Scope) error {
out.Conditions = *(*[]batch.JobCondition)(unsafe.Pointer(&in.Conditions))
out.StartTime = (*v1.Time)(unsafe.Pointer(in.StartTime))
out.CompletionTime = (*v1.Time)(unsafe.Pointer(in.CompletionTime))
out.Active = in.Active
out.Succeeded = in.Succeeded
out.Failed = in.Failed
return nil
}
func Convert_v1beta1_JobStatus_To_batch_JobStatus(in *JobStatus, out *batch.JobStatus, s conversion.Scope) error {
return autoConvert_v1beta1_JobStatus_To_batch_JobStatus(in, out, s)
}
func autoConvert_batch_JobStatus_To_v1beta1_JobStatus(in *batch.JobStatus, out *JobStatus, s conversion.Scope) error {
out.Conditions = *(*[]JobCondition)(unsafe.Pointer(&in.Conditions))
out.StartTime = (*v1.Time)(unsafe.Pointer(in.StartTime))
out.CompletionTime = (*v1.Time)(unsafe.Pointer(in.CompletionTime))
out.Active = in.Active
out.Succeeded = in.Succeeded
out.Failed = in.Failed
return nil
}
func Convert_batch_JobStatus_To_v1beta1_JobStatus(in *batch.JobStatus, out *JobStatus, s conversion.Scope) error {
return autoConvert_batch_JobStatus_To_v1beta1_JobStatus(in, out, s)
}
func autoConvert_v1beta1_NetworkPolicy_To_extensions_NetworkPolicy(in *NetworkPolicy, out *extensions.NetworkPolicy, s conversion.Scope) error { func autoConvert_v1beta1_NetworkPolicy_To_extensions_NetworkPolicy(in *NetworkPolicy, out *extensions.NetworkPolicy, s conversion.Scope) error {
// TODO: Inefficient conversion - can we improve it? // TODO: Inefficient conversion - can we improve it?
if err := s.Convert(&in.ObjectMeta, &out.ObjectMeta, 0); err != nil { if err := s.Convert(&in.ObjectMeta, &out.ObjectMeta, 0); err != nil {
......
...@@ -71,11 +71,6 @@ func RegisterDeepCopies(scheme *runtime.Scheme) error { ...@@ -71,11 +71,6 @@ func RegisterDeepCopies(scheme *runtime.Scheme) error {
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1beta1_IngressSpec, InType: reflect.TypeOf(&IngressSpec{})}, conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1beta1_IngressSpec, InType: reflect.TypeOf(&IngressSpec{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1beta1_IngressStatus, InType: reflect.TypeOf(&IngressStatus{})}, conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1beta1_IngressStatus, InType: reflect.TypeOf(&IngressStatus{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1beta1_IngressTLS, InType: reflect.TypeOf(&IngressTLS{})}, conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1beta1_IngressTLS, InType: reflect.TypeOf(&IngressTLS{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1beta1_Job, InType: reflect.TypeOf(&Job{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1beta1_JobCondition, InType: reflect.TypeOf(&JobCondition{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1beta1_JobList, InType: reflect.TypeOf(&JobList{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1beta1_JobSpec, InType: reflect.TypeOf(&JobSpec{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1beta1_JobStatus, InType: reflect.TypeOf(&JobStatus{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1beta1_NetworkPolicy, InType: reflect.TypeOf(&NetworkPolicy{})}, conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1beta1_NetworkPolicy, InType: reflect.TypeOf(&NetworkPolicy{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1beta1_NetworkPolicyIngressRule, InType: reflect.TypeOf(&NetworkPolicyIngressRule{})}, conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1beta1_NetworkPolicyIngressRule, InType: reflect.TypeOf(&NetworkPolicyIngressRule{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1beta1_NetworkPolicyList, InType: reflect.TypeOf(&NetworkPolicyList{})}, conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1beta1_NetworkPolicyList, InType: reflect.TypeOf(&NetworkPolicyList{})},
...@@ -721,143 +716,6 @@ func DeepCopy_v1beta1_IngressTLS(in interface{}, out interface{}, c *conversion. ...@@ -721,143 +716,6 @@ func DeepCopy_v1beta1_IngressTLS(in interface{}, out interface{}, c *conversion.
} }
} }
func DeepCopy_v1beta1_Job(in interface{}, out interface{}, c *conversion.Cloner) error {
{
in := in.(*Job)
out := out.(*Job)
out.TypeMeta = in.TypeMeta
if err := v1.DeepCopy_v1_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, c); err != nil {
return err
}
if err := DeepCopy_v1beta1_JobSpec(&in.Spec, &out.Spec, c); err != nil {
return err
}
if err := DeepCopy_v1beta1_JobStatus(&in.Status, &out.Status, c); err != nil {
return err
}
return nil
}
}
func DeepCopy_v1beta1_JobCondition(in interface{}, out interface{}, c *conversion.Cloner) error {
{
in := in.(*JobCondition)
out := out.(*JobCondition)
out.Type = in.Type
out.Status = in.Status
out.LastProbeTime = in.LastProbeTime.DeepCopy()
out.LastTransitionTime = in.LastTransitionTime.DeepCopy()
out.Reason = in.Reason
out.Message = in.Message
return nil
}
}
func DeepCopy_v1beta1_JobList(in interface{}, out interface{}, c *conversion.Cloner) error {
{
in := in.(*JobList)
out := out.(*JobList)
out.TypeMeta = in.TypeMeta
out.ListMeta = in.ListMeta
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]Job, len(*in))
for i := range *in {
if err := DeepCopy_v1beta1_Job(&(*in)[i], &(*out)[i], c); err != nil {
return err
}
}
} else {
out.Items = nil
}
return nil
}
}
func DeepCopy_v1beta1_JobSpec(in interface{}, out interface{}, c *conversion.Cloner) error {
{
in := in.(*JobSpec)
out := out.(*JobSpec)
if in.Parallelism != nil {
in, out := &in.Parallelism, &out.Parallelism
*out = new(int32)
**out = **in
} else {
out.Parallelism = nil
}
if in.Completions != nil {
in, out := &in.Completions, &out.Completions
*out = new(int32)
**out = **in
} else {
out.Completions = nil
}
if in.ActiveDeadlineSeconds != nil {
in, out := &in.ActiveDeadlineSeconds, &out.ActiveDeadlineSeconds
*out = new(int64)
**out = **in
} else {
out.ActiveDeadlineSeconds = nil
}
if in.Selector != nil {
in, out := &in.Selector, &out.Selector
*out = new(meta_v1.LabelSelector)
if err := meta_v1.DeepCopy_v1_LabelSelector(*in, *out, c); err != nil {
return err
}
} else {
out.Selector = nil
}
if in.AutoSelector != nil {
in, out := &in.AutoSelector, &out.AutoSelector
*out = new(bool)
**out = **in
} else {
out.AutoSelector = nil
}
if err := v1.DeepCopy_v1_PodTemplateSpec(&in.Template, &out.Template, c); err != nil {
return err
}
return nil
}
}
func DeepCopy_v1beta1_JobStatus(in interface{}, out interface{}, c *conversion.Cloner) error {
{
in := in.(*JobStatus)
out := out.(*JobStatus)
if in.Conditions != nil {
in, out := &in.Conditions, &out.Conditions
*out = make([]JobCondition, len(*in))
for i := range *in {
if err := DeepCopy_v1beta1_JobCondition(&(*in)[i], &(*out)[i], c); err != nil {
return err
}
}
} else {
out.Conditions = nil
}
if in.StartTime != nil {
in, out := &in.StartTime, &out.StartTime
*out = new(meta_v1.Time)
**out = (*in).DeepCopy()
} else {
out.StartTime = nil
}
if in.CompletionTime != nil {
in, out := &in.CompletionTime, &out.CompletionTime
*out = new(meta_v1.Time)
**out = (*in).DeepCopy()
} else {
out.CompletionTime = nil
}
out.Active = in.Active
out.Succeeded = in.Succeeded
out.Failed = in.Failed
return nil
}
}
func DeepCopy_v1beta1_NetworkPolicy(in interface{}, out interface{}, c *conversion.Cloner) error { func DeepCopy_v1beta1_NetworkPolicy(in interface{}, out interface{}, c *conversion.Cloner) error {
{ {
in := in.(*NetworkPolicy) in := in.(*NetworkPolicy)
......
...@@ -37,8 +37,6 @@ func RegisterDefaults(scheme *runtime.Scheme) error { ...@@ -37,8 +37,6 @@ func RegisterDefaults(scheme *runtime.Scheme) error {
scheme.AddTypeDefaultingFunc(&HorizontalPodAutoscalerList{}, func(obj interface{}) { scheme.AddTypeDefaultingFunc(&HorizontalPodAutoscalerList{}, func(obj interface{}) {
SetObjectDefaults_HorizontalPodAutoscalerList(obj.(*HorizontalPodAutoscalerList)) SetObjectDefaults_HorizontalPodAutoscalerList(obj.(*HorizontalPodAutoscalerList))
}) })
scheme.AddTypeDefaultingFunc(&Job{}, func(obj interface{}) { SetObjectDefaults_Job(obj.(*Job)) })
scheme.AddTypeDefaultingFunc(&JobList{}, func(obj interface{}) { SetObjectDefaults_JobList(obj.(*JobList)) })
scheme.AddTypeDefaultingFunc(&NetworkPolicy{}, func(obj interface{}) { SetObjectDefaults_NetworkPolicy(obj.(*NetworkPolicy)) }) scheme.AddTypeDefaultingFunc(&NetworkPolicy{}, func(obj interface{}) { SetObjectDefaults_NetworkPolicy(obj.(*NetworkPolicy)) })
scheme.AddTypeDefaultingFunc(&NetworkPolicyList{}, func(obj interface{}) { SetObjectDefaults_NetworkPolicyList(obj.(*NetworkPolicyList)) }) scheme.AddTypeDefaultingFunc(&NetworkPolicyList{}, func(obj interface{}) { SetObjectDefaults_NetworkPolicyList(obj.(*NetworkPolicyList)) })
scheme.AddTypeDefaultingFunc(&ReplicaSet{}, func(obj interface{}) { SetObjectDefaults_ReplicaSet(obj.(*ReplicaSet)) }) scheme.AddTypeDefaultingFunc(&ReplicaSet{}, func(obj interface{}) { SetObjectDefaults_ReplicaSet(obj.(*ReplicaSet)) })
...@@ -305,130 +303,6 @@ func SetObjectDefaults_HorizontalPodAutoscalerList(in *HorizontalPodAutoscalerLi ...@@ -305,130 +303,6 @@ func SetObjectDefaults_HorizontalPodAutoscalerList(in *HorizontalPodAutoscalerLi
} }
} }
func SetObjectDefaults_Job(in *Job) {
SetDefaults_Job(in)
v1.SetDefaults_PodSpec(&in.Spec.Template.Spec)
for i := range in.Spec.Template.Spec.Volumes {
a := &in.Spec.Template.Spec.Volumes[i]
v1.SetDefaults_Volume(a)
if a.VolumeSource.Secret != nil {
v1.SetDefaults_SecretVolumeSource(a.VolumeSource.Secret)
}
if a.VolumeSource.ISCSI != nil {
v1.SetDefaults_ISCSIVolumeSource(a.VolumeSource.ISCSI)
}
if a.VolumeSource.RBD != nil {
v1.SetDefaults_RBDVolumeSource(a.VolumeSource.RBD)
}
if a.VolumeSource.DownwardAPI != nil {
v1.SetDefaults_DownwardAPIVolumeSource(a.VolumeSource.DownwardAPI)
for j := range a.VolumeSource.DownwardAPI.Items {
b := &a.VolumeSource.DownwardAPI.Items[j]
if b.FieldRef != nil {
v1.SetDefaults_ObjectFieldSelector(b.FieldRef)
}
}
}
if a.VolumeSource.ConfigMap != nil {
v1.SetDefaults_ConfigMapVolumeSource(a.VolumeSource.ConfigMap)
}
if a.VolumeSource.AzureDisk != nil {
v1.SetDefaults_AzureDiskVolumeSource(a.VolumeSource.AzureDisk)
}
}
for i := range in.Spec.Template.Spec.InitContainers {
a := &in.Spec.Template.Spec.InitContainers[i]
v1.SetDefaults_Container(a)
for j := range a.Ports {
b := &a.Ports[j]
v1.SetDefaults_ContainerPort(b)
}
for j := range a.Env {
b := &a.Env[j]
if b.ValueFrom != nil {
if b.ValueFrom.FieldRef != nil {
v1.SetDefaults_ObjectFieldSelector(b.ValueFrom.FieldRef)
}
}
}
v1.SetDefaults_ResourceList(&a.Resources.Limits)
v1.SetDefaults_ResourceList(&a.Resources.Requests)
if a.LivenessProbe != nil {
v1.SetDefaults_Probe(a.LivenessProbe)
if a.LivenessProbe.Handler.HTTPGet != nil {
v1.SetDefaults_HTTPGetAction(a.LivenessProbe.Handler.HTTPGet)
}
}
if a.ReadinessProbe != nil {
v1.SetDefaults_Probe(a.ReadinessProbe)
if a.ReadinessProbe.Handler.HTTPGet != nil {
v1.SetDefaults_HTTPGetAction(a.ReadinessProbe.Handler.HTTPGet)
}
}
if a.Lifecycle != nil {
if a.Lifecycle.PostStart != nil {
if a.Lifecycle.PostStart.HTTPGet != nil {
v1.SetDefaults_HTTPGetAction(a.Lifecycle.PostStart.HTTPGet)
}
}
if a.Lifecycle.PreStop != nil {
if a.Lifecycle.PreStop.HTTPGet != nil {
v1.SetDefaults_HTTPGetAction(a.Lifecycle.PreStop.HTTPGet)
}
}
}
}
for i := range in.Spec.Template.Spec.Containers {
a := &in.Spec.Template.Spec.Containers[i]
v1.SetDefaults_Container(a)
for j := range a.Ports {
b := &a.Ports[j]
v1.SetDefaults_ContainerPort(b)
}
for j := range a.Env {
b := &a.Env[j]
if b.ValueFrom != nil {
if b.ValueFrom.FieldRef != nil {
v1.SetDefaults_ObjectFieldSelector(b.ValueFrom.FieldRef)
}
}
}
v1.SetDefaults_ResourceList(&a.Resources.Limits)
v1.SetDefaults_ResourceList(&a.Resources.Requests)
if a.LivenessProbe != nil {
v1.SetDefaults_Probe(a.LivenessProbe)
if a.LivenessProbe.Handler.HTTPGet != nil {
v1.SetDefaults_HTTPGetAction(a.LivenessProbe.Handler.HTTPGet)
}
}
if a.ReadinessProbe != nil {
v1.SetDefaults_Probe(a.ReadinessProbe)
if a.ReadinessProbe.Handler.HTTPGet != nil {
v1.SetDefaults_HTTPGetAction(a.ReadinessProbe.Handler.HTTPGet)
}
}
if a.Lifecycle != nil {
if a.Lifecycle.PostStart != nil {
if a.Lifecycle.PostStart.HTTPGet != nil {
v1.SetDefaults_HTTPGetAction(a.Lifecycle.PostStart.HTTPGet)
}
}
if a.Lifecycle.PreStop != nil {
if a.Lifecycle.PreStop.HTTPGet != nil {
v1.SetDefaults_HTTPGetAction(a.Lifecycle.PreStop.HTTPGet)
}
}
}
}
}
func SetObjectDefaults_JobList(in *JobList) {
for i := range in.Items {
a := &in.Items[i]
SetObjectDefaults_Job(a)
}
}
func SetObjectDefaults_NetworkPolicy(in *NetworkPolicy) { func SetObjectDefaults_NetworkPolicy(in *NetworkPolicy) {
SetDefaults_NetworkPolicy(in) SetDefaults_NetworkPolicy(in)
} }
......
...@@ -47,7 +47,7 @@ go_test( ...@@ -47,7 +47,7 @@ go_test(
deps = [ deps = [
"//pkg/api:go_default_library", "//pkg/api:go_default_library",
"//pkg/apis/authentication:go_default_library", "//pkg/apis/authentication:go_default_library",
"//pkg/apis/extensions:go_default_library", "//pkg/apis/batch:go_default_library",
"//pkg/apiserver/request:go_default_library", "//pkg/apiserver/request:go_default_library",
"//pkg/auth/authorizer:go_default_library", "//pkg/auth/authorizer:go_default_library",
"//pkg/auth/user:go_default_library", "//pkg/auth/user:go_default_library",
......
...@@ -24,7 +24,7 @@ import ( ...@@ -24,7 +24,7 @@ import (
"testing" "testing"
"k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/apis/extensions" "k8s.io/kubernetes/pkg/apis/batch"
"k8s.io/kubernetes/pkg/auth/authorizer" "k8s.io/kubernetes/pkg/auth/authorizer"
) )
...@@ -88,13 +88,13 @@ func TestGetAuthorizerAttributes(t *testing.T) { ...@@ -88,13 +88,13 @@ func TestGetAuthorizerAttributes(t *testing.T) {
}, },
"API group resource": { "API group resource": {
Verb: "GET", Verb: "GET",
Path: "/apis/extensions/v1beta1/namespaces/myns/jobs", Path: "/apis/batch/v1/namespaces/myns/jobs",
ExpectedAttributes: &authorizer.AttributesRecord{ ExpectedAttributes: &authorizer.AttributesRecord{
Verb: "list", Verb: "list",
Path: "/apis/extensions/v1beta1/namespaces/myns/jobs", Path: "/apis/batch/v1/namespaces/myns/jobs",
ResourceRequest: true, ResourceRequest: true,
APIGroup: extensions.GroupName, APIGroup: batch.GroupName,
APIVersion: "v1beta1", APIVersion: "v1",
Namespace: "myns", Namespace: "myns",
Resource: "jobs", Resource: "jobs",
}, },
......
...@@ -169,9 +169,9 @@ func TestGetNonAPIRequestInfo(t *testing.T) { ...@@ -169,9 +169,9 @@ func TestGetNonAPIRequestInfo(t *testing.T) {
"simple groupless": {"/api/version/resource", true}, "simple groupless": {"/api/version/resource", true},
"simple group": {"/apis/group/version/resource/name/subresource", true}, "simple group": {"/apis/group/version/resource/name/subresource", true},
"more steps": {"/api/version/resource/name/subresource", true}, "more steps": {"/api/version/resource/name/subresource", true},
"group list": {"/apis/extensions/v1beta1/job", true}, "group list": {"/apis/batch/v1/job", true},
"group get": {"/apis/extensions/v1beta1/job/foo", true}, "group get": {"/apis/batch/v1/job/foo", true},
"group subresource": {"/apis/extensions/v1beta1/job/foo/scale", true}, "group subresource": {"/apis/batch/v1/job/foo/scale", true},
"bad root": {"/not-api/version/resource", false}, "bad root": {"/not-api/version/resource", false},
"group without enough steps": {"/apis/extensions/v1beta1", false}, "group without enough steps": {"/apis/extensions/v1beta1", false},
......
...@@ -299,102 +299,102 @@ func NewForConfig(c *restclient.Config) (*Clientset, error) { ...@@ -299,102 +299,102 @@ func NewForConfig(c *restclient.Config) (*Clientset, error) {
if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 { if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 {
configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst) configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst)
} }
var clientset Clientset var cs Clientset
var err error var err error
clientset.CoreV1Client, err = v1core.NewForConfig(&configShallowCopy) cs.CoreV1Client, err = v1core.NewForConfig(&configShallowCopy)
if err != nil { if err != nil {
return nil, err return nil, err
} }
clientset.AppsV1beta1Client, err = v1beta1apps.NewForConfig(&configShallowCopy) cs.AppsV1beta1Client, err = v1beta1apps.NewForConfig(&configShallowCopy)
if err != nil { if err != nil {
return nil, err return nil, err
} }
clientset.AuthenticationV1beta1Client, err = v1beta1authentication.NewForConfig(&configShallowCopy) cs.AuthenticationV1beta1Client, err = v1beta1authentication.NewForConfig(&configShallowCopy)
if err != nil { if err != nil {
return nil, err return nil, err
} }
clientset.AuthorizationV1beta1Client, err = v1beta1authorization.NewForConfig(&configShallowCopy) cs.AuthorizationV1beta1Client, err = v1beta1authorization.NewForConfig(&configShallowCopy)
if err != nil { if err != nil {
return nil, err return nil, err
} }
clientset.AutoscalingV1Client, err = v1autoscaling.NewForConfig(&configShallowCopy) cs.AutoscalingV1Client, err = v1autoscaling.NewForConfig(&configShallowCopy)
if err != nil { if err != nil {
return nil, err return nil, err
} }
clientset.BatchV1Client, err = v1batch.NewForConfig(&configShallowCopy) cs.BatchV1Client, err = v1batch.NewForConfig(&configShallowCopy)
if err != nil { if err != nil {
return nil, err return nil, err
} }
clientset.BatchV2alpha1Client, err = v2alpha1batch.NewForConfig(&configShallowCopy) cs.BatchV2alpha1Client, err = v2alpha1batch.NewForConfig(&configShallowCopy)
if err != nil { if err != nil {
return nil, err return nil, err
} }
clientset.CertificatesV1alpha1Client, err = v1alpha1certificates.NewForConfig(&configShallowCopy) cs.CertificatesV1alpha1Client, err = v1alpha1certificates.NewForConfig(&configShallowCopy)
if err != nil { if err != nil {
return nil, err return nil, err
} }
clientset.ExtensionsV1beta1Client, err = v1beta1extensions.NewForConfig(&configShallowCopy) cs.ExtensionsV1beta1Client, err = v1beta1extensions.NewForConfig(&configShallowCopy)
if err != nil { if err != nil {
return nil, err return nil, err
} }
clientset.PolicyV1beta1Client, err = v1beta1policy.NewForConfig(&configShallowCopy) cs.PolicyV1beta1Client, err = v1beta1policy.NewForConfig(&configShallowCopy)
if err != nil { if err != nil {
return nil, err return nil, err
} }
clientset.RbacV1alpha1Client, err = v1alpha1rbac.NewForConfig(&configShallowCopy) cs.RbacV1alpha1Client, err = v1alpha1rbac.NewForConfig(&configShallowCopy)
if err != nil { if err != nil {
return nil, err return nil, err
} }
clientset.StorageV1beta1Client, err = v1beta1storage.NewForConfig(&configShallowCopy) cs.StorageV1beta1Client, err = v1beta1storage.NewForConfig(&configShallowCopy)
if err != nil { if err != nil {
return nil, err return nil, err
} }
clientset.DiscoveryClient, err = discovery.NewDiscoveryClientForConfig(&configShallowCopy) cs.DiscoveryClient, err = discovery.NewDiscoveryClientForConfig(&configShallowCopy)
if err != nil { if err != nil {
glog.Errorf("failed to create the DiscoveryClient: %v", err) glog.Errorf("failed to create the DiscoveryClient: %v", err)
return nil, err return nil, err
} }
return &clientset, nil return &cs, nil
} }
// NewForConfigOrDie creates a new Clientset for the given config and // NewForConfigOrDie creates a new Clientset for the given config and
// panics if there is an error in the config. // panics if there is an error in the config.
func NewForConfigOrDie(c *restclient.Config) *Clientset { func NewForConfigOrDie(c *restclient.Config) *Clientset {
var clientset Clientset var cs Clientset
clientset.CoreV1Client = v1core.NewForConfigOrDie(c) cs.CoreV1Client = v1core.NewForConfigOrDie(c)
clientset.AppsV1beta1Client = v1beta1apps.NewForConfigOrDie(c) cs.AppsV1beta1Client = v1beta1apps.NewForConfigOrDie(c)
clientset.AuthenticationV1beta1Client = v1beta1authentication.NewForConfigOrDie(c) cs.AuthenticationV1beta1Client = v1beta1authentication.NewForConfigOrDie(c)
clientset.AuthorizationV1beta1Client = v1beta1authorization.NewForConfigOrDie(c) cs.AuthorizationV1beta1Client = v1beta1authorization.NewForConfigOrDie(c)
clientset.AutoscalingV1Client = v1autoscaling.NewForConfigOrDie(c) cs.AutoscalingV1Client = v1autoscaling.NewForConfigOrDie(c)
clientset.BatchV1Client = v1batch.NewForConfigOrDie(c) cs.BatchV1Client = v1batch.NewForConfigOrDie(c)
clientset.BatchV2alpha1Client = v2alpha1batch.NewForConfigOrDie(c) cs.BatchV2alpha1Client = v2alpha1batch.NewForConfigOrDie(c)
clientset.CertificatesV1alpha1Client = v1alpha1certificates.NewForConfigOrDie(c) cs.CertificatesV1alpha1Client = v1alpha1certificates.NewForConfigOrDie(c)
clientset.ExtensionsV1beta1Client = v1beta1extensions.NewForConfigOrDie(c) cs.ExtensionsV1beta1Client = v1beta1extensions.NewForConfigOrDie(c)
clientset.PolicyV1beta1Client = v1beta1policy.NewForConfigOrDie(c) cs.PolicyV1beta1Client = v1beta1policy.NewForConfigOrDie(c)
clientset.RbacV1alpha1Client = v1alpha1rbac.NewForConfigOrDie(c) cs.RbacV1alpha1Client = v1alpha1rbac.NewForConfigOrDie(c)
clientset.StorageV1beta1Client = v1beta1storage.NewForConfigOrDie(c) cs.StorageV1beta1Client = v1beta1storage.NewForConfigOrDie(c)
clientset.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c) cs.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c)
return &clientset return &cs
} }
// New creates a new Clientset for the given RESTClient. // New creates a new Clientset for the given RESTClient.
func New(c restclient.Interface) *Clientset { func New(c restclient.Interface) *Clientset {
var clientset Clientset var cs Clientset
clientset.CoreV1Client = v1core.New(c) cs.CoreV1Client = v1core.New(c)
clientset.AppsV1beta1Client = v1beta1apps.New(c) cs.AppsV1beta1Client = v1beta1apps.New(c)
clientset.AuthenticationV1beta1Client = v1beta1authentication.New(c) cs.AuthenticationV1beta1Client = v1beta1authentication.New(c)
clientset.AuthorizationV1beta1Client = v1beta1authorization.New(c) cs.AuthorizationV1beta1Client = v1beta1authorization.New(c)
clientset.AutoscalingV1Client = v1autoscaling.New(c) cs.AutoscalingV1Client = v1autoscaling.New(c)
clientset.BatchV1Client = v1batch.New(c) cs.BatchV1Client = v1batch.New(c)
clientset.BatchV2alpha1Client = v2alpha1batch.New(c) cs.BatchV2alpha1Client = v2alpha1batch.New(c)
clientset.CertificatesV1alpha1Client = v1alpha1certificates.New(c) cs.CertificatesV1alpha1Client = v1alpha1certificates.New(c)
clientset.ExtensionsV1beta1Client = v1beta1extensions.New(c) cs.ExtensionsV1beta1Client = v1beta1extensions.New(c)
clientset.PolicyV1beta1Client = v1beta1policy.New(c) cs.PolicyV1beta1Client = v1beta1policy.New(c)
clientset.RbacV1alpha1Client = v1alpha1rbac.New(c) cs.RbacV1alpha1Client = v1alpha1rbac.New(c)
clientset.StorageV1beta1Client = v1beta1storage.New(c) cs.StorageV1beta1Client = v1beta1storage.New(c)
clientset.DiscoveryClient = discovery.NewDiscoveryClient(c) cs.DiscoveryClient = discovery.NewDiscoveryClient(c)
return &clientset return &cs
} }
...@@ -17,7 +17,6 @@ go_library( ...@@ -17,7 +17,6 @@ go_library(
"extensions_client.go", "extensions_client.go",
"generated_expansion.go", "generated_expansion.go",
"ingress.go", "ingress.go",
"job.go",
"podsecuritypolicy.go", "podsecuritypolicy.go",
"replicaset.go", "replicaset.go",
"scale.go", "scale.go",
......
...@@ -30,7 +30,6 @@ type ExtensionsV1beta1Interface interface { ...@@ -30,7 +30,6 @@ type ExtensionsV1beta1Interface interface {
DaemonSetsGetter DaemonSetsGetter
DeploymentsGetter DeploymentsGetter
IngressesGetter IngressesGetter
JobsGetter
PodSecurityPoliciesGetter PodSecurityPoliciesGetter
ReplicaSetsGetter ReplicaSetsGetter
ScalesGetter ScalesGetter
...@@ -54,10 +53,6 @@ func (c *ExtensionsV1beta1Client) Ingresses(namespace string) IngressInterface { ...@@ -54,10 +53,6 @@ func (c *ExtensionsV1beta1Client) Ingresses(namespace string) IngressInterface {
return newIngresses(c, namespace) return newIngresses(c, namespace)
} }
func (c *ExtensionsV1beta1Client) Jobs(namespace string) JobInterface {
return newJobs(c, namespace)
}
func (c *ExtensionsV1beta1Client) PodSecurityPolicies() PodSecurityPolicyInterface { func (c *ExtensionsV1beta1Client) PodSecurityPolicies() PodSecurityPolicyInterface {
return newPodSecurityPolicies(c) return newPodSecurityPolicies(c)
} }
......
...@@ -16,7 +16,6 @@ go_library( ...@@ -16,7 +16,6 @@ go_library(
"fake_deployment_expansion.go", "fake_deployment_expansion.go",
"fake_extensions_client.go", "fake_extensions_client.go",
"fake_ingress.go", "fake_ingress.go",
"fake_job.go",
"fake_podsecuritypolicy.go", "fake_podsecuritypolicy.go",
"fake_replicaset.go", "fake_replicaset.go",
"fake_scale.go", "fake_scale.go",
......
...@@ -38,10 +38,6 @@ func (c *FakeExtensionsV1beta1) Ingresses(namespace string) v1beta1.IngressInter ...@@ -38,10 +38,6 @@ func (c *FakeExtensionsV1beta1) Ingresses(namespace string) v1beta1.IngressInter
return &FakeIngresses{c, namespace} return &FakeIngresses{c, namespace}
} }
func (c *FakeExtensionsV1beta1) Jobs(namespace string) v1beta1.JobInterface {
return &FakeJobs{c, namespace}
}
func (c *FakeExtensionsV1beta1) PodSecurityPolicies() v1beta1.PodSecurityPolicyInterface { func (c *FakeExtensionsV1beta1) PodSecurityPolicies() v1beta1.PodSecurityPolicyInterface {
return &FakePodSecurityPolicies{c} return &FakePodSecurityPolicies{c}
} }
......
/*
Copyright 2016 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 (
api "k8s.io/kubernetes/pkg/api"
v1 "k8s.io/kubernetes/pkg/api/v1"
v1beta1 "k8s.io/kubernetes/pkg/apis/extensions/v1beta1"
meta_v1 "k8s.io/kubernetes/pkg/apis/meta/v1"
core "k8s.io/kubernetes/pkg/client/testing/core"
labels "k8s.io/kubernetes/pkg/labels"
schema "k8s.io/kubernetes/pkg/runtime/schema"
watch "k8s.io/kubernetes/pkg/watch"
)
// FakeJobs implements JobInterface
type FakeJobs struct {
Fake *FakeExtensionsV1beta1
ns string
}
var jobsResource = schema.GroupVersionResource{Group: "extensions", Version: "v1beta1", Resource: "jobs"}
func (c *FakeJobs) Create(job *v1beta1.Job) (result *v1beta1.Job, err error) {
obj, err := c.Fake.
Invokes(core.NewCreateAction(jobsResource, c.ns, job), &v1beta1.Job{})
if obj == nil {
return nil, err
}
return obj.(*v1beta1.Job), err
}
func (c *FakeJobs) Update(job *v1beta1.Job) (result *v1beta1.Job, err error) {
obj, err := c.Fake.
Invokes(core.NewUpdateAction(jobsResource, c.ns, job), &v1beta1.Job{})
if obj == nil {
return nil, err
}
return obj.(*v1beta1.Job), err
}
func (c *FakeJobs) UpdateStatus(job *v1beta1.Job) (*v1beta1.Job, error) {
obj, err := c.Fake.
Invokes(core.NewUpdateSubresourceAction(jobsResource, "status", c.ns, job), &v1beta1.Job{})
if obj == nil {
return nil, err
}
return obj.(*v1beta1.Job), err
}
func (c *FakeJobs) Delete(name string, options *v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(core.NewDeleteAction(jobsResource, c.ns, name), &v1beta1.Job{})
return err
}
func (c *FakeJobs) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
action := core.NewDeleteCollectionAction(jobsResource, c.ns, listOptions)
_, err := c.Fake.Invokes(action, &v1beta1.JobList{})
return err
}
func (c *FakeJobs) Get(name string, options meta_v1.GetOptions) (result *v1beta1.Job, err error) {
obj, err := c.Fake.
Invokes(core.NewGetAction(jobsResource, c.ns, name), &v1beta1.Job{})
if obj == nil {
return nil, err
}
return obj.(*v1beta1.Job), err
}
func (c *FakeJobs) List(opts v1.ListOptions) (result *v1beta1.JobList, err error) {
obj, err := c.Fake.
Invokes(core.NewListAction(jobsResource, c.ns, opts), &v1beta1.JobList{})
if obj == nil {
return nil, err
}
label, _, _ := core.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1beta1.JobList{}
for _, item := range obj.(*v1beta1.JobList).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 jobs.
func (c *FakeJobs) Watch(opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(core.NewWatchAction(jobsResource, c.ns, opts))
}
// Patch applies the patch and returns the patched job.
func (c *FakeJobs) Patch(name string, pt api.PatchType, data []byte, subresources ...string) (result *v1beta1.Job, err error) {
obj, err := c.Fake.
Invokes(core.NewPatchSubresourceAction(jobsResource, c.ns, name, data, subresources...), &v1beta1.Job{})
if obj == nil {
return nil, err
}
return obj.(*v1beta1.Job), err
}
...@@ -20,8 +20,6 @@ type DaemonSetExpansion interface{} ...@@ -20,8 +20,6 @@ type DaemonSetExpansion interface{}
type IngressExpansion interface{} type IngressExpansion interface{}
type JobExpansion interface{}
type PodSecurityPolicyExpansion interface{} type PodSecurityPolicyExpansion interface{}
type ReplicaSetExpansion interface{} type ReplicaSetExpansion interface{}
......
/*
Copyright 2016 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 v1beta1
import (
api "k8s.io/kubernetes/pkg/api"
v1 "k8s.io/kubernetes/pkg/api/v1"
v1beta1 "k8s.io/kubernetes/pkg/apis/extensions/v1beta1"
meta_v1 "k8s.io/kubernetes/pkg/apis/meta/v1"
restclient "k8s.io/kubernetes/pkg/client/restclient"
watch "k8s.io/kubernetes/pkg/watch"
)
// JobsGetter has a method to return a JobInterface.
// A group's client should implement this interface.
type JobsGetter interface {
Jobs(namespace string) JobInterface
}
// JobInterface has methods to work with Job resources.
type JobInterface interface {
Create(*v1beta1.Job) (*v1beta1.Job, error)
Update(*v1beta1.Job) (*v1beta1.Job, error)
UpdateStatus(*v1beta1.Job) (*v1beta1.Job, error)
Delete(name string, options *v1.DeleteOptions) error
DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error
Get(name string, options meta_v1.GetOptions) (*v1beta1.Job, error)
List(opts v1.ListOptions) (*v1beta1.JobList, error)
Watch(opts v1.ListOptions) (watch.Interface, error)
Patch(name string, pt api.PatchType, data []byte, subresources ...string) (result *v1beta1.Job, err error)
JobExpansion
}
// jobs implements JobInterface
type jobs struct {
client restclient.Interface
ns string
}
// newJobs returns a Jobs
func newJobs(c *ExtensionsV1beta1Client, namespace string) *jobs {
return &jobs{
client: c.RESTClient(),
ns: namespace,
}
}
// Create takes the representation of a job and creates it. Returns the server's representation of the job, and an error, if there is any.
func (c *jobs) Create(job *v1beta1.Job) (result *v1beta1.Job, err error) {
result = &v1beta1.Job{}
err = c.client.Post().
Namespace(c.ns).
Resource("jobs").
Body(job).
Do().
Into(result)
return
}
// Update takes the representation of a job and updates it. Returns the server's representation of the job, and an error, if there is any.
func (c *jobs) Update(job *v1beta1.Job) (result *v1beta1.Job, err error) {
result = &v1beta1.Job{}
err = c.client.Put().
Namespace(c.ns).
Resource("jobs").
Name(job.Name).
Body(job).
Do().
Into(result)
return
}
// UpdateStatus was generated because the type contains a Status member.
// Add a +genclientstatus=false comment above the type to avoid generating UpdateStatus().
func (c *jobs) UpdateStatus(job *v1beta1.Job) (result *v1beta1.Job, err error) {
result = &v1beta1.Job{}
err = c.client.Put().
Namespace(c.ns).
Resource("jobs").
Name(job.Name).
SubResource("status").
Body(job).
Do().
Into(result)
return
}
// Delete takes name of the job and deletes it. Returns an error if one occurs.
func (c *jobs) Delete(name string, options *v1.DeleteOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("jobs").
Name(name).
Body(options).
Do().
Error()
}
// DeleteCollection deletes a collection of objects.
func (c *jobs) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("jobs").
VersionedParams(&listOptions, api.ParameterCodec).
Body(options).
Do().
Error()
}
// Get takes name of the job, and returns the corresponding job object, and an error if there is any.
func (c *jobs) Get(name string, options meta_v1.GetOptions) (result *v1beta1.Job, err error) {
result = &v1beta1.Job{}
err = c.client.Get().
Namespace(c.ns).
Resource("jobs").
Name(name).
VersionedParams(&options, api.ParameterCodec).
Do().
Into(result)
return
}
// List takes label and field selectors, and returns the list of Jobs that match those selectors.
func (c *jobs) List(opts v1.ListOptions) (result *v1beta1.JobList, err error) {
result = &v1beta1.JobList{}
err = c.client.Get().
Namespace(c.ns).
Resource("jobs").
VersionedParams(&opts, api.ParameterCodec).
Do().
Into(result)
return
}
// Watch returns a watch.Interface that watches the requested jobs.
func (c *jobs) Watch(opts v1.ListOptions) (watch.Interface, error) {
return c.client.Get().
Prefix("watch").
Namespace(c.ns).
Resource("jobs").
VersionedParams(&opts, api.ParameterCodec).
Watch()
}
// Patch applies the patch and returns the patched job.
func (c *jobs) Patch(name string, pt api.PatchType, data []byte, subresources ...string) (result *v1beta1.Job, err error) {
result = &v1beta1.Job{}
err = c.client.Patch(pt).
Namespace(c.ns).
Resource("jobs").
SubResource(subresources...).
Name(name).
Body(data).
Do().
Into(result)
return
}
...@@ -176,96 +176,96 @@ func NewForConfig(c *restclient.Config) (*Clientset, error) { ...@@ -176,96 +176,96 @@ func NewForConfig(c *restclient.Config) (*Clientset, error) {
if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 { if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 {
configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst) configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst)
} }
var clientset Clientset var cs Clientset
var err error var err error
clientset.CoreClient, err = internalversioncore.NewForConfig(&configShallowCopy) cs.CoreClient, err = internalversioncore.NewForConfig(&configShallowCopy)
if err != nil { if err != nil {
return nil, err return nil, err
} }
clientset.AppsClient, err = internalversionapps.NewForConfig(&configShallowCopy) cs.AppsClient, err = internalversionapps.NewForConfig(&configShallowCopy)
if err != nil { if err != nil {
return nil, err return nil, err
} }
clientset.AuthenticationClient, err = internalversionauthentication.NewForConfig(&configShallowCopy) cs.AuthenticationClient, err = internalversionauthentication.NewForConfig(&configShallowCopy)
if err != nil { if err != nil {
return nil, err return nil, err
} }
clientset.AuthorizationClient, err = internalversionauthorization.NewForConfig(&configShallowCopy) cs.AuthorizationClient, err = internalversionauthorization.NewForConfig(&configShallowCopy)
if err != nil { if err != nil {
return nil, err return nil, err
} }
clientset.AutoscalingClient, err = internalversionautoscaling.NewForConfig(&configShallowCopy) cs.AutoscalingClient, err = internalversionautoscaling.NewForConfig(&configShallowCopy)
if err != nil { if err != nil {
return nil, err return nil, err
} }
clientset.BatchClient, err = internalversionbatch.NewForConfig(&configShallowCopy) cs.BatchClient, err = internalversionbatch.NewForConfig(&configShallowCopy)
if err != nil { if err != nil {
return nil, err return nil, err
} }
clientset.CertificatesClient, err = internalversioncertificates.NewForConfig(&configShallowCopy) cs.CertificatesClient, err = internalversioncertificates.NewForConfig(&configShallowCopy)
if err != nil { if err != nil {
return nil, err return nil, err
} }
clientset.ExtensionsClient, err = internalversionextensions.NewForConfig(&configShallowCopy) cs.ExtensionsClient, err = internalversionextensions.NewForConfig(&configShallowCopy)
if err != nil { if err != nil {
return nil, err return nil, err
} }
clientset.PolicyClient, err = internalversionpolicy.NewForConfig(&configShallowCopy) cs.PolicyClient, err = internalversionpolicy.NewForConfig(&configShallowCopy)
if err != nil { if err != nil {
return nil, err return nil, err
} }
clientset.RbacClient, err = internalversionrbac.NewForConfig(&configShallowCopy) cs.RbacClient, err = internalversionrbac.NewForConfig(&configShallowCopy)
if err != nil { if err != nil {
return nil, err return nil, err
} }
clientset.StorageClient, err = internalversionstorage.NewForConfig(&configShallowCopy) cs.StorageClient, err = internalversionstorage.NewForConfig(&configShallowCopy)
if err != nil { if err != nil {
return nil, err return nil, err
} }
clientset.DiscoveryClient, err = discovery.NewDiscoveryClientForConfig(&configShallowCopy) cs.DiscoveryClient, err = discovery.NewDiscoveryClientForConfig(&configShallowCopy)
if err != nil { if err != nil {
glog.Errorf("failed to create the DiscoveryClient: %v", err) glog.Errorf("failed to create the DiscoveryClient: %v", err)
return nil, err return nil, err
} }
return &clientset, nil return &cs, nil
} }
// NewForConfigOrDie creates a new Clientset for the given config and // NewForConfigOrDie creates a new Clientset for the given config and
// panics if there is an error in the config. // panics if there is an error in the config.
func NewForConfigOrDie(c *restclient.Config) *Clientset { func NewForConfigOrDie(c *restclient.Config) *Clientset {
var clientset Clientset var cs Clientset
clientset.CoreClient = internalversioncore.NewForConfigOrDie(c) cs.CoreClient = internalversioncore.NewForConfigOrDie(c)
clientset.AppsClient = internalversionapps.NewForConfigOrDie(c) cs.AppsClient = internalversionapps.NewForConfigOrDie(c)
clientset.AuthenticationClient = internalversionauthentication.NewForConfigOrDie(c) cs.AuthenticationClient = internalversionauthentication.NewForConfigOrDie(c)
clientset.AuthorizationClient = internalversionauthorization.NewForConfigOrDie(c) cs.AuthorizationClient = internalversionauthorization.NewForConfigOrDie(c)
clientset.AutoscalingClient = internalversionautoscaling.NewForConfigOrDie(c) cs.AutoscalingClient = internalversionautoscaling.NewForConfigOrDie(c)
clientset.BatchClient = internalversionbatch.NewForConfigOrDie(c) cs.BatchClient = internalversionbatch.NewForConfigOrDie(c)
clientset.CertificatesClient = internalversioncertificates.NewForConfigOrDie(c) cs.CertificatesClient = internalversioncertificates.NewForConfigOrDie(c)
clientset.ExtensionsClient = internalversionextensions.NewForConfigOrDie(c) cs.ExtensionsClient = internalversionextensions.NewForConfigOrDie(c)
clientset.PolicyClient = internalversionpolicy.NewForConfigOrDie(c) cs.PolicyClient = internalversionpolicy.NewForConfigOrDie(c)
clientset.RbacClient = internalversionrbac.NewForConfigOrDie(c) cs.RbacClient = internalversionrbac.NewForConfigOrDie(c)
clientset.StorageClient = internalversionstorage.NewForConfigOrDie(c) cs.StorageClient = internalversionstorage.NewForConfigOrDie(c)
clientset.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c) cs.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c)
return &clientset return &cs
} }
// New creates a new Clientset for the given RESTClient. // New creates a new Clientset for the given RESTClient.
func New(c restclient.Interface) *Clientset { func New(c restclient.Interface) *Clientset {
var clientset Clientset var cs Clientset
clientset.CoreClient = internalversioncore.New(c) cs.CoreClient = internalversioncore.New(c)
clientset.AppsClient = internalversionapps.New(c) cs.AppsClient = internalversionapps.New(c)
clientset.AuthenticationClient = internalversionauthentication.New(c) cs.AuthenticationClient = internalversionauthentication.New(c)
clientset.AuthorizationClient = internalversionauthorization.New(c) cs.AuthorizationClient = internalversionauthorization.New(c)
clientset.AutoscalingClient = internalversionautoscaling.New(c) cs.AutoscalingClient = internalversionautoscaling.New(c)
clientset.BatchClient = internalversionbatch.New(c) cs.BatchClient = internalversionbatch.New(c)
clientset.CertificatesClient = internalversioncertificates.New(c) cs.CertificatesClient = internalversioncertificates.New(c)
clientset.ExtensionsClient = internalversionextensions.New(c) cs.ExtensionsClient = internalversionextensions.New(c)
clientset.PolicyClient = internalversionpolicy.New(c) cs.PolicyClient = internalversionpolicy.New(c)
clientset.RbacClient = internalversionrbac.New(c) cs.RbacClient = internalversionrbac.New(c)
clientset.StorageClient = internalversionstorage.New(c) cs.StorageClient = internalversionstorage.New(c)
clientset.DiscoveryClient = discovery.NewDiscoveryClient(c) cs.DiscoveryClient = discovery.NewDiscoveryClient(c)
return &clientset return &cs
} }
...@@ -14,7 +14,6 @@ go_library( ...@@ -14,7 +14,6 @@ go_library(
"deployment.go", "deployment.go",
"ingress.go", "ingress.go",
"interface.go", "interface.go",
"job.go",
"podsecuritypolicy.go", "podsecuritypolicy.go",
"replicaset.go", "replicaset.go",
"thirdpartyresource.go", "thirdpartyresource.go",
......
...@@ -30,8 +30,6 @@ type Interface interface { ...@@ -30,8 +30,6 @@ type Interface interface {
Deployments() DeploymentInformer Deployments() DeploymentInformer
// Ingresses returns a IngressInformer. // Ingresses returns a IngressInformer.
Ingresses() IngressInformer Ingresses() IngressInformer
// Jobs returns a JobInformer.
Jobs() JobInformer
// PodSecurityPolicies returns a PodSecurityPolicyInformer. // PodSecurityPolicies returns a PodSecurityPolicyInformer.
PodSecurityPolicies() PodSecurityPolicyInformer PodSecurityPolicies() PodSecurityPolicyInformer
// ReplicaSets returns a ReplicaSetInformer. // ReplicaSets returns a ReplicaSetInformer.
...@@ -64,11 +62,6 @@ func (v *version) Ingresses() IngressInformer { ...@@ -64,11 +62,6 @@ func (v *version) Ingresses() IngressInformer {
return &ingressInformer{factory: v.SharedInformerFactory} return &ingressInformer{factory: v.SharedInformerFactory}
} }
// Jobs returns a JobInformer.
func (v *version) Jobs() JobInformer {
return &jobInformer{factory: v.SharedInformerFactory}
}
// PodSecurityPolicies returns a PodSecurityPolicyInformer. // PodSecurityPolicies returns a PodSecurityPolicyInformer.
func (v *version) PodSecurityPolicies() PodSecurityPolicyInformer { func (v *version) PodSecurityPolicies() PodSecurityPolicyInformer {
return &podSecurityPolicyInformer{factory: v.SharedInformerFactory} return &podSecurityPolicyInformer{factory: v.SharedInformerFactory}
......
/*
Copyright 2016 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.
*/
// This file was automatically generated by informer-gen with arguments: --input-dirs=[k8s.io/kubernetes/pkg/api,k8s.io/kubernetes/pkg/api/v1,k8s.io/kubernetes/pkg/apis/abac,k8s.io/kubernetes/pkg/apis/abac/v0,k8s.io/kubernetes/pkg/apis/abac/v1beta1,k8s.io/kubernetes/pkg/apis/apps,k8s.io/kubernetes/pkg/apis/apps/v1beta1,k8s.io/kubernetes/pkg/apis/authentication,k8s.io/kubernetes/pkg/apis/authentication/v1beta1,k8s.io/kubernetes/pkg/apis/authorization,k8s.io/kubernetes/pkg/apis/authorization/v1beta1,k8s.io/kubernetes/pkg/apis/autoscaling,k8s.io/kubernetes/pkg/apis/autoscaling/v1,k8s.io/kubernetes/pkg/apis/batch,k8s.io/kubernetes/pkg/apis/batch/v1,k8s.io/kubernetes/pkg/apis/batch/v2alpha1,k8s.io/kubernetes/pkg/apis/certificates,k8s.io/kubernetes/pkg/apis/certificates/v1alpha1,k8s.io/kubernetes/pkg/apis/componentconfig,k8s.io/kubernetes/pkg/apis/componentconfig/v1alpha1,k8s.io/kubernetes/pkg/apis/extensions,k8s.io/kubernetes/pkg/apis/extensions/v1beta1,k8s.io/kubernetes/pkg/apis/imagepolicy,k8s.io/kubernetes/pkg/apis/imagepolicy/v1alpha1,k8s.io/kubernetes/pkg/apis/meta/v1,k8s.io/kubernetes/pkg/apis/policy,k8s.io/kubernetes/pkg/apis/policy/v1beta1,k8s.io/kubernetes/pkg/apis/rbac,k8s.io/kubernetes/pkg/apis/rbac/v1alpha1,k8s.io/kubernetes/pkg/apis/storage,k8s.io/kubernetes/pkg/apis/storage/v1beta1] --internal-clientset-package=k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset --listers-package=k8s.io/kubernetes/pkg/client/listers --versioned-clientset-package=k8s.io/kubernetes/pkg/client/clientset_generated/clientset
package v1beta1
import (
v1 "k8s.io/kubernetes/pkg/api/v1"
extensions_v1beta1 "k8s.io/kubernetes/pkg/apis/extensions/v1beta1"
cache "k8s.io/kubernetes/pkg/client/cache"
clientset "k8s.io/kubernetes/pkg/client/clientset_generated/clientset"
internalinterfaces "k8s.io/kubernetes/pkg/client/informers/informers_generated/internalinterfaces"
v1beta1 "k8s.io/kubernetes/pkg/client/listers/extensions/v1beta1"
runtime "k8s.io/kubernetes/pkg/runtime"
watch "k8s.io/kubernetes/pkg/watch"
time "time"
)
// JobInformer provides access to a shared informer and lister for
// Jobs.
type JobInformer interface {
Informer() cache.SharedIndexInformer
Lister() v1beta1.JobLister
}
type jobInformer struct {
factory internalinterfaces.SharedInformerFactory
}
func newJobInformer(client clientset.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
sharedIndexInformer := cache.NewSharedIndexInformer(
&cache.ListWatch{
ListFunc: func(options v1.ListOptions) (runtime.Object, error) {
return client.ExtensionsV1beta1().Jobs(v1.NamespaceAll).List(options)
},
WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
return client.ExtensionsV1beta1().Jobs(v1.NamespaceAll).Watch(options)
},
},
&extensions_v1beta1.Job{},
resyncPeriod,
cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc},
)
return sharedIndexInformer
}
func (f *jobInformer) Informer() cache.SharedIndexInformer {
return f.factory.VersionedInformerFor(&extensions_v1beta1.Job{}, newJobInformer)
}
func (f *jobInformer) Lister() v1beta1.JobLister {
return v1beta1.NewJobLister(f.Informer().GetIndexer())
}
...@@ -200,8 +200,6 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource ...@@ -200,8 +200,6 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource
return &genericInformer{resource: resource.GroupResource(), informer: f.Extensions().V1beta1().Deployments().Informer()}, nil return &genericInformer{resource: resource.GroupResource(), informer: f.Extensions().V1beta1().Deployments().Informer()}, nil
case extensions_v1beta1.SchemeGroupVersion.WithResource("ingresses"): case extensions_v1beta1.SchemeGroupVersion.WithResource("ingresses"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Extensions().V1beta1().Ingresses().Informer()}, nil return &genericInformer{resource: resource.GroupResource(), informer: f.Extensions().V1beta1().Ingresses().Informer()}, nil
case extensions_v1beta1.SchemeGroupVersion.WithResource("jobs"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Extensions().V1beta1().Jobs().Informer()}, nil
case extensions_v1beta1.SchemeGroupVersion.WithResource("podsecuritypolicies"): case extensions_v1beta1.SchemeGroupVersion.WithResource("podsecuritypolicies"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Extensions().V1beta1().PodSecurityPolicies().Informer()}, nil return &genericInformer{resource: resource.GroupResource(), informer: f.Extensions().V1beta1().PodSecurityPolicies().Informer()}, nil
case extensions_v1beta1.SchemeGroupVersion.WithResource("replicasets"): case extensions_v1beta1.SchemeGroupVersion.WithResource("replicasets"):
......
...@@ -14,7 +14,6 @@ go_library( ...@@ -14,7 +14,6 @@ go_library(
"deployment.go", "deployment.go",
"expansion_generated.go", "expansion_generated.go",
"ingress.go", "ingress.go",
"job.go",
"podsecuritypolicy.go", "podsecuritypolicy.go",
"replicaset.go", "replicaset.go",
"scale.go", "scale.go",
......
...@@ -42,14 +42,6 @@ type IngressListerExpansion interface{} ...@@ -42,14 +42,6 @@ type IngressListerExpansion interface{}
// IngressNamespaeLister. // IngressNamespaeLister.
type IngressNamespaceListerExpansion interface{} type IngressNamespaceListerExpansion interface{}
// JobListerExpansion allows custom methods to be added to
// JobLister.
type JobListerExpansion interface{}
// JobNamespaceListerExpansion allows custom methods to be added to
// JobNamespaeLister.
type JobNamespaceListerExpansion interface{}
// PodSecurityPolicyListerExpansion allows custom methods to be added to // PodSecurityPolicyListerExpansion allows custom methods to be added to
// PodSecurityPolicyLister. // PodSecurityPolicyLister.
type PodSecurityPolicyListerExpansion interface{} type PodSecurityPolicyListerExpansion interface{}
......
/*
Copyright 2016 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.
*/
// This file was automatically generated by lister-gen with arguments: --input-dirs=[k8s.io/kubernetes/pkg/api,k8s.io/kubernetes/pkg/api/v1,k8s.io/kubernetes/pkg/apis/abac,k8s.io/kubernetes/pkg/apis/abac/v0,k8s.io/kubernetes/pkg/apis/abac/v1beta1,k8s.io/kubernetes/pkg/apis/apps,k8s.io/kubernetes/pkg/apis/apps/v1beta1,k8s.io/kubernetes/pkg/apis/authentication,k8s.io/kubernetes/pkg/apis/authentication/v1beta1,k8s.io/kubernetes/pkg/apis/authorization,k8s.io/kubernetes/pkg/apis/authorization/v1beta1,k8s.io/kubernetes/pkg/apis/autoscaling,k8s.io/kubernetes/pkg/apis/autoscaling/v1,k8s.io/kubernetes/pkg/apis/batch,k8s.io/kubernetes/pkg/apis/batch/v1,k8s.io/kubernetes/pkg/apis/batch/v2alpha1,k8s.io/kubernetes/pkg/apis/certificates,k8s.io/kubernetes/pkg/apis/certificates/v1alpha1,k8s.io/kubernetes/pkg/apis/componentconfig,k8s.io/kubernetes/pkg/apis/componentconfig/v1alpha1,k8s.io/kubernetes/pkg/apis/extensions,k8s.io/kubernetes/pkg/apis/extensions/v1beta1,k8s.io/kubernetes/pkg/apis/imagepolicy,k8s.io/kubernetes/pkg/apis/imagepolicy/v1alpha1,k8s.io/kubernetes/pkg/apis/meta/v1,k8s.io/kubernetes/pkg/apis/policy,k8s.io/kubernetes/pkg/apis/policy/v1alpha1,k8s.io/kubernetes/pkg/apis/policy/v1beta1,k8s.io/kubernetes/pkg/apis/rbac,k8s.io/kubernetes/pkg/apis/rbac/v1alpha1,k8s.io/kubernetes/pkg/apis/storage,k8s.io/kubernetes/pkg/apis/storage/v1beta1]
package v1beta1
import (
"k8s.io/kubernetes/pkg/api/errors"
extensions "k8s.io/kubernetes/pkg/apis/extensions"
v1beta1 "k8s.io/kubernetes/pkg/apis/extensions/v1beta1"
"k8s.io/kubernetes/pkg/client/cache"
"k8s.io/kubernetes/pkg/labels"
)
// JobLister helps list Jobs.
type JobLister interface {
// List lists all Jobs in the indexer.
List(selector labels.Selector) (ret []*v1beta1.Job, err error)
// Jobs returns an object that can list and get Jobs.
Jobs(namespace string) JobNamespaceLister
JobListerExpansion
}
// jobLister implements the JobLister interface.
type jobLister struct {
indexer cache.Indexer
}
// NewJobLister returns a new JobLister.
func NewJobLister(indexer cache.Indexer) JobLister {
return &jobLister{indexer: indexer}
}
// List lists all Jobs in the indexer.
func (s *jobLister) List(selector labels.Selector) (ret []*v1beta1.Job, err error) {
err = cache.ListAll(s.indexer, selector, func(m interface{}) {
ret = append(ret, m.(*v1beta1.Job))
})
return ret, err
}
// Jobs returns an object that can list and get Jobs.
func (s *jobLister) Jobs(namespace string) JobNamespaceLister {
return jobNamespaceLister{indexer: s.indexer, namespace: namespace}
}
// JobNamespaceLister helps list and get Jobs.
type JobNamespaceLister interface {
// List lists all Jobs in the indexer for a given namespace.
List(selector labels.Selector) (ret []*v1beta1.Job, err error)
// Get retrieves the Job from the indexer for a given namespace and name.
Get(name string) (*v1beta1.Job, error)
JobNamespaceListerExpansion
}
// jobNamespaceLister implements the JobNamespaceLister
// interface.
type jobNamespaceLister struct {
indexer cache.Indexer
namespace string
}
// List lists all Jobs in the indexer for a given namespace.
func (s jobNamespaceLister) List(selector labels.Selector) (ret []*v1beta1.Job, err error) {
err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {
ret = append(ret, m.(*v1beta1.Job))
})
return ret, err
}
// Get retrieves the Job from the indexer for a given namespace and name.
func (s jobNamespaceLister) Get(name string) (*v1beta1.Job, error) {
obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name)
if err != nil {
return nil, err
}
if !exists {
return nil, errors.NewNotFound(extensions.Resource("job"), name)
}
return obj.(*v1beta1.Job), nil
}
...@@ -42,7 +42,7 @@ func TestGetJobFromTemplate(t *testing.T) { ...@@ -42,7 +42,7 @@ func TestGetJobFromTemplate(t *testing.T) {
Name: "mycronjob", Name: "mycronjob",
Namespace: "snazzycats", Namespace: "snazzycats",
UID: types.UID("1a2b3c"), UID: types.UID("1a2b3c"),
SelfLink: "/apis/extensions/v1beta1/namespaces/snazzycats/jobs/mycronjob", SelfLink: "/apis/batch/v1/namespaces/snazzycats/jobs/mycronjob",
}, },
Spec: batch.CronJobSpec{ Spec: batch.CronJobSpec{
Schedule: "* * * * ?", Schedule: "* * * * ?",
...@@ -90,7 +90,7 @@ func TestGetJobFromTemplate(t *testing.T) { ...@@ -90,7 +90,7 @@ func TestGetJobFromTemplate(t *testing.T) {
if !ok { if !ok {
t.Errorf("Missing created-by annotation") t.Errorf("Missing created-by annotation")
} }
expectedCreatedBy := `{"kind":"SerializedReference","apiVersion":"v1","reference":{"kind":"CronJob","namespace":"snazzycats","name":"mycronjob","uid":"1a2b3c","apiVersion":"extensions"}} expectedCreatedBy := `{"kind":"SerializedReference","apiVersion":"v1","reference":{"kind":"CronJob","namespace":"snazzycats","name":"mycronjob","uid":"1a2b3c","apiVersion":"batch"}}
` `
if len(v) != len(expectedCreatedBy) { if len(v) != len(expectedCreatedBy) {
t.Errorf("Wrong length for created-by annotation, expected %v got %v", len(expectedCreatedBy), len(v)) t.Errorf("Wrong length for created-by annotation, expected %v got %v", len(expectedCreatedBy), len(v))
......
...@@ -10854,227 +10854,6 @@ var OpenAPIDefinitions *common.OpenAPIDefinitions = &common.OpenAPIDefinitions{ ...@@ -10854,227 +10854,6 @@ var OpenAPIDefinitions *common.OpenAPIDefinitions = &common.OpenAPIDefinitions{
}, },
Dependencies: []string{}, Dependencies: []string{},
}, },
"v1beta1.Job": {
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Description: "Job represents the configuration of a single job. DEPRECATED: extensions/v1beta1.Job is deprecated, use batch/v1.Job instead.",
Properties: map[string]spec.Schema{
"metadata": {
SchemaProps: spec.SchemaProps{
Description: "Standard object's metadata. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata",
Ref: spec.MustCreateRef("#/definitions/v1.ObjectMeta"),
},
},
"spec": {
SchemaProps: spec.SchemaProps{
Description: "Spec is a structure defining the expected behavior of a job. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#spec-and-status",
Ref: spec.MustCreateRef("#/definitions/v1beta1.JobSpec"),
},
},
"status": {
SchemaProps: spec.SchemaProps{
Description: "Status is a structure describing current status of a job. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#spec-and-status",
Ref: spec.MustCreateRef("#/definitions/v1beta1.JobStatus"),
},
},
},
},
},
Dependencies: []string{
"v1.ObjectMeta", "v1beta1.JobSpec", "v1beta1.JobStatus"},
},
"v1beta1.JobCondition": {
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Description: "JobCondition describes current state of a job.",
Properties: map[string]spec.Schema{
"type": {
SchemaProps: spec.SchemaProps{
Description: "Type of job condition, Complete or Failed.",
Type: []string{"string"},
Format: "",
},
},
"status": {
SchemaProps: spec.SchemaProps{
Description: "Status of the condition, one of True, False, Unknown.",
Type: []string{"string"},
Format: "",
},
},
"lastProbeTime": {
SchemaProps: spec.SchemaProps{
Description: "Last time the condition was checked.",
Ref: spec.MustCreateRef("#/definitions/v1.Time"),
},
},
"lastTransitionTime": {
SchemaProps: spec.SchemaProps{
Description: "Last time the condition transit from one status to another.",
Ref: spec.MustCreateRef("#/definitions/v1.Time"),
},
},
"reason": {
SchemaProps: spec.SchemaProps{
Description: "(brief) reason for the condition's last transition.",
Type: []string{"string"},
Format: "",
},
},
"message": {
SchemaProps: spec.SchemaProps{
Description: "Human readable message indicating details about last transition.",
Type: []string{"string"},
Format: "",
},
},
},
Required: []string{"type", "status"},
},
},
Dependencies: []string{
"v1.Time"},
},
"v1beta1.JobList": {
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Description: "JobList is a collection of jobs. DEPRECATED: extensions/v1beta1.JobList is deprecated, use batch/v1.JobList instead.",
Properties: map[string]spec.Schema{
"metadata": {
SchemaProps: spec.SchemaProps{
Description: "Standard list metadata More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata",
Ref: spec.MustCreateRef("#/definitions/v1.ListMeta"),
},
},
"items": {
SchemaProps: spec.SchemaProps{
Description: "Items is the list of Job.",
Type: []string{"array"},
Items: &spec.SchemaOrArray{
Schema: &spec.Schema{
SchemaProps: spec.SchemaProps{
Ref: spec.MustCreateRef("#/definitions/v1beta1.Job"),
},
},
},
},
},
},
Required: []string{"items"},
},
},
Dependencies: []string{
"v1.ListMeta", "v1beta1.Job"},
},
"v1beta1.JobSpec": {
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Description: "JobSpec describes how the job execution will look like.",
Properties: map[string]spec.Schema{
"parallelism": {
SchemaProps: spec.SchemaProps{
Description: "Parallelism specifies the maximum desired number of pods the job should run at any given time. The actual number of pods running in steady state will be less than this number when ((.spec.completions - .status.successful) < .spec.parallelism), i.e. when the work left to do is less than max parallelism. More info: http://kubernetes.io/docs/user-guide/jobs",
Type: []string{"integer"},
Format: "int32",
},
},
"completions": {
SchemaProps: spec.SchemaProps{
Description: "Completions specifies the desired number of successfully finished pods the job should be run with. Setting to nil means that the success of any pod signals the success of all pods, and allows parallelism to have any positive value. Setting to 1 means that parallelism is limited to 1 and the success of that pod signals the success of the job. More info: http://kubernetes.io/docs/user-guide/jobs",
Type: []string{"integer"},
Format: "int32",
},
},
"activeDeadlineSeconds": {
SchemaProps: spec.SchemaProps{
Description: "Optional duration in seconds relative to the startTime that the job may be active before the system tries to terminate it; value must be positive integer",
Type: []string{"integer"},
Format: "int64",
},
},
"selector": {
SchemaProps: spec.SchemaProps{
Description: "Selector is a label query over pods that should match the pod count. Normally, the system sets this field for you. More info: http://kubernetes.io/docs/user-guide/labels#label-selectors",
Ref: spec.MustCreateRef("#/definitions/v1.LabelSelector"),
},
},
"autoSelector": {
SchemaProps: spec.SchemaProps{
Description: "AutoSelector controls generation of pod labels and pod selectors. It was not present in the original extensions/v1beta1 Job definition, but exists to allow conversion from batch/v1 Jobs, where it corresponds to, but has the opposite meaning as, ManualSelector. More info: http://releases.k8s.io/HEAD/docs/design/selector-generation.md",
Type: []string{"boolean"},
Format: "",
},
},
"template": {
SchemaProps: spec.SchemaProps{
Description: "Template is the object that describes the pod that will be created when executing a job. More info: http://kubernetes.io/docs/user-guide/jobs",
Ref: spec.MustCreateRef("#/definitions/v1.PodTemplateSpec"),
},
},
},
Required: []string{"template"},
},
},
Dependencies: []string{
"v1.LabelSelector", "v1.PodTemplateSpec"},
},
"v1beta1.JobStatus": {
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Description: "JobStatus represents the current state of a Job.",
Properties: map[string]spec.Schema{
"conditions": {
SchemaProps: spec.SchemaProps{
Description: "Conditions represent the latest available observations of an object's current state. More info: http://kubernetes.io/docs/user-guide/jobs",
Type: []string{"array"},
Items: &spec.SchemaOrArray{
Schema: &spec.Schema{
SchemaProps: spec.SchemaProps{
Ref: spec.MustCreateRef("#/definitions/v1beta1.JobCondition"),
},
},
},
},
},
"startTime": {
SchemaProps: spec.SchemaProps{
Description: "StartTime represents time when the job was acknowledged by the Job Manager. It is not guaranteed to be set in happens-before order across separate operations. It is represented in RFC3339 form and is in UTC.",
Ref: spec.MustCreateRef("#/definitions/v1.Time"),
},
},
"completionTime": {
SchemaProps: spec.SchemaProps{
Description: "CompletionTime represents time when the job was completed. It is not guaranteed to be set in happens-before order across separate operations. It is represented in RFC3339 form and is in UTC.",
Ref: spec.MustCreateRef("#/definitions/v1.Time"),
},
},
"active": {
SchemaProps: spec.SchemaProps{
Description: "Active is the number of actively running pods.",
Type: []string{"integer"},
Format: "int32",
},
},
"succeeded": {
SchemaProps: spec.SchemaProps{
Description: "Succeeded is the number of pods which reached Phase Succeeded.",
Type: []string{"integer"},
Format: "int32",
},
},
"failed": {
SchemaProps: spec.SchemaProps{
Description: "Failed is the number of pods which reached Phase Failed.",
Type: []string{"integer"},
Format: "int32",
},
},
},
},
},
Dependencies: []string{
"v1.Time", "v1beta1.JobCondition"},
},
"v1beta1.LocalSubjectAccessReview": { "v1beta1.LocalSubjectAccessReview": {
Schema: spec.Schema{ Schema: spec.Schema{
SchemaProps: spec.SchemaProps{ SchemaProps: spec.SchemaProps{
......
...@@ -112,10 +112,10 @@ func TestParseRuntimeConfig(t *testing.T) { ...@@ -112,10 +112,10 @@ func TestParseRuntimeConfig(t *testing.T) {
err: false, err: false,
}, },
{ {
// Enable deployments and disable jobs. // Enable deployments and disable daemonsets.
runtimeConfig: map[string]string{ runtimeConfig: map[string]string{
"extensions/v1beta1/anything": "true", "extensions/v1beta1/anything": "true",
"extensions/v1beta1/jobs": "false", "extensions/v1beta1/daemonsets": "false",
}, },
defaultResourceConfig: func() *ResourceConfig { defaultResourceConfig: func() *ResourceConfig {
config := NewResourceConfig() config := NewResourceConfig()
...@@ -126,7 +126,7 @@ func TestParseRuntimeConfig(t *testing.T) { ...@@ -126,7 +126,7 @@ func TestParseRuntimeConfig(t *testing.T) {
expectedAPIConfig: func() *ResourceConfig { expectedAPIConfig: func() *ResourceConfig {
config := NewResourceConfig() config := NewResourceConfig()
config.EnableVersions(extensionsGroupVersion) config.EnableVersions(extensionsGroupVersion)
config.DisableResources(extensionsGroupVersion.WithResource("jobs")) config.DisableResources(extensionsGroupVersion.WithResource("daemonsets"))
config.EnableResources(extensionsGroupVersion.WithResource("anything")) config.EnableResources(extensionsGroupVersion.WithResource("anything"))
return config return config
}, },
......
...@@ -64,8 +64,6 @@ go_library( ...@@ -64,8 +64,6 @@ go_library(
"//pkg/apis/apps:go_default_library", "//pkg/apis/apps:go_default_library",
"//pkg/apis/autoscaling:go_default_library", "//pkg/apis/autoscaling:go_default_library",
"//pkg/apis/batch:go_default_library", "//pkg/apis/batch:go_default_library",
"//pkg/apis/batch/v1:go_default_library",
"//pkg/apis/batch/v2alpha1:go_default_library",
"//pkg/apis/certificates:go_default_library", "//pkg/apis/certificates:go_default_library",
"//pkg/apis/extensions:go_default_library", "//pkg/apis/extensions:go_default_library",
"//pkg/apis/extensions/v1beta1:go_default_library", "//pkg/apis/extensions/v1beta1:go_default_library",
......
...@@ -282,7 +282,7 @@ func TestDrain(t *testing.T) { ...@@ -282,7 +282,7 @@ func TestDrain(t *testing.T) {
Name: "job", Name: "job",
Namespace: "default", Namespace: "default",
CreationTimestamp: metav1.Time{Time: time.Now()}, CreationTimestamp: metav1.Time{Time: time.Now()},
SelfLink: "/apis/extensions/v1beta1/namespaces/default/jobs/job", SelfLink: "/apis/batch/v1/namespaces/default/jobs/job",
}, },
Spec: batch.JobSpec{ Spec: batch.JobSpec{
Selector: &metav1.LabelSelector{MatchLabels: labels}, Selector: &metav1.LabelSelector{MatchLabels: labels},
...@@ -525,7 +525,7 @@ func TestDrain(t *testing.T) { ...@@ -525,7 +525,7 @@ func TestDrain(t *testing.T) {
case m.isFor("GET", "/namespaces/default/daemonsets/ds"): case m.isFor("GET", "/namespaces/default/daemonsets/ds"):
return &http.Response{StatusCode: 200, Header: defaultHeader(), Body: objBody(testapi.Extensions.Codec(), &ds)}, nil return &http.Response{StatusCode: 200, Header: defaultHeader(), Body: objBody(testapi.Extensions.Codec(), &ds)}, nil
case m.isFor("GET", "/namespaces/default/jobs/job"): case m.isFor("GET", "/namespaces/default/jobs/job"):
return &http.Response{StatusCode: 200, Header: defaultHeader(), Body: objBody(testapi.Extensions.Codec(), &job)}, nil return &http.Response{StatusCode: 200, Header: defaultHeader(), Body: objBody(testapi.Batch.Codec(), &job)}, nil
case m.isFor("GET", "/namespaces/default/replicasets/rs"): case m.isFor("GET", "/namespaces/default/replicasets/rs"):
return &http.Response{StatusCode: 200, Header: defaultHeader(), Body: objBody(testapi.Extensions.Codec(), &test.replicaSets[0])}, nil return &http.Response{StatusCode: 200, Header: defaultHeader(), Body: objBody(testapi.Extensions.Codec(), &test.replicaSets[0])}, nil
case m.isFor("GET", "/namespaces/default/pods/bar"): case m.isFor("GET", "/namespaces/default/pods/bar"):
......
...@@ -220,8 +220,6 @@ func Run(f cmdutil.Factory, cmdIn io.Reader, cmdOut, cmdErr io.Writer, cmd *cobr ...@@ -220,8 +220,6 @@ func Run(f cmdutil.Factory, cmdIn io.Reader, cmdOut, cmdErr io.Writer, cmd *cobr
case api.RestartPolicyOnFailure: case api.RestartPolicyOnFailure:
if contains(resourcesList, batchv1.SchemeGroupVersion.WithResource("jobs")) { if contains(resourcesList, batchv1.SchemeGroupVersion.WithResource("jobs")) {
generatorName = "job/v1" generatorName = "job/v1"
} else if contains(resourcesList, v1beta1.SchemeGroupVersion.WithResource("jobs")) {
generatorName = "job/v1beta1"
} else { } else {
generatorName = "run-pod/v1" generatorName = "run-pod/v1"
} }
...@@ -229,9 +227,6 @@ func Run(f cmdutil.Factory, cmdIn io.Reader, cmdOut, cmdErr io.Writer, cmd *cobr ...@@ -229,9 +227,6 @@ func Run(f cmdutil.Factory, cmdIn io.Reader, cmdOut, cmdErr io.Writer, cmd *cobr
generatorName = "run-pod/v1" generatorName = "run-pod/v1"
} }
} }
if generatorName == "job/v1beta1" {
fmt.Fprintf(cmdErr, "DEPRECATED: --generator=job/v1beta1 is deprecated, use job/v1 instead.\n")
}
generators := f.Generators("run") generators := f.Generators("run")
generator, found := generators[generatorName] generator, found := generators[generatorName]
if !found { if !found {
......
...@@ -442,7 +442,6 @@ const ( ...@@ -442,7 +442,6 @@ const (
HorizontalPodAutoscalerV1GeneratorName = "horizontalpodautoscaler/v1" HorizontalPodAutoscalerV1GeneratorName = "horizontalpodautoscaler/v1"
DeploymentV1Beta1GeneratorName = "deployment/v1beta1" DeploymentV1Beta1GeneratorName = "deployment/v1beta1"
DeploymentBasicV1Beta1GeneratorName = "deployment-basic/v1beta1" DeploymentBasicV1Beta1GeneratorName = "deployment-basic/v1beta1"
JobV1Beta1GeneratorName = "job/v1beta1"
JobV1GeneratorName = "job/v1" JobV1GeneratorName = "job/v1"
CronJobV2Alpha1GeneratorName = "cronjob/v2alpha1" CronJobV2Alpha1GeneratorName = "cronjob/v2alpha1"
ScheduledJobV2Alpha1GeneratorName = "scheduledjob/v2alpha1" ScheduledJobV2Alpha1GeneratorName = "scheduledjob/v2alpha1"
...@@ -487,7 +486,6 @@ func DefaultGenerators(cmdName string) map[string]kubectl.Generator { ...@@ -487,7 +486,6 @@ func DefaultGenerators(cmdName string) map[string]kubectl.Generator {
RunV1GeneratorName: kubectl.BasicReplicationController{}, RunV1GeneratorName: kubectl.BasicReplicationController{},
RunPodV1GeneratorName: kubectl.BasicPod{}, RunPodV1GeneratorName: kubectl.BasicPod{},
DeploymentV1Beta1GeneratorName: kubectl.DeploymentV1Beta1{}, DeploymentV1Beta1GeneratorName: kubectl.DeploymentV1Beta1{},
JobV1Beta1GeneratorName: kubectl.JobV1Beta1{},
JobV1GeneratorName: kubectl.JobV1{}, JobV1GeneratorName: kubectl.JobV1{},
ScheduledJobV2Alpha1GeneratorName: kubectl.CronJobV2Alpha1{}, ScheduledJobV2Alpha1GeneratorName: kubectl.CronJobV2Alpha1{},
CronJobV2Alpha1GeneratorName: kubectl.CronJobV2Alpha1{}, CronJobV2Alpha1GeneratorName: kubectl.CronJobV2Alpha1{},
......
...@@ -106,7 +106,7 @@ var userResources = []schema.GroupResource{ ...@@ -106,7 +106,7 @@ var userResources = []schema.GroupResource{
{Group: "", Resource: "services"}, {Group: "", Resource: "services"},
{Group: "apps", Resource: "statefulsets"}, {Group: "apps", Resource: "statefulsets"},
{Group: "autoscaling", Resource: "horizontalpodautoscalers"}, {Group: "autoscaling", Resource: "horizontalpodautoscalers"},
{Group: "extensions", Resource: "jobs"}, {Group: "batch", Resource: "jobs"},
{Group: "extensions", Resource: "deployments"}, {Group: "extensions", Resource: "deployments"},
{Group: "extensions", Resource: "replicasets"}, {Group: "extensions", Resource: "replicasets"},
} }
......
...@@ -142,7 +142,6 @@ func describerMap(c clientset.Interface) map[schema.GroupKind]Describer { ...@@ -142,7 +142,6 @@ func describerMap(c clientset.Interface) map[schema.GroupKind]Describer {
autoscaling.Kind("HorizontalPodAutoscaler"): &HorizontalPodAutoscalerDescriber{c}, autoscaling.Kind("HorizontalPodAutoscaler"): &HorizontalPodAutoscalerDescriber{c},
extensions.Kind("DaemonSet"): &DaemonSetDescriber{c}, extensions.Kind("DaemonSet"): &DaemonSetDescriber{c},
extensions.Kind("Deployment"): &DeploymentDescriber{c, versionedClientsetForDeployment(c)}, extensions.Kind("Deployment"): &DeploymentDescriber{c, versionedClientsetForDeployment(c)},
extensions.Kind("Job"): &JobDescriber{c},
extensions.Kind("Ingress"): &IngressDescriber{c}, extensions.Kind("Ingress"): &IngressDescriber{c},
batch.Kind("Job"): &JobDescriber{c}, batch.Kind("Job"): &JobDescriber{c},
batch.Kind("CronJob"): &CronJobDescriber{c}, batch.Kind("CronJob"): &CronJobDescriber{c},
......
...@@ -758,10 +758,6 @@ func TestGenerateJob(t *testing.T) { ...@@ -758,10 +758,6 @@ func TestGenerateJob(t *testing.T) {
Labels: map[string]string{"foo": "bar", "baz": "blah"}, Labels: map[string]string{"foo": "bar", "baz": "blah"},
}, },
Spec: batch.JobSpec{ Spec: batch.JobSpec{
Selector: &metav1.LabelSelector{
MatchLabels: map[string]string{"foo": "bar", "baz": "blah"},
},
ManualSelector: newBool(true),
Template: api.PodTemplateSpec{ Template: api.PodTemplateSpec{
ObjectMeta: api.ObjectMeta{ ObjectMeta: api.ObjectMeta{
Labels: map[string]string{"foo": "bar", "baz": "blah"}, Labels: map[string]string{"foo": "bar", "baz": "blah"},
...@@ -810,7 +806,7 @@ func TestGenerateJob(t *testing.T) { ...@@ -810,7 +806,7 @@ func TestGenerateJob(t *testing.T) {
}, },
} }
generator := JobV1Beta1{} generator := JobV1{}
for _, test := range tests { for _, test := range tests {
obj, err := generator.Generate(test.params) obj, err := generator.Generate(test.params)
if !test.expectErr && err != nil { if !test.expectErr && err != nil {
......
...@@ -56,7 +56,7 @@ func ScalerFor(kind schema.GroupKind, c internalclientset.Interface) (Scaler, er ...@@ -56,7 +56,7 @@ func ScalerFor(kind schema.GroupKind, c internalclientset.Interface) (Scaler, er
return &ReplicationControllerScaler{c.Core()}, nil return &ReplicationControllerScaler{c.Core()}, nil
case extensions.Kind("ReplicaSet"): case extensions.Kind("ReplicaSet"):
return &ReplicaSetScaler{c.Extensions()}, nil return &ReplicaSetScaler{c.Extensions()}, nil
case extensions.Kind("Job"), batch.Kind("Job"): case batch.Kind("Job"):
return &JobScaler{c.Batch()}, nil // Either kind of job can be scaled with Batch interface. return &JobScaler{c.Batch()}, nil // Either kind of job can be scaled with Batch interface.
case apps.Kind("StatefulSet"): case apps.Kind("StatefulSet"):
return &StatefulSetScaler{c.Apps()}, nil return &StatefulSetScaler{c.Apps()}, nil
......
...@@ -85,7 +85,7 @@ func ReaperFor(kind schema.GroupKind, c internalclientset.Interface) (Reaper, er ...@@ -85,7 +85,7 @@ func ReaperFor(kind schema.GroupKind, c internalclientset.Interface) (Reaper, er
case api.Kind("Service"): case api.Kind("Service"):
return &ServiceReaper{c.Core()}, nil return &ServiceReaper{c.Core()}, nil
case extensions.Kind("Job"), batch.Kind("Job"): case batch.Kind("Job"):
return &JobReaper{c.Batch(), c.Core(), Interval, Timeout}, nil return &JobReaper{c.Batch(), c.Core(), Interval, Timeout}, nil
case apps.Kind("StatefulSet"): case apps.Kind("StatefulSet"):
......
...@@ -405,7 +405,6 @@ func DefaultAPIResourceConfigSource() *genericapiserver.ResourceConfig { ...@@ -405,7 +405,6 @@ func DefaultAPIResourceConfigSource() *genericapiserver.ResourceConfig {
extensionsapiv1beta1.SchemeGroupVersion.WithResource("deployments"), extensionsapiv1beta1.SchemeGroupVersion.WithResource("deployments"),
extensionsapiv1beta1.SchemeGroupVersion.WithResource("horizontalpodautoscalers"), extensionsapiv1beta1.SchemeGroupVersion.WithResource("horizontalpodautoscalers"),
extensionsapiv1beta1.SchemeGroupVersion.WithResource("ingresses"), extensionsapiv1beta1.SchemeGroupVersion.WithResource("ingresses"),
extensionsapiv1beta1.SchemeGroupVersion.WithResource("jobs"),
extensionsapiv1beta1.SchemeGroupVersion.WithResource("networkpolicies"), extensionsapiv1beta1.SchemeGroupVersion.WithResource("networkpolicies"),
extensionsapiv1beta1.SchemeGroupVersion.WithResource("replicasets"), extensionsapiv1beta1.SchemeGroupVersion.WithResource("replicasets"),
extensionsapiv1beta1.SchemeGroupVersion.WithResource("thirdpartyresources"), extensionsapiv1beta1.SchemeGroupVersion.WithResource("thirdpartyresources"),
......
...@@ -32,7 +32,6 @@ go_test( ...@@ -32,7 +32,6 @@ go_test(
deps = [ deps = [
"//pkg/api:go_default_library", "//pkg/api:go_default_library",
"//pkg/apis/batch:go_default_library", "//pkg/apis/batch:go_default_library",
"//pkg/apis/extensions:go_default_library",
"//pkg/apis/meta/v1:go_default_library", "//pkg/apis/meta/v1:go_default_library",
"//pkg/fields:go_default_library", "//pkg/fields:go_default_library",
"//pkg/labels:go_default_library", "//pkg/labels:go_default_library",
......
...@@ -21,7 +21,6 @@ import ( ...@@ -21,7 +21,6 @@ import (
"k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/apis/batch" "k8s.io/kubernetes/pkg/apis/batch"
"k8s.io/kubernetes/pkg/apis/extensions"
metav1 "k8s.io/kubernetes/pkg/apis/meta/v1" metav1 "k8s.io/kubernetes/pkg/apis/meta/v1"
"k8s.io/kubernetes/pkg/fields" "k8s.io/kubernetes/pkg/fields"
"k8s.io/kubernetes/pkg/labels" "k8s.io/kubernetes/pkg/labels"
...@@ -32,7 +31,7 @@ import ( ...@@ -32,7 +31,7 @@ import (
) )
func newStorage(t *testing.T) (*REST, *StatusREST, *etcdtesting.EtcdTestServer) { func newStorage(t *testing.T) (*REST, *StatusREST, *etcdtesting.EtcdTestServer) {
etcdStorage, server := registrytest.NewEtcdStorage(t, extensions.GroupName) etcdStorage, server := registrytest.NewEtcdStorage(t, batch.GroupName)
restOptions := generic.RESTOptions{ restOptions := generic.RESTOptions{
StorageConfig: etcdStorage, StorageConfig: etcdStorage,
Decorator: generic.UndecoratedStorage, Decorator: generic.UndecoratedStorage,
......
...@@ -223,7 +223,7 @@ func TestJobStatusStrategy(t *testing.T) { ...@@ -223,7 +223,7 @@ func TestJobStatusStrategy(t *testing.T) {
func TestSelectableFieldLabelConversions(t *testing.T) { func TestSelectableFieldLabelConversions(t *testing.T) {
apitesting.TestSelectableFieldLabelConversionsOfKind(t, apitesting.TestSelectableFieldLabelConversionsOfKind(t,
testapi.Extensions.GroupVersion().String(), testapi.Batch.GroupVersion().String(),
"Job", "Job",
JobToSelectableFields(&batch.Job{}), JobToSelectableFields(&batch.Job{}),
nil, nil,
......
...@@ -148,8 +148,8 @@ func init() { ...@@ -148,8 +148,8 @@ func init() {
addControllerRole(rbac.ClusterRole{ addControllerRole(rbac.ClusterRole{
ObjectMeta: api.ObjectMeta{Name: saRolePrefix + "job-controller"}, ObjectMeta: api.ObjectMeta{Name: saRolePrefix + "job-controller"},
Rules: []rbac.PolicyRule{ Rules: []rbac.PolicyRule{
rbac.NewRule("get", "list", "watch", "update").Groups(batchGroup, extensionsGroup).Resources("jobs").RuleOrDie(), rbac.NewRule("get", "list", "watch", "update").Groups(batchGroup).Resources("jobs").RuleOrDie(),
rbac.NewRule("update").Groups(batchGroup, extensionsGroup).Resources("jobs/status").RuleOrDie(), rbac.NewRule("update").Groups(batchGroup).Resources("jobs/status").RuleOrDie(),
rbac.NewRule("list", "watch", "create", "delete").Groups(legacyGroup).Resources("pods").RuleOrDie(), rbac.NewRule("list", "watch", "create", "delete").Groups(legacyGroup).Resources("pods").RuleOrDie(),
eventsRule(), eventsRule(),
}, },
......
...@@ -114,7 +114,7 @@ func ClusterRoles() []rbac.ClusterRole { ...@@ -114,7 +114,7 @@ func ClusterRoles() []rbac.ClusterRole {
rbac.NewRule(ReadWrite...).Groups(batchGroup).Resources("jobs", "cronjobs", "scheduledjobs").RuleOrDie(), rbac.NewRule(ReadWrite...).Groups(batchGroup).Resources("jobs", "cronjobs", "scheduledjobs").RuleOrDie(),
rbac.NewRule(ReadWrite...).Groups(extensionsGroup).Resources("jobs", "daemonsets", "horizontalpodautoscalers", rbac.NewRule(ReadWrite...).Groups(extensionsGroup).Resources("daemonsets", "horizontalpodautoscalers",
"replicationcontrollers/scale", "replicasets", "replicasets/scale", "deployments", "deployments/scale").RuleOrDie(), "replicationcontrollers/scale", "replicasets", "replicasets/scale", "deployments", "deployments/scale").RuleOrDie(),
// additional admin powers // additional admin powers
...@@ -144,7 +144,7 @@ func ClusterRoles() []rbac.ClusterRole { ...@@ -144,7 +144,7 @@ func ClusterRoles() []rbac.ClusterRole {
rbac.NewRule(ReadWrite...).Groups(batchGroup).Resources("jobs", "cronjobs", "scheduledjobs").RuleOrDie(), rbac.NewRule(ReadWrite...).Groups(batchGroup).Resources("jobs", "cronjobs", "scheduledjobs").RuleOrDie(),
rbac.NewRule(ReadWrite...).Groups(extensionsGroup).Resources("jobs", "daemonsets", "horizontalpodautoscalers", rbac.NewRule(ReadWrite...).Groups(extensionsGroup).Resources("daemonsets", "horizontalpodautoscalers",
"replicationcontrollers/scale", "replicasets", "replicasets/scale", "deployments", "deployments/scale").RuleOrDie(), "replicationcontrollers/scale", "replicasets", "replicasets/scale", "deployments", "deployments/scale").RuleOrDie(),
}, },
}, },
...@@ -167,7 +167,7 @@ func ClusterRoles() []rbac.ClusterRole { ...@@ -167,7 +167,7 @@ func ClusterRoles() []rbac.ClusterRole {
rbac.NewRule(Read...).Groups(batchGroup).Resources("jobs", "cronjobs", "scheduledjobs").RuleOrDie(), rbac.NewRule(Read...).Groups(batchGroup).Resources("jobs", "cronjobs", "scheduledjobs").RuleOrDie(),
rbac.NewRule(Read...).Groups(extensionsGroup).Resources("jobs", "daemonsets", "horizontalpodautoscalers", rbac.NewRule(Read...).Groups(extensionsGroup).Resources("daemonsets", "horizontalpodautoscalers",
"replicationcontrollers/scale", "replicasets", "replicasets/scale", "deployments", "deployments/scale").RuleOrDie(), "replicationcontrollers/scale", "replicasets", "replicasets/scale", "deployments", "deployments/scale").RuleOrDie(),
}, },
}, },
......
...@@ -133,7 +133,6 @@ items: ...@@ -133,7 +133,6 @@ items:
- deployments - deployments
- deployments/scale - deployments/scale
- horizontalpodautoscalers - horizontalpodautoscalers
- jobs
- replicasets - replicasets
- replicasets/scale - replicasets/scale
- replicationcontrollers/scale - replicationcontrollers/scale
...@@ -321,7 +320,6 @@ items: ...@@ -321,7 +320,6 @@ items:
- deployments - deployments
- deployments/scale - deployments/scale
- horizontalpodautoscalers - horizontalpodautoscalers
- jobs
- replicasets - replicasets
- replicasets/scale - replicasets/scale
- replicationcontrollers/scale - replicationcontrollers/scale
...@@ -689,7 +687,6 @@ items: ...@@ -689,7 +687,6 @@ items:
- deployments - deployments
- deployments/scale - deployments/scale
- horizontalpodautoscalers - horizontalpodautoscalers
- jobs
- replicasets - replicasets
- replicasets/scale - replicasets/scale
- replicationcontrollers/scale - replicationcontrollers/scale
......
...@@ -440,7 +440,6 @@ items: ...@@ -440,7 +440,6 @@ items:
rules: rules:
- apiGroups: - apiGroups:
- batch - batch
- extensions
attributeRestrictions: null attributeRestrictions: null
resources: resources:
- jobs - jobs
...@@ -451,7 +450,6 @@ items: ...@@ -451,7 +450,6 @@ items:
- watch - watch
- apiGroups: - apiGroups:
- batch - batch
- extensions
attributeRestrictions: null attributeRestrictions: null
resources: resources:
- jobs/status - jobs/status
......
...@@ -26,11 +26,6 @@ ...@@ -26,11 +26,6 @@
"Rev": "5bd2802263f21d8788851d5305584c82a5c75d7e" "Rev": "5bd2802263f21d8788851d5305584c82a5c75d7e"
}, },
{ {
"ImportPath": "github.com/blang/semver",
"Comment": "v3.0.1",
"Rev": "31b736133b98f26d5e078ec9eb591666edfd091f"
},
{
"ImportPath": "github.com/coreos/go-oidc/http", "ImportPath": "github.com/coreos/go-oidc/http",
"Rev": "5644a2f50e2d2d5ba0b474bc5bc55fea1925936d" "Rev": "5644a2f50e2d2d5ba0b474bc5bc55fea1925936d"
}, },
...@@ -89,18 +84,18 @@ ...@@ -89,18 +84,18 @@
}, },
{ {
"ImportPath": "github.com/emicklei/go-restful", "ImportPath": "github.com/emicklei/go-restful",
"Comment": "v1.2-79-g89ef8af", "Comment": "v1.2-96-g09691a3",
"Rev": "89ef8af493ab468a45a42bb0d89a06fccdd2fb22" "Rev": "09691a3b6378b740595c1002f40c34dd5f218a22"
}, },
{ {
"ImportPath": "github.com/emicklei/go-restful/log", "ImportPath": "github.com/emicklei/go-restful/log",
"Comment": "v1.2-79-g89ef8af", "Comment": "v1.2-96-g09691a3",
"Rev": "89ef8af493ab468a45a42bb0d89a06fccdd2fb22" "Rev": "09691a3b6378b740595c1002f40c34dd5f218a22"
}, },
{ {
"ImportPath": "github.com/emicklei/go-restful/swagger", "ImportPath": "github.com/emicklei/go-restful/swagger",
"Comment": "v1.2-79-g89ef8af", "Comment": "v1.2-96-g09691a3",
"Rev": "89ef8af493ab468a45a42bb0d89a06fccdd2fb22" "Rev": "09691a3b6378b740595c1002f40c34dd5f218a22"
}, },
{ {
"ImportPath": "github.com/ghodss/yaml", "ImportPath": "github.com/ghodss/yaml",
...@@ -146,7 +141,7 @@ ...@@ -146,7 +141,7 @@
}, },
{ {
"ImportPath": "github.com/google/gofuzz", "ImportPath": "github.com/google/gofuzz",
"Rev": "bbcb9da2d746f8bdbd6a936686a0a6067ada0ec5" "Rev": "44d81051d367757e1c7c6a5a86423ece9afcf63c"
}, },
{ {
"ImportPath": "github.com/howeyc/gopass", "ImportPath": "github.com/howeyc/gopass",
......
The MIT License
Copyright (c) 2014 Benedikt Lang <github at benediktlang.de>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
semver for golang [![Build Status](https://drone.io/github.com/blang/semver/status.png)](https://drone.io/github.com/blang/semver/latest) [![GoDoc](https://godoc.org/github.com/blang/semver?status.png)](https://godoc.org/github.com/blang/semver) [![Coverage Status](https://img.shields.io/coveralls/blang/semver.svg)](https://coveralls.io/r/blang/semver?branch=master)
======
semver is a [Semantic Versioning](http://semver.org/) library written in golang. It fully covers spec version `2.0.0`.
Usage
-----
```bash
$ go get github.com/blang/semver
```
Note: Always vendor your dependencies or fix on a specific version tag.
```go
import github.com/blang/semver
v1, err := semver.Make("1.0.0-beta")
v2, err := semver.Make("2.0.0-beta")
v1.Compare(v2)
```
Also check the [GoDocs](http://godoc.org/github.com/blang/semver).
Why should I use this lib?
-----
- Fully spec compatible
- No reflection
- No regex
- Fully tested (Coverage >99%)
- Readable parsing/validation errors
- Fast (See [Benchmarks](#benchmarks))
- Only Stdlib
- Uses values instead of pointers
- Many features, see below
Features
-----
- Parsing and validation at all levels
- Comparator-like comparisons
- Compare Helper Methods
- InPlace manipulation
- Sortable (implements sort.Interface)
- database/sql compatible (sql.Scanner/Valuer)
- encoding/json compatible (json.Marshaler/Unmarshaler)
Example
-----
Have a look at full examples in [examples/main.go](examples/main.go)
```go
import github.com/blang/semver
v, err := semver.Make("0.0.1-alpha.preview+123.github")
fmt.Printf("Major: %d\n", v.Major)
fmt.Printf("Minor: %d\n", v.Minor)
fmt.Printf("Patch: %d\n", v.Patch)
fmt.Printf("Pre: %s\n", v.Pre)
fmt.Printf("Build: %s\n", v.Build)
// Prerelease versions array
if len(v.Pre) > 0 {
fmt.Println("Prerelease versions:")
for i, pre := range v.Pre {
fmt.Printf("%d: %q\n", i, pre)
}
}
// Build meta data array
if len(v.Build) > 0 {
fmt.Println("Build meta data:")
for i, build := range v.Build {
fmt.Printf("%d: %q\n", i, build)
}
}
v001, err := semver.Make("0.0.1")
// Compare using helpers: v.GT(v2), v.LT, v.GTE, v.LTE
v001.GT(v) == true
v.LT(v001) == true
v.GTE(v) == true
v.LTE(v) == true
// Or use v.Compare(v2) for comparisons (-1, 0, 1):
v001.Compare(v) == 1
v.Compare(v001) == -1
v.Compare(v) == 0
// Manipulate Version in place:
v.Pre[0], err = semver.NewPRVersion("beta")
if err != nil {
fmt.Printf("Error parsing pre release version: %q", err)
}
fmt.Println("\nValidate versions:")
v.Build[0] = "?"
err = v.Validate()
if err != nil {
fmt.Printf("Validation failed: %s\n", err)
}
```
Benchmarks
-----
BenchmarkParseSimple 5000000 328 ns/op 49 B/op 1 allocs/op
BenchmarkParseComplex 1000000 2105 ns/op 263 B/op 7 allocs/op
BenchmarkParseAverage 1000000 1301 ns/op 168 B/op 4 allocs/op
BenchmarkStringSimple 10000000 130 ns/op 5 B/op 1 allocs/op
BenchmarkStringLarger 5000000 280 ns/op 32 B/op 2 allocs/op
BenchmarkStringComplex 3000000 512 ns/op 80 B/op 3 allocs/op
BenchmarkStringAverage 5000000 387 ns/op 47 B/op 2 allocs/op
BenchmarkValidateSimple 500000000 7.92 ns/op 0 B/op 0 allocs/op
BenchmarkValidateComplex 2000000 923 ns/op 0 B/op 0 allocs/op
BenchmarkValidateAverage 5000000 452 ns/op 0 B/op 0 allocs/op
BenchmarkCompareSimple 100000000 11.2 ns/op 0 B/op 0 allocs/op
BenchmarkCompareComplex 50000000 40.9 ns/op 0 B/op 0 allocs/op
BenchmarkCompareAverage 50000000 43.8 ns/op 0 B/op 0 allocs/op
BenchmarkSort 5000000 436 ns/op 259 B/op 2 allocs/op
See benchmark cases at [semver_test.go](semver_test.go)
Motivation
-----
I simply couldn't find any lib supporting the full spec. Others were just wrong or used reflection and regex which i don't like.
Contribution
-----
Feel free to make a pull request. For bigger changes create a issue first to discuss about it.
License
-----
See [LICENSE](LICENSE) file.
package semver
import (
"encoding/json"
)
// MarshalJSON implements the encoding/json.Marshaler interface.
func (v Version) MarshalJSON() ([]byte, error) {
return json.Marshal(v.String())
}
// UnmarshalJSON implements the encoding/json.Unmarshaler interface.
func (v *Version) UnmarshalJSON(data []byte) (err error) {
var versionString string
if err = json.Unmarshal(data, &versionString); err != nil {
return
}
*v, err = Parse(versionString)
return
}
package semver
import (
"errors"
"fmt"
"strconv"
"strings"
)
const (
numbers string = "0123456789"
alphas = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-"
alphanum = alphas + numbers
)
// SpecVersion is the latest fully supported spec version of semver
var SpecVersion = Version{
Major: 2,
Minor: 0,
Patch: 0,
}
// Version represents a semver compatible version
type Version struct {
Major uint64
Minor uint64
Patch uint64
Pre []PRVersion
Build []string //No Precendence
}
// Version to string
func (v Version) String() string {
b := make([]byte, 0, 5)
b = strconv.AppendUint(b, v.Major, 10)
b = append(b, '.')
b = strconv.AppendUint(b, v.Minor, 10)
b = append(b, '.')
b = strconv.AppendUint(b, v.Patch, 10)
if len(v.Pre) > 0 {
b = append(b, '-')
b = append(b, v.Pre[0].String()...)
for _, pre := range v.Pre[1:] {
b = append(b, '.')
b = append(b, pre.String()...)
}
}
if len(v.Build) > 0 {
b = append(b, '+')
b = append(b, v.Build[0]...)
for _, build := range v.Build[1:] {
b = append(b, '.')
b = append(b, build...)
}
}
return string(b)
}
// Equals checks if v is equal to o.
func (v Version) Equals(o Version) bool {
return (v.Compare(o) == 0)
}
// EQ checks if v is equal to o.
func (v Version) EQ(o Version) bool {
return (v.Compare(o) == 0)
}
// NE checks if v is not equal to o.
func (v Version) NE(o Version) bool {
return (v.Compare(o) != 0)
}
// GT checks if v is greater than o.
func (v Version) GT(o Version) bool {
return (v.Compare(o) == 1)
}
// GTE checks if v is greater than or equal to o.
func (v Version) GTE(o Version) bool {
return (v.Compare(o) >= 0)
}
// GE checks if v is greater than or equal to o.
func (v Version) GE(o Version) bool {
return (v.Compare(o) >= 0)
}
// LT checks if v is less than o.
func (v Version) LT(o Version) bool {
return (v.Compare(o) == -1)
}
// LTE checks if v is less than or equal to o.
func (v Version) LTE(o Version) bool {
return (v.Compare(o) <= 0)
}
// LE checks if v is less than or equal to o.
func (v Version) LE(o Version) bool {
return (v.Compare(o) <= 0)
}
// Compare compares Versions v to o:
// -1 == v is less than o
// 0 == v is equal to o
// 1 == v is greater than o
func (v Version) Compare(o Version) int {
if v.Major != o.Major {
if v.Major > o.Major {
return 1
}
return -1
}
if v.Minor != o.Minor {
if v.Minor > o.Minor {
return 1
}
return -1
}
if v.Patch != o.Patch {
if v.Patch > o.Patch {
return 1
}
return -1
}
// Quick comparison if a version has no prerelease versions
if len(v.Pre) == 0 && len(o.Pre) == 0 {
return 0
} else if len(v.Pre) == 0 && len(o.Pre) > 0 {
return 1
} else if len(v.Pre) > 0 && len(o.Pre) == 0 {
return -1
}
i := 0
for ; i < len(v.Pre) && i < len(o.Pre); i++ {
if comp := v.Pre[i].Compare(o.Pre[i]); comp == 0 {
continue
} else if comp == 1 {
return 1
} else {
return -1
}
}
// If all pr versions are the equal but one has further prversion, this one greater
if i == len(v.Pre) && i == len(o.Pre) {
return 0
} else if i == len(v.Pre) && i < len(o.Pre) {
return -1
} else {
return 1
}
}
// Validate validates v and returns error in case
func (v Version) Validate() error {
// Major, Minor, Patch already validated using uint64
for _, pre := range v.Pre {
if !pre.IsNum { //Numeric prerelease versions already uint64
if len(pre.VersionStr) == 0 {
return fmt.Errorf("Prerelease can not be empty %q", pre.VersionStr)
}
if !containsOnly(pre.VersionStr, alphanum) {
return fmt.Errorf("Invalid character(s) found in prerelease %q", pre.VersionStr)
}
}
}
for _, build := range v.Build {
if len(build) == 0 {
return fmt.Errorf("Build meta data can not be empty %q", build)
}
if !containsOnly(build, alphanum) {
return fmt.Errorf("Invalid character(s) found in build meta data %q", build)
}
}
return nil
}
// New is an alias for Parse and returns a pointer, parses version string and returns a validated Version or error
func New(s string) (vp *Version, err error) {
v, err := Parse(s)
vp = &v
return
}
// Make is an alias for Parse, parses version string and returns a validated Version or error
func Make(s string) (Version, error) {
return Parse(s)
}
// Parse parses version string and returns a validated Version or error
func Parse(s string) (Version, error) {
if len(s) == 0 {
return Version{}, errors.New("Version string empty")
}
// Split into major.minor.(patch+pr+meta)
parts := strings.SplitN(s, ".", 3)
if len(parts) != 3 {
return Version{}, errors.New("No Major.Minor.Patch elements found")
}
// Major
if !containsOnly(parts[0], numbers) {
return Version{}, fmt.Errorf("Invalid character(s) found in major number %q", parts[0])
}
if hasLeadingZeroes(parts[0]) {
return Version{}, fmt.Errorf("Major number must not contain leading zeroes %q", parts[0])
}
major, err := strconv.ParseUint(parts[0], 10, 64)
if err != nil {
return Version{}, err
}
// Minor
if !containsOnly(parts[1], numbers) {
return Version{}, fmt.Errorf("Invalid character(s) found in minor number %q", parts[1])
}
if hasLeadingZeroes(parts[1]) {
return Version{}, fmt.Errorf("Minor number must not contain leading zeroes %q", parts[1])
}
minor, err := strconv.ParseUint(parts[1], 10, 64)
if err != nil {
return Version{}, err
}
v := Version{}
v.Major = major
v.Minor = minor
var build, prerelease []string
patchStr := parts[2]
if buildIndex := strings.IndexRune(patchStr, '+'); buildIndex != -1 {
build = strings.Split(patchStr[buildIndex+1:], ".")
patchStr = patchStr[:buildIndex]
}
if preIndex := strings.IndexRune(patchStr, '-'); preIndex != -1 {
prerelease = strings.Split(patchStr[preIndex+1:], ".")
patchStr = patchStr[:preIndex]
}
if !containsOnly(patchStr, numbers) {
return Version{}, fmt.Errorf("Invalid character(s) found in patch number %q", patchStr)
}
if hasLeadingZeroes(patchStr) {
return Version{}, fmt.Errorf("Patch number must not contain leading zeroes %q", patchStr)
}
patch, err := strconv.ParseUint(patchStr, 10, 64)
if err != nil {
return Version{}, err
}
v.Patch = patch
// Prerelease
for _, prstr := range prerelease {
parsedPR, err := NewPRVersion(prstr)
if err != nil {
return Version{}, err
}
v.Pre = append(v.Pre, parsedPR)
}
// Build meta data
for _, str := range build {
if len(str) == 0 {
return Version{}, errors.New("Build meta data is empty")
}
if !containsOnly(str, alphanum) {
return Version{}, fmt.Errorf("Invalid character(s) found in build meta data %q", str)
}
v.Build = append(v.Build, str)
}
return v, nil
}
// MustParse is like Parse but panics if the version cannot be parsed.
func MustParse(s string) Version {
v, err := Parse(s)
if err != nil {
panic(`semver: Parse(` + s + `): ` + err.Error())
}
return v
}
// PRVersion represents a PreRelease Version
type PRVersion struct {
VersionStr string
VersionNum uint64
IsNum bool
}
// NewPRVersion creates a new valid prerelease version
func NewPRVersion(s string) (PRVersion, error) {
if len(s) == 0 {
return PRVersion{}, errors.New("Prerelease is empty")
}
v := PRVersion{}
if containsOnly(s, numbers) {
if hasLeadingZeroes(s) {
return PRVersion{}, fmt.Errorf("Numeric PreRelease version must not contain leading zeroes %q", s)
}
num, err := strconv.ParseUint(s, 10, 64)
// Might never be hit, but just in case
if err != nil {
return PRVersion{}, err
}
v.VersionNum = num
v.IsNum = true
} else if containsOnly(s, alphanum) {
v.VersionStr = s
v.IsNum = false
} else {
return PRVersion{}, fmt.Errorf("Invalid character(s) found in prerelease %q", s)
}
return v, nil
}
// IsNumeric checks if prerelease-version is numeric
func (v PRVersion) IsNumeric() bool {
return v.IsNum
}
// Compare compares two PreRelease Versions v and o:
// -1 == v is less than o
// 0 == v is equal to o
// 1 == v is greater than o
func (v PRVersion) Compare(o PRVersion) int {
if v.IsNum && !o.IsNum {
return -1
} else if !v.IsNum && o.IsNum {
return 1
} else if v.IsNum && o.IsNum {
if v.VersionNum == o.VersionNum {
return 0
} else if v.VersionNum > o.VersionNum {
return 1
} else {
return -1
}
} else { // both are Alphas
if v.VersionStr == o.VersionStr {
return 0
} else if v.VersionStr > o.VersionStr {
return 1
} else {
return -1
}
}
}
// PreRelease version to string
func (v PRVersion) String() string {
if v.IsNum {
return strconv.FormatUint(v.VersionNum, 10)
}
return v.VersionStr
}
func containsOnly(s string, set string) bool {
return strings.IndexFunc(s, func(r rune) bool {
return !strings.ContainsRune(set, r)
}) == -1
}
func hasLeadingZeroes(s string) bool {
return len(s) > 1 && s[0] == '0'
}
// NewBuildVersion creates a new valid build version
func NewBuildVersion(s string) (string, error) {
if len(s) == 0 {
return "", errors.New("Buildversion is empty")
}
if !containsOnly(s, alphanum) {
return "", fmt.Errorf("Invalid character(s) found in build meta data %q", s)
}
return s, nil
}
package semver
import (
"sort"
)
// Versions represents multiple versions.
type Versions []Version
// Len returns length of version collection
func (s Versions) Len() int {
return len(s)
}
// Swap swaps two versions inside the collection by its indices
func (s Versions) Swap(i, j int) {
s[i], s[j] = s[j], s[i]
}
// Less checks if version at index i is less than version at index j
func (s Versions) Less(i, j int) bool {
return s[i].LT(s[j])
}
// Sort sorts a slice of versions
func Sort(versions []Version) {
sort.Sort(Versions(versions))
}
package semver
import (
"database/sql/driver"
"fmt"
)
// Scan implements the database/sql.Scanner interface.
func (v *Version) Scan(src interface{}) (err error) {
var str string
switch src := src.(type) {
case string:
str = src
case []byte:
str = string(src)
default:
return fmt.Errorf("Version.Scan: cannot convert %T to string.", src)
}
if t, err := Parse(str); err == nil {
*v = t
}
return
}
// Value implements the database/sql/driver.Valuer interface.
func (v Version) Value() (driver.Value, error) {
return v.String(), nil
}
Change history of go-restful Change history of go-restful
= =
2016-11-26
- Default change! now use CurlyRouter (was RouterJSR311)
- Default change! no more caching of request content
- Default change! do not recover from panics
2016-09-22
- fix the DefaultRequestContentType feature
2016-02-14 2016-02-14
- take the qualify factor of the Accept header mediatype into account when deciding the contentype of the response - take the qualify factor of the Accept header mediatype into account when deciding the contentype of the response
- add constructors for custom entity accessors for xml and json - add constructors for custom entity accessors for xml and json
......
...@@ -25,10 +25,10 @@ type Container struct { ...@@ -25,10 +25,10 @@ type Container struct {
ServeMux *http.ServeMux ServeMux *http.ServeMux
isRegisteredOnRoot bool isRegisteredOnRoot bool
containerFilters []FilterFunction containerFilters []FilterFunction
doNotRecover bool // default is false doNotRecover bool // default is true
recoverHandleFunc RecoverHandleFunction recoverHandleFunc RecoverHandleFunction
serviceErrorHandleFunc ServiceErrorHandleFunction serviceErrorHandleFunc ServiceErrorHandleFunction
router RouteSelector // default is a RouterJSR311, CurlyRouter is the faster alternative router RouteSelector // default is a CurlyRouter (RouterJSR311 is a slower alternative)
contentEncodingEnabled bool // default is false contentEncodingEnabled bool // default is false
} }
...@@ -39,10 +39,10 @@ func NewContainer() *Container { ...@@ -39,10 +39,10 @@ func NewContainer() *Container {
ServeMux: http.NewServeMux(), ServeMux: http.NewServeMux(),
isRegisteredOnRoot: false, isRegisteredOnRoot: false,
containerFilters: []FilterFunction{}, containerFilters: []FilterFunction{},
doNotRecover: false, doNotRecover: true,
recoverHandleFunc: logStackOnRecover, recoverHandleFunc: logStackOnRecover,
serviceErrorHandleFunc: writeServiceError, serviceErrorHandleFunc: writeServiceError,
router: RouterJSR311{}, router: CurlyRouter{},
contentEncodingEnabled: false} contentEncodingEnabled: false}
} }
...@@ -69,7 +69,7 @@ func (c *Container) ServiceErrorHandler(handler ServiceErrorHandleFunction) { ...@@ -69,7 +69,7 @@ func (c *Container) ServiceErrorHandler(handler ServiceErrorHandleFunction) {
// DoNotRecover controls whether panics will be caught to return HTTP 500. // DoNotRecover controls whether panics will be caught to return HTTP 500.
// If set to true, Route functions are responsible for handling any error situation. // If set to true, Route functions are responsible for handling any error situation.
// Default value is false = recover from panics. This has performance implications. // Default value is true.
func (c *Container) DoNotRecover(doNot bool) { func (c *Container) DoNotRecover(doNot bool) {
c.doNotRecover = doNot c.doNotRecover = doNot
} }
......
...@@ -108,11 +108,13 @@ func (c CurlyRouter) regularMatchesPathToken(routeToken string, colon int, reque ...@@ -108,11 +108,13 @@ func (c CurlyRouter) regularMatchesPathToken(routeToken string, colon int, reque
return (matched && err == nil), false return (matched && err == nil), false
} }
var jsr311Router = RouterJSR311{}
// detectRoute selectes from a list of Route the first match by inspecting both the Accept and Content-Type // detectRoute selectes from a list of Route the first match by inspecting both the Accept and Content-Type
// headers of the Request. See also RouterJSR311 in jsr311.go // headers of the Request. See also RouterJSR311 in jsr311.go
func (c CurlyRouter) detectRoute(candidateRoutes sortableCurlyRoutes, httpRequest *http.Request) (*Route, error) { func (c CurlyRouter) detectRoute(candidateRoutes sortableCurlyRoutes, httpRequest *http.Request) (*Route, error) {
// tracing is done inside detectRoute // tracing is done inside detectRoute
return RouterJSR311{}.detectRoute(candidateRoutes.routes(), httpRequest) return jsr311Router.detectRoute(candidateRoutes.routes(), httpRequest)
} }
// detectWebService returns the best matching webService given the list of path tokens. // detectWebService returns the best matching webService given the list of path tokens.
......
...@@ -145,22 +145,11 @@ Performance options ...@@ -145,22 +145,11 @@ Performance options
This package has several options that affect the performance of your service. It is important to understand them and how you can change it. This package has several options that affect the performance of your service. It is important to understand them and how you can change it.
restful.DefaultContainer.Router(CurlyRouter{}) restful.DefaultContainer.DoNotRecover(false)
The default router is the RouterJSR311 which is an implementation of its spec (http://jsr311.java.net/nonav/releases/1.1/spec/spec.html).
However, it uses regular expressions for all its routes which, depending on your usecase, may consume a significant amount of time.
The CurlyRouter implementation is more lightweight that also allows you to use wildcards and expressions, but only if needed.
restful.DefaultContainer.DoNotRecover(true)
DoNotRecover controls whether panics will be caught to return HTTP 500. DoNotRecover controls whether panics will be caught to return HTTP 500.
If set to true, Route functions are responsible for handling any error situation. If set to false, the container will recover from panics.
Default value is false; it will recover from panics. This has performance implications. Default value is true
restful.SetCacheReadEntity(false)
SetCacheReadEntity controls whether the response data ([]byte) is cached such that ReadEntity is repeatable.
If you expect to read large amounts of payload data, and you do not use this feature, you should set it to false.
restful.SetCompressorProvider(NewBoundedCachedCompressors(20, 20)) restful.SetCompressorProvider(NewBoundedCachedCompressors(20, 20))
......
...@@ -24,3 +24,12 @@ func (f *FilterChain) ProcessFilter(request *Request, response *Response) { ...@@ -24,3 +24,12 @@ func (f *FilterChain) ProcessFilter(request *Request, response *Response) {
// FilterFunction definitions must call ProcessFilter on the FilterChain to pass on the control and eventually call the RouteFunction // FilterFunction definitions must call ProcessFilter on the FilterChain to pass on the control and eventually call the RouteFunction
type FilterFunction func(*Request, *Response, *FilterChain) type FilterFunction func(*Request, *Response, *FilterChain)
// NoBrowserCacheFilter is a filter function to set HTTP headers that disable browser caching
// See examples/restful-no-cache-filter.go for usage
func NoBrowserCacheFilter(req *Request, resp *Response, chain *FilterChain) {
resp.Header().Set("Cache-Control", "no-cache, no-store, must-revalidate") // HTTP 1.1.
resp.Header().Set("Pragma", "no-cache") // HTTP 1.0.
resp.Header().Set("Expires", "0") // Proxies.
chain.ProcessFilter(req, resp)
}
...@@ -13,7 +13,7 @@ import ( ...@@ -13,7 +13,7 @@ import (
var defaultRequestContentType string var defaultRequestContentType string
var doCacheReadEntityBytes = true var doCacheReadEntityBytes = false
// Request is a wrapper for a http Request that provides convenience methods // Request is a wrapper for a http Request that provides convenience methods
type Request struct { type Request struct {
...@@ -107,10 +107,15 @@ func (r *Request) ReadEntity(entityPointer interface{}) (err error) { ...@@ -107,10 +107,15 @@ func (r *Request) ReadEntity(entityPointer interface{}) (err error) {
r.Request.Body = zlibReader r.Request.Body = zlibReader
} }
// lookup the EntityReader // lookup the EntityReader, use defaultRequestContentType if needed and provided
entityReader, ok := entityAccessRegistry.accessorAt(contentType) entityReader, ok := entityAccessRegistry.accessorAt(contentType)
if !ok { if !ok {
return NewError(http.StatusBadRequest, "Unable to unmarshal content of type:"+contentType) if len(defaultRequestContentType) != 0 {
entityReader, ok = entityAccessRegistry.accessorAt(defaultRequestContentType)
}
if !ok {
return NewError(http.StatusBadRequest, "Unable to unmarshal content of type:"+contentType)
}
} }
return entityReader.Read(r, entityPointer) return entityReader.Read(r, entityPointer)
} }
......
...@@ -2,6 +2,7 @@ package swagger ...@@ -2,6 +2,7 @@ package swagger
import ( import (
"net/http" "net/http"
"reflect"
"github.com/emicklei/go-restful" "github.com/emicklei/go-restful"
) )
...@@ -9,8 +10,13 @@ import ( ...@@ -9,8 +10,13 @@ import (
// PostBuildDeclarationMapFunc can be used to modify the api declaration map. // PostBuildDeclarationMapFunc can be used to modify the api declaration map.
type PostBuildDeclarationMapFunc func(apiDeclarationMap *ApiDeclarationList) type PostBuildDeclarationMapFunc func(apiDeclarationMap *ApiDeclarationList)
// MapSchemaFormatFunc can be used to modify typeName at definition time.
type MapSchemaFormatFunc func(typeName string) string type MapSchemaFormatFunc func(typeName string) string
// MapModelTypeNameFunc can be used to return the desired typeName for a given
// type. It will return false if the default name should be used.
type MapModelTypeNameFunc func(t reflect.Type) (string, bool)
type Config struct { type Config struct {
// url where the services are available, e.g. http://localhost:8080 // url where the services are available, e.g. http://localhost:8080
// if left empty then the basePath of Swagger is taken from the actual request // if left empty then the basePath of Swagger is taken from the actual request
...@@ -33,6 +39,8 @@ type Config struct { ...@@ -33,6 +39,8 @@ type Config struct {
PostBuildHandler PostBuildDeclarationMapFunc PostBuildHandler PostBuildDeclarationMapFunc
// Swagger global info struct // Swagger global info struct
Info Info Info Info
// [optional] If set, model builder should call this handler to get addition typename-to-swagger-format-field convertion. // [optional] If set, model builder should call this handler to get addition typename-to-swagger-format-field conversion.
SchemaFormatHandler MapSchemaFormatFunc SchemaFormatHandler MapSchemaFormatFunc
// [optional] If set, model builder should call this handler to retrieve the name for a given type.
ModelTypeNameHandler MapModelTypeNameFunc
} }
...@@ -43,6 +43,12 @@ func (b modelBuilder) addModelFrom(sample interface{}) { ...@@ -43,6 +43,12 @@ func (b modelBuilder) addModelFrom(sample interface{}) {
} }
func (b modelBuilder) addModel(st reflect.Type, nameOverride string) *Model { func (b modelBuilder) addModel(st reflect.Type, nameOverride string) *Model {
// Turn pointers into simpler types so further checks are
// correct.
if st.Kind() == reflect.Ptr {
st = st.Elem()
}
modelName := b.keyFrom(st) modelName := b.keyFrom(st)
if nameOverride != "" { if nameOverride != "" {
modelName = nameOverride modelName = nameOverride
...@@ -137,6 +143,11 @@ func (b modelBuilder) buildProperty(field reflect.StructField, model *Model, mod ...@@ -137,6 +143,11 @@ func (b modelBuilder) buildProperty(field reflect.StructField, model *Model, mod
return "", "", prop return "", "", prop
} }
if field.Name == "XMLName" && field.Type.String() == "xml.Name" {
// property is metadata for the xml.Name attribute, can be skipped
return "", "", prop
}
if tag := field.Tag.Get("modelDescription"); tag != "" { if tag := field.Tag.Get("modelDescription"); tag != "" {
modelDescription = tag modelDescription = tag
} }
...@@ -155,7 +166,7 @@ func (b modelBuilder) buildProperty(field reflect.StructField, model *Model, mod ...@@ -155,7 +166,7 @@ func (b modelBuilder) buildProperty(field reflect.StructField, model *Model, mod
prop.Type = &pType prop.Type = &pType
} }
if prop.Format == "" { if prop.Format == "" {
prop.Format = b.jsonSchemaFormat(fieldType.String()) prop.Format = b.jsonSchemaFormat(b.keyFrom(fieldType))
} }
return jsonName, modelDescription, prop return jsonName, modelDescription, prop
} }
...@@ -192,13 +203,14 @@ func (b modelBuilder) buildProperty(field reflect.StructField, model *Model, mod ...@@ -192,13 +203,14 @@ func (b modelBuilder) buildProperty(field reflect.StructField, model *Model, mod
return jsonName, modelDescription, prop return jsonName, modelDescription, prop
} }
if b.isPrimitiveType(fieldType.String()) { fieldTypeName := b.keyFrom(fieldType)
mapped := b.jsonSchemaType(fieldType.String()) if b.isPrimitiveType(fieldTypeName) {
mapped := b.jsonSchemaType(fieldTypeName)
prop.Type = &mapped prop.Type = &mapped
prop.Format = b.jsonSchemaFormat(fieldType.String()) prop.Format = b.jsonSchemaFormat(fieldTypeName)
return jsonName, modelDescription, prop return jsonName, modelDescription, prop
} }
modelType := fieldType.String() modelType := b.keyFrom(fieldType)
prop.Ref = &modelType prop.Ref = &modelType
if fieldType.Name() == "" { // override type of anonymous structs if fieldType.Name() == "" { // override type of anonymous structs
...@@ -272,7 +284,7 @@ func (b modelBuilder) buildStructTypeProperty(field reflect.StructField, jsonNam ...@@ -272,7 +284,7 @@ func (b modelBuilder) buildStructTypeProperty(field reflect.StructField, jsonNam
} }
// simple struct // simple struct
b.addModel(fieldType, "") b.addModel(fieldType, "")
var pType = fieldType.String() var pType = b.keyFrom(fieldType)
prop.Ref = &pType prop.Ref = &pType
return jsonName, prop return jsonName, prop
} }
...@@ -336,10 +348,11 @@ func (b modelBuilder) buildPointerTypeProperty(field reflect.StructField, jsonNa ...@@ -336,10 +348,11 @@ func (b modelBuilder) buildPointerTypeProperty(field reflect.StructField, jsonNa
} }
} else { } else {
// non-array, pointer type // non-array, pointer type
var pType = b.jsonSchemaType(fieldType.String()[1:]) // no star, include pkg path fieldTypeName := b.keyFrom(fieldType.Elem())
if b.isPrimitiveType(fieldType.String()[1:]) { var pType = b.jsonSchemaType(fieldTypeName) // no star, include pkg path
if b.isPrimitiveType(fieldTypeName) {
prop.Type = &pType prop.Type = &pType
prop.Format = b.jsonSchemaFormat(fieldType.String()[1:]) prop.Format = b.jsonSchemaFormat(fieldTypeName)
return jsonName, prop return jsonName, prop
} }
prop.Ref = &pType prop.Ref = &pType
...@@ -355,7 +368,7 @@ func (b modelBuilder) buildPointerTypeProperty(field reflect.StructField, jsonNa ...@@ -355,7 +368,7 @@ func (b modelBuilder) buildPointerTypeProperty(field reflect.StructField, jsonNa
func (b modelBuilder) getElementTypeName(modelName, jsonName string, t reflect.Type) string { func (b modelBuilder) getElementTypeName(modelName, jsonName string, t reflect.Type) string {
if t.Kind() == reflect.Ptr { if t.Kind() == reflect.Ptr {
return t.String()[1:] t = t.Elem()
} }
if t.Name() == "" { if t.Name() == "" {
return modelName + "." + jsonName return modelName + "." + jsonName
...@@ -365,6 +378,11 @@ func (b modelBuilder) getElementTypeName(modelName, jsonName string, t reflect.T ...@@ -365,6 +378,11 @@ func (b modelBuilder) getElementTypeName(modelName, jsonName string, t reflect.T
func (b modelBuilder) keyFrom(st reflect.Type) string { func (b modelBuilder) keyFrom(st reflect.Type) string {
key := st.String() key := st.String()
if b.Config != nil && b.Config.ModelTypeNameHandler != nil {
if name, ok := b.Config.ModelTypeNameHandler(st); ok {
key = name
}
}
if len(st.Name()) == 0 { // unnamed type if len(st.Name()) == 0 { // unnamed type
// Swagger UI has special meaning for [ // Swagger UI has special meaning for [
key = strings.Replace(key, "[]", "||", -1) key = strings.Replace(key, "[]", "||", -1)
......
...@@ -33,6 +33,21 @@ func (prop *ModelProperty) setMaximum(field reflect.StructField) { ...@@ -33,6 +33,21 @@ func (prop *ModelProperty) setMaximum(field reflect.StructField) {
func (prop *ModelProperty) setType(field reflect.StructField) { func (prop *ModelProperty) setType(field reflect.StructField) {
if tag := field.Tag.Get("type"); tag != "" { if tag := field.Tag.Get("type"); tag != "" {
// Check if the first two characters of the type tag are
// intended to emulate slice/array behaviour.
//
// If type is intended to be a slice/array then add the
// overriden type to the array item instead of the main property
if len(tag) > 2 && tag[0:2] == "[]" {
pType := "array"
prop.Type = &pType
prop.Items = new(Item)
iType := tag[2:]
prop.Items.Type = &iType
return
}
prop.Type = &tag prop.Type = &tag
} }
} }
......
...@@ -277,7 +277,7 @@ func composeResponseMessages(route restful.Route, decl *ApiDeclaration, config * ...@@ -277,7 +277,7 @@ func composeResponseMessages(route restful.Route, decl *ApiDeclaration, config *
} }
// sort by code // sort by code
codes := sort.IntSlice{} codes := sort.IntSlice{}
for code, _ := range route.ResponseErrors { for code := range route.ResponseErrors {
codes = append(codes, code) codes = append(codes, code)
} }
codes.Sort() codes.Sort()
......
...@@ -14,21 +14,21 @@ This is useful for testing: ...@@ -14,21 +14,21 @@ This is useful for testing:
Import with ```import "github.com/google/gofuzz"``` Import with ```import "github.com/google/gofuzz"```
You can use it on single variables: You can use it on single variables:
``` ```go
f := fuzz.New() f := fuzz.New()
var myInt int var myInt int
f.Fuzz(&myInt) // myInt gets a random value. f.Fuzz(&myInt) // myInt gets a random value.
``` ```
You can use it on maps: You can use it on maps:
``` ```go
f := fuzz.New().NilChance(0).NumElements(1, 1) f := fuzz.New().NilChance(0).NumElements(1, 1)
var myMap map[ComplexKeyType]string var myMap map[ComplexKeyType]string
f.Fuzz(&myMap) // myMap will have exactly one element. f.Fuzz(&myMap) // myMap will have exactly one element.
``` ```
Customize the chance of getting a nil pointer: Customize the chance of getting a nil pointer:
``` ```go
f := fuzz.New().NilChance(.5) f := fuzz.New().NilChance(.5)
var fancyStruct struct { var fancyStruct struct {
A, B, C, D *string A, B, C, D *string
...@@ -37,7 +37,7 @@ f.Fuzz(&fancyStruct) // About half the pointers should be set. ...@@ -37,7 +37,7 @@ f.Fuzz(&fancyStruct) // About half the pointers should be set.
``` ```
You can even customize the randomization completely if needed: You can even customize the randomization completely if needed:
``` ```go
type MyEnum string type MyEnum string
const ( const (
A MyEnum = "A" A MyEnum = "A"
......
...@@ -129,7 +129,7 @@ func (f *Fuzzer) genElementCount() int { ...@@ -129,7 +129,7 @@ func (f *Fuzzer) genElementCount() int {
if f.minElements == f.maxElements { if f.minElements == f.maxElements {
return f.minElements return f.minElements
} }
return f.minElements + f.r.Intn(f.maxElements-f.minElements) return f.minElements + f.r.Intn(f.maxElements-f.minElements+1)
} }
func (f *Fuzzer) genShouldFill() bool { func (f *Fuzzer) genShouldFill() bool {
...@@ -229,12 +229,19 @@ func (f *Fuzzer) doFuzz(v reflect.Value, flags uint64) { ...@@ -229,12 +229,19 @@ func (f *Fuzzer) doFuzz(v reflect.Value, flags uint64) {
return return
} }
v.Set(reflect.Zero(v.Type())) v.Set(reflect.Zero(v.Type()))
case reflect.Array:
if f.genShouldFill() {
n := v.Len()
for i := 0; i < n; i++ {
f.doFuzz(v.Index(i), 0)
}
return
}
v.Set(reflect.Zero(v.Type()))
case reflect.Struct: case reflect.Struct:
for i := 0; i < v.NumField(); i++ { for i := 0; i < v.NumField(); i++ {
f.doFuzz(v.Field(i), 0) f.doFuzz(v.Field(i), 0)
} }
case reflect.Array:
fallthrough
case reflect.Chan: case reflect.Chan:
fallthrough fallthrough
case reflect.Func: case reflect.Func:
......
...@@ -299,102 +299,102 @@ func NewForConfig(c *rest.Config) (*Clientset, error) { ...@@ -299,102 +299,102 @@ func NewForConfig(c *rest.Config) (*Clientset, error) {
if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 { if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 {
configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst) configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst)
} }
var clientset Clientset var cs Clientset
var err error var err error
clientset.CoreV1Client, err = v1core.NewForConfig(&configShallowCopy) cs.CoreV1Client, err = v1core.NewForConfig(&configShallowCopy)
if err != nil { if err != nil {
return nil, err return nil, err
} }
clientset.AppsV1beta1Client, err = v1beta1apps.NewForConfig(&configShallowCopy) cs.AppsV1beta1Client, err = v1beta1apps.NewForConfig(&configShallowCopy)
if err != nil { if err != nil {
return nil, err return nil, err
} }
clientset.AuthenticationV1beta1Client, err = v1beta1authentication.NewForConfig(&configShallowCopy) cs.AuthenticationV1beta1Client, err = v1beta1authentication.NewForConfig(&configShallowCopy)
if err != nil { if err != nil {
return nil, err return nil, err
} }
clientset.AuthorizationV1beta1Client, err = v1beta1authorization.NewForConfig(&configShallowCopy) cs.AuthorizationV1beta1Client, err = v1beta1authorization.NewForConfig(&configShallowCopy)
if err != nil { if err != nil {
return nil, err return nil, err
} }
clientset.AutoscalingV1Client, err = v1autoscaling.NewForConfig(&configShallowCopy) cs.AutoscalingV1Client, err = v1autoscaling.NewForConfig(&configShallowCopy)
if err != nil { if err != nil {
return nil, err return nil, err
} }
clientset.BatchV1Client, err = v1batch.NewForConfig(&configShallowCopy) cs.BatchV1Client, err = v1batch.NewForConfig(&configShallowCopy)
if err != nil { if err != nil {
return nil, err return nil, err
} }
clientset.BatchV2alpha1Client, err = v2alpha1batch.NewForConfig(&configShallowCopy) cs.BatchV2alpha1Client, err = v2alpha1batch.NewForConfig(&configShallowCopy)
if err != nil { if err != nil {
return nil, err return nil, err
} }
clientset.CertificatesV1alpha1Client, err = v1alpha1certificates.NewForConfig(&configShallowCopy) cs.CertificatesV1alpha1Client, err = v1alpha1certificates.NewForConfig(&configShallowCopy)
if err != nil { if err != nil {
return nil, err return nil, err
} }
clientset.ExtensionsV1beta1Client, err = v1beta1extensions.NewForConfig(&configShallowCopy) cs.ExtensionsV1beta1Client, err = v1beta1extensions.NewForConfig(&configShallowCopy)
if err != nil { if err != nil {
return nil, err return nil, err
} }
clientset.PolicyV1beta1Client, err = v1beta1policy.NewForConfig(&configShallowCopy) cs.PolicyV1beta1Client, err = v1beta1policy.NewForConfig(&configShallowCopy)
if err != nil { if err != nil {
return nil, err return nil, err
} }
clientset.RbacV1alpha1Client, err = v1alpha1rbac.NewForConfig(&configShallowCopy) cs.RbacV1alpha1Client, err = v1alpha1rbac.NewForConfig(&configShallowCopy)
if err != nil { if err != nil {
return nil, err return nil, err
} }
clientset.StorageV1beta1Client, err = v1beta1storage.NewForConfig(&configShallowCopy) cs.StorageV1beta1Client, err = v1beta1storage.NewForConfig(&configShallowCopy)
if err != nil { if err != nil {
return nil, err return nil, err
} }
clientset.DiscoveryClient, err = discovery.NewDiscoveryClientForConfig(&configShallowCopy) cs.DiscoveryClient, err = discovery.NewDiscoveryClientForConfig(&configShallowCopy)
if err != nil { if err != nil {
glog.Errorf("failed to create the DiscoveryClient: %v", err) glog.Errorf("failed to create the DiscoveryClient: %v", err)
return nil, err return nil, err
} }
return &clientset, nil return &cs, nil
} }
// NewForConfigOrDie creates a new Clientset for the given config and // NewForConfigOrDie creates a new Clientset for the given config and
// panics if there is an error in the config. // panics if there is an error in the config.
func NewForConfigOrDie(c *rest.Config) *Clientset { func NewForConfigOrDie(c *rest.Config) *Clientset {
var clientset Clientset var cs Clientset
clientset.CoreV1Client = v1core.NewForConfigOrDie(c) cs.CoreV1Client = v1core.NewForConfigOrDie(c)
clientset.AppsV1beta1Client = v1beta1apps.NewForConfigOrDie(c) cs.AppsV1beta1Client = v1beta1apps.NewForConfigOrDie(c)
clientset.AuthenticationV1beta1Client = v1beta1authentication.NewForConfigOrDie(c) cs.AuthenticationV1beta1Client = v1beta1authentication.NewForConfigOrDie(c)
clientset.AuthorizationV1beta1Client = v1beta1authorization.NewForConfigOrDie(c) cs.AuthorizationV1beta1Client = v1beta1authorization.NewForConfigOrDie(c)
clientset.AutoscalingV1Client = v1autoscaling.NewForConfigOrDie(c) cs.AutoscalingV1Client = v1autoscaling.NewForConfigOrDie(c)
clientset.BatchV1Client = v1batch.NewForConfigOrDie(c) cs.BatchV1Client = v1batch.NewForConfigOrDie(c)
clientset.BatchV2alpha1Client = v2alpha1batch.NewForConfigOrDie(c) cs.BatchV2alpha1Client = v2alpha1batch.NewForConfigOrDie(c)
clientset.CertificatesV1alpha1Client = v1alpha1certificates.NewForConfigOrDie(c) cs.CertificatesV1alpha1Client = v1alpha1certificates.NewForConfigOrDie(c)
clientset.ExtensionsV1beta1Client = v1beta1extensions.NewForConfigOrDie(c) cs.ExtensionsV1beta1Client = v1beta1extensions.NewForConfigOrDie(c)
clientset.PolicyV1beta1Client = v1beta1policy.NewForConfigOrDie(c) cs.PolicyV1beta1Client = v1beta1policy.NewForConfigOrDie(c)
clientset.RbacV1alpha1Client = v1alpha1rbac.NewForConfigOrDie(c) cs.RbacV1alpha1Client = v1alpha1rbac.NewForConfigOrDie(c)
clientset.StorageV1beta1Client = v1beta1storage.NewForConfigOrDie(c) cs.StorageV1beta1Client = v1beta1storage.NewForConfigOrDie(c)
clientset.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c) cs.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c)
return &clientset return &cs
} }
// New creates a new Clientset for the given RESTClient. // New creates a new Clientset for the given RESTClient.
func New(c rest.Interface) *Clientset { func New(c rest.Interface) *Clientset {
var clientset Clientset var cs Clientset
clientset.CoreV1Client = v1core.New(c) cs.CoreV1Client = v1core.New(c)
clientset.AppsV1beta1Client = v1beta1apps.New(c) cs.AppsV1beta1Client = v1beta1apps.New(c)
clientset.AuthenticationV1beta1Client = v1beta1authentication.New(c) cs.AuthenticationV1beta1Client = v1beta1authentication.New(c)
clientset.AuthorizationV1beta1Client = v1beta1authorization.New(c) cs.AuthorizationV1beta1Client = v1beta1authorization.New(c)
clientset.AutoscalingV1Client = v1autoscaling.New(c) cs.AutoscalingV1Client = v1autoscaling.New(c)
clientset.BatchV1Client = v1batch.New(c) cs.BatchV1Client = v1batch.New(c)
clientset.BatchV2alpha1Client = v2alpha1batch.New(c) cs.BatchV2alpha1Client = v2alpha1batch.New(c)
clientset.CertificatesV1alpha1Client = v1alpha1certificates.New(c) cs.CertificatesV1alpha1Client = v1alpha1certificates.New(c)
clientset.ExtensionsV1beta1Client = v1beta1extensions.New(c) cs.ExtensionsV1beta1Client = v1beta1extensions.New(c)
clientset.PolicyV1beta1Client = v1beta1policy.New(c) cs.PolicyV1beta1Client = v1beta1policy.New(c)
clientset.RbacV1alpha1Client = v1alpha1rbac.New(c) cs.RbacV1alpha1Client = v1alpha1rbac.New(c)
clientset.StorageV1beta1Client = v1beta1storage.New(c) cs.StorageV1beta1Client = v1beta1storage.New(c)
clientset.DiscoveryClient = discovery.NewDiscoveryClient(c) cs.DiscoveryClient = discovery.NewDiscoveryClient(c)
return &clientset return &cs
} }
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment