Skip to content

Commit

Permalink
Merge pull request kubernetes#35205 from wojtek-t/automated-cherry-pi…
Browse files Browse the repository at this point in the history
  • Loading branch information
Kubernetes Submit Queue authored Oct 21, 2016
2 parents 3d85585 + 83400d8 commit 711c6c6
Show file tree
Hide file tree
Showing 181 changed files with 3,672 additions and 1,731 deletions.
246 changes: 123 additions & 123 deletions Godeps/Godeps.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion cluster/gce/config-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ ENABLE_L7_LOADBALANCING="${KUBE_ENABLE_L7_LOADBALANCING:-glbc}"
ENABLE_CLUSTER_MONITORING="${KUBE_ENABLE_CLUSTER_MONITORING:-influxdb}"

# Set etcd version (e.g. 3.0.4-migration.1) if you need non-default version.
TEST_ETCD_VERSION=""
TEST_ETCD_VERSION="${TEST_ETCD_VERSION:-}"

# Default Log level for all components in test clusters and variables to override it in specific components.
TEST_CLUSTER_LOG_LEVEL="${TEST_CLUSTER_LOG_LEVEL:---v=4}"
Expand Down
4 changes: 2 additions & 2 deletions examples/apiserver/rest/reststorage.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ func NewREST(config *storagebackend.Config, storageDecorator generic.StorageDeco
return obj.(*testgroup.TestType).Name, nil
},
// Used to match objects based on labels/fields for list.
PredicateFunc: func(label labels.Selector, field fields.Selector) *generic.SelectionPredicate {
return &generic.SelectionPredicate{
PredicateFunc: func(label labels.Selector, field fields.Selector) storage.SelectionPredicate {
return storage.SelectionPredicate{
Label: label,
Field: field,
GetAttrs: func(obj runtime.Object) (labels.Set, fields.Set, error) {
Expand Down
5 changes: 3 additions & 2 deletions federation/registry/cluster/strategy.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (
"k8s.io/kubernetes/pkg/labels"
"k8s.io/kubernetes/pkg/registry/generic"
"k8s.io/kubernetes/pkg/runtime"
apistorage "k8s.io/kubernetes/pkg/storage"
"k8s.io/kubernetes/pkg/util/validation/field"
)

Expand All @@ -44,8 +45,8 @@ func ClusterToSelectableFields(cluster *federation.Cluster) fields.Set {
return generic.ObjectMetaFieldsSet(&cluster.ObjectMeta, false)
}

func MatchCluster(label labels.Selector, field fields.Selector) *generic.SelectionPredicate {
return &generic.SelectionPredicate{
func MatchCluster(label labels.Selector, field fields.Selector) apistorage.SelectionPredicate {
return apistorage.SelectionPredicate{
Label: label,
Field: field,
GetAttrs: func(obj runtime.Object) (labels.Set, fields.Set, error) {
Expand Down
2 changes: 1 addition & 1 deletion pkg/apiserver/resthandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ func ListResource(r rest.Lister, rw rest.Watcher, scope RequestScope, forceWatch

if hasName {
// metadata.name is the canonical internal name.
// generic.SelectionPredicate will notice that this is
// SelectionPredicate will notice that this is
// a request for a single object and optimize the
// storage query accordingly.
nameSelector := fields.OneTermEqualSelector("metadata.name", name)
Expand Down
2 changes: 1 addition & 1 deletion pkg/genericapiserver/genericapiserver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ import (

// setUp is a convience function for setting up for (most) tests.
func setUp(t *testing.T) (GenericAPIServer, *etcdtesting.EtcdTestServer, Config, *assert.Assertions) {
etcdServer := etcdtesting.NewEtcdTestClientServer(t)
etcdServer, _ := etcdtesting.NewUnsecuredEtcd3TestClientServer(t)

genericapiserver := GenericAPIServer{}
config := Config{}
Expand Down
15 changes: 2 additions & 13 deletions pkg/master/master_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ import (
"k8s.io/kubernetes/pkg/storage"
"k8s.io/kubernetes/pkg/storage/etcd/etcdtest"
etcdtesting "k8s.io/kubernetes/pkg/storage/etcd/testing"
"k8s.io/kubernetes/pkg/storage/storagebackend"
"k8s.io/kubernetes/pkg/util/intstr"
utilnet "k8s.io/kubernetes/pkg/util/net"
"k8s.io/kubernetes/pkg/util/sets"
Expand All @@ -74,7 +73,7 @@ import (

// setUp is a convience function for setting up for (most) tests.
func setUp(t *testing.T) (*Master, *etcdtesting.EtcdTestServer, Config, *assert.Assertions) {
server := etcdtesting.NewUnsecuredEtcdTestClientServer(t)
server, storageConfig := etcdtesting.NewUnsecuredEtcd3TestClientServer(t)

master := &Master{
GenericAPIServer: &genericapiserver.GenericAPIServer{},
Expand All @@ -83,16 +82,6 @@ func setUp(t *testing.T) (*Master, *etcdtesting.EtcdTestServer, Config, *assert.
Config: &genericapiserver.Config{},
}

storageConfig := storagebackend.Config{
Prefix: etcdtest.PathPrefix(),
CAFile: server.CAFile,
KeyFile: server.KeyFile,
CertFile: server.CertFile,
}
for _, url := range server.ClientURLs {
storageConfig.ServerList = append(storageConfig.ServerList, url.String())
}

resourceEncoding := genericapiserver.NewDefaultResourceEncodingConfig()
resourceEncoding.SetVersionEncoding(api.GroupName, *testapi.Default.GroupVersion(), unversioned.GroupVersion{Group: api.GroupName, Version: runtime.APIVersionInternal})
resourceEncoding.SetVersionEncoding(autoscaling.GroupName, *testapi.Autoscaling.GroupVersion(), unversioned.GroupVersion{Group: autoscaling.GroupName, Version: runtime.APIVersionInternal})
Expand All @@ -101,7 +90,7 @@ func setUp(t *testing.T) (*Master, *etcdtesting.EtcdTestServer, Config, *assert.
resourceEncoding.SetVersionEncoding(extensions.GroupName, *testapi.Extensions.GroupVersion(), unversioned.GroupVersion{Group: extensions.GroupName, Version: runtime.APIVersionInternal})
resourceEncoding.SetVersionEncoding(rbac.GroupName, *testapi.Rbac.GroupVersion(), unversioned.GroupVersion{Group: rbac.GroupName, Version: runtime.APIVersionInternal})
resourceEncoding.SetVersionEncoding(certificates.GroupName, *testapi.Certificates.GroupVersion(), unversioned.GroupVersion{Group: certificates.GroupName, Version: runtime.APIVersionInternal})
storageFactory := genericapiserver.NewDefaultStorageFactory(storageConfig, testapi.StorageMediaType(), api.Codecs, resourceEncoding, DefaultAPIResourceConfigSource())
storageFactory := genericapiserver.NewDefaultStorageFactory(*storageConfig, testapi.StorageMediaType(), api.Codecs, resourceEncoding, DefaultAPIResourceConfigSource())

config.StorageFactory = storageFactory
config.APIResourceConfigSource = DefaultAPIResourceConfigSource()
Expand Down
7 changes: 4 additions & 3 deletions pkg/registry/certificates/etcd/etcd.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func NewREST(opts generic.RESTOptions) (*REST, *StatusREST, *ApprovalREST) {
prefix := "/" + opts.ResourcePrefix

newListFunc := func() runtime.Object { return &certificates.CertificateSigningRequestList{} }
storageInterface, _ := opts.Decorator(
storageInterface, dFunc := opts.Decorator(
opts.StorageConfig,
cachesize.GetWatchCacheSizeByResource(cachesize.CertificateSigningRequests),
&certificates.CertificateSigningRequest{},
Expand All @@ -62,7 +62,7 @@ func NewREST(opts generic.RESTOptions) (*REST, *StatusREST, *ApprovalREST) {
ObjectNameFunc: func(obj runtime.Object) (string, error) {
return obj.(*certificates.CertificateSigningRequest).Name, nil
},
PredicateFunc: func(label labels.Selector, field fields.Selector) *generic.SelectionPredicate {
PredicateFunc: func(label labels.Selector, field fields.Selector) storage.SelectionPredicate {
return csrregistry.Matcher(label, field)
},
QualifiedResource: certificates.Resource("certificatesigningrequests"),
Expand All @@ -72,7 +72,8 @@ func NewREST(opts generic.RESTOptions) (*REST, *StatusREST, *ApprovalREST) {
UpdateStrategy: csrregistry.Strategy,
DeleteStrategy: csrregistry.Strategy,

Storage: storageInterface,
Storage: storageInterface,
DestroyFunc: dFunc,
}

// Subresources use the same store and creation strategy, which only
Expand Down
5 changes: 3 additions & 2 deletions pkg/registry/certificates/strategy.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (
"k8s.io/kubernetes/pkg/labels"
"k8s.io/kubernetes/pkg/registry/generic"
"k8s.io/kubernetes/pkg/runtime"
apistorage "k8s.io/kubernetes/pkg/storage"
"k8s.io/kubernetes/pkg/util/validation/field"
)

Expand Down Expand Up @@ -168,8 +169,8 @@ func (csrApprovalStrategy) ValidateUpdate(ctx api.Context, obj, old runtime.Obje
}

// Matcher returns a generic matcher for a given label and field selector.
func Matcher(label labels.Selector, field fields.Selector) *generic.SelectionPredicate {
return &generic.SelectionPredicate{
func Matcher(label labels.Selector, field fields.Selector) apistorage.SelectionPredicate {
return apistorage.SelectionPredicate{
Label: label,
Field: field,
GetAttrs: func(obj runtime.Object) (labels.Set, fields.Set, error) {
Expand Down
5 changes: 3 additions & 2 deletions pkg/registry/clusterrole/etcd/etcd.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func NewREST(opts generic.RESTOptions) *REST {
prefix := "/" + opts.ResourcePrefix

newListFunc := func() runtime.Object { return &rbac.ClusterRoleList{} }
storageInterface, _ := opts.Decorator(
storageInterface, dFunc := opts.Decorator(
opts.StorageConfig,
cachesize.GetWatchCacheSizeByResource(cachesize.ClusterRoles),
&rbac.ClusterRole{},
Expand Down Expand Up @@ -67,7 +67,8 @@ func NewREST(opts generic.RESTOptions) *REST {
UpdateStrategy: clusterrole.Strategy,
DeleteStrategy: clusterrole.Strategy,

Storage: storageInterface,
Storage: storageInterface,
DestroyFunc: dFunc,
}

return &REST{store}
Expand Down
6 changes: 3 additions & 3 deletions pkg/registry/clusterrole/strategy.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ import (
"k8s.io/kubernetes/pkg/apis/rbac/validation"
"k8s.io/kubernetes/pkg/fields"
"k8s.io/kubernetes/pkg/labels"
"k8s.io/kubernetes/pkg/registry/generic"
"k8s.io/kubernetes/pkg/runtime"
apistorage "k8s.io/kubernetes/pkg/storage"
"k8s.io/kubernetes/pkg/util/validation/field"
)

Expand Down Expand Up @@ -102,8 +102,8 @@ func (s strategy) Export(ctx api.Context, obj runtime.Object, exact bool) error
}

// Matcher returns a generic matcher for a given label and field selector.
func Matcher(label labels.Selector, field fields.Selector) *generic.SelectionPredicate {
return &generic.SelectionPredicate{
func Matcher(label labels.Selector, field fields.Selector) apistorage.SelectionPredicate {
return apistorage.SelectionPredicate{
Label: label,
Field: field,
GetAttrs: func(obj runtime.Object) (labels.Set, fields.Set, error) {
Expand Down
5 changes: 3 additions & 2 deletions pkg/registry/clusterrolebinding/etcd/etcd.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func NewREST(opts generic.RESTOptions) *REST {
prefix := "/" + opts.ResourcePrefix

newListFunc := func() runtime.Object { return &rbac.ClusterRoleBindingList{} }
storageInterface, _ := opts.Decorator(
storageInterface, dFunc := opts.Decorator(
opts.StorageConfig,
cachesize.GetWatchCacheSizeByResource(cachesize.ClusterRoleBindings),
&rbac.ClusterRoleBinding{},
Expand Down Expand Up @@ -67,7 +67,8 @@ func NewREST(opts generic.RESTOptions) *REST {
UpdateStrategy: clusterrolebinding.Strategy,
DeleteStrategy: clusterrolebinding.Strategy,

Storage: storageInterface,
Storage: storageInterface,
DestroyFunc: dFunc,
}

return &REST{store}
Expand Down
6 changes: 3 additions & 3 deletions pkg/registry/clusterrolebinding/strategy.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ import (
"k8s.io/kubernetes/pkg/apis/rbac/validation"
"k8s.io/kubernetes/pkg/fields"
"k8s.io/kubernetes/pkg/labels"
"k8s.io/kubernetes/pkg/registry/generic"
"k8s.io/kubernetes/pkg/runtime"
apistorage "k8s.io/kubernetes/pkg/storage"
"k8s.io/kubernetes/pkg/util/validation/field"
)

Expand Down Expand Up @@ -102,8 +102,8 @@ func (s strategy) Export(ctx api.Context, obj runtime.Object, exact bool) error
}

// Matcher returns a generic matcher for a given label and field selector.
func Matcher(label labels.Selector, field fields.Selector) *generic.SelectionPredicate {
return &generic.SelectionPredicate{
func Matcher(label labels.Selector, field fields.Selector) apistorage.SelectionPredicate {
return apistorage.SelectionPredicate{
Label: label,
Field: field,
GetAttrs: func(obj runtime.Object) (labels.Set, fields.Set, error) {
Expand Down
5 changes: 3 additions & 2 deletions pkg/registry/configmap/etcd/etcd.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func NewREST(opts generic.RESTOptions) *REST {
prefix := "/" + opts.ResourcePrefix

newListFunc := func() runtime.Object { return &api.ConfigMapList{} }
storageInterface, _ := opts.Decorator(
storageInterface, dFunc := opts.Decorator(
opts.StorageConfig,
cachesize.GetWatchCacheSizeByResource(cachesize.ConfigMaps),
&api.ConfigMap{},
Expand Down Expand Up @@ -81,7 +81,8 @@ func NewREST(opts generic.RESTOptions) *REST {
UpdateStrategy: configmap.Strategy,
DeleteStrategy: configmap.Strategy,

Storage: storageInterface,
Storage: storageInterface,
DestroyFunc: dFunc,
}
return &REST{store}
}
6 changes: 6 additions & 0 deletions pkg/registry/configmap/etcd/etcd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ func validNewConfigMap() *api.ConfigMap {
func TestCreate(t *testing.T) {
storage, server := newStorage(t)
defer server.Terminate(t)
defer storage.Store.DestroyFunc()
test := registrytest.New(t, storage.Store)

validConfigMap := validNewConfigMap()
Expand Down Expand Up @@ -80,6 +81,7 @@ func TestCreate(t *testing.T) {
func TestUpdate(t *testing.T) {
storage, server := newStorage(t)
defer server.Terminate(t)
defer storage.Store.DestroyFunc()
test := registrytest.New(t, storage.Store)
test.TestUpdate(
// valid
Expand All @@ -102,27 +104,31 @@ func TestUpdate(t *testing.T) {
func TestDelete(t *testing.T) {
storage, server := newStorage(t)
defer server.Terminate(t)
defer storage.Store.DestroyFunc()
test := registrytest.New(t, storage.Store)
test.TestDelete(validNewConfigMap())
}

func TestGet(t *testing.T) {
storage, server := newStorage(t)
defer server.Terminate(t)
defer storage.Store.DestroyFunc()
test := registrytest.New(t, storage.Store)
test.TestGet(validNewConfigMap())
}

func TestList(t *testing.T) {
storage, server := newStorage(t)
defer server.Terminate(t)
defer storage.Store.DestroyFunc()
test := registrytest.New(t, storage.Store)
test.TestList(validNewConfigMap())
}

func TestWatch(t *testing.T) {
storage, server := newStorage(t)
defer server.Terminate(t)
defer storage.Store.DestroyFunc()
test := registrytest.New(t, storage.Store)
test.TestWatch(
validNewConfigMap(),
Expand Down
5 changes: 3 additions & 2 deletions pkg/registry/configmap/strategy.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (
"k8s.io/kubernetes/pkg/labels"
"k8s.io/kubernetes/pkg/registry/generic"
"k8s.io/kubernetes/pkg/runtime"
apistorage "k8s.io/kubernetes/pkg/storage"
"k8s.io/kubernetes/pkg/util/validation/field"
)

Expand Down Expand Up @@ -88,8 +89,8 @@ func ConfigMapToSelectableFields(cfg *api.ConfigMap) fields.Set {
}

// MatchConfigMap returns a generic matcher for a given label and field selector.
func MatchConfigMap(label labels.Selector, field fields.Selector) *generic.SelectionPredicate {
return &generic.SelectionPredicate{
func MatchConfigMap(label labels.Selector, field fields.Selector) apistorage.SelectionPredicate {
return apistorage.SelectionPredicate{
Label: label,
Field: field,
GetAttrs: func(obj runtime.Object) (labels.Set, fields.Set, error) {
Expand Down
5 changes: 3 additions & 2 deletions pkg/registry/controller/etcd/etcd.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func NewREST(opts generic.RESTOptions) (*REST, *StatusREST) {
prefix := "/" + opts.ResourcePrefix

newListFunc := func() runtime.Object { return &api.ReplicationControllerList{} }
storageInterface, _ := opts.Decorator(
storageInterface, dFunc := opts.Decorator(
opts.StorageConfig,
cachesize.GetWatchCacheSizeByResource(cachesize.Controllers),
&api.ReplicationController{},
Expand Down Expand Up @@ -104,7 +104,8 @@ func NewREST(opts generic.RESTOptions) (*REST, *StatusREST) {
UpdateStrategy: controller.Strategy,
DeleteStrategy: controller.Strategy,

Storage: storageInterface,
Storage: storageInterface,
DestroyFunc: dFunc,
}
statusStore := *store
statusStore.UpdateStrategy = controller.StatusStrategy
Expand Down
Loading

0 comments on commit 711c6c6

Please sign in to comment.