Commit d3b740bf authored by Kubernetes Submit Queue's avatar Kubernetes Submit Queue Committed by GitHub

Merge pull request #47060 from deads2k/crd-12-prefix

Automatic merge from submit-queue Fix etcd storage location for CRs Fixes https://github.com/kubernetes/kubernetes/issues/46031 The first commit is easy, the second commit is hard. @sttts Read the second commit very carefully and search the repo to make sure that you agree this is only affecting aggregator and apiextensions. @pmorie @derekwaynecarr make sure you check to see if service catalog is double prefixing. Looks like we missed it in 1.6, but no one was using it.
parents 5c9b9ae0 bc3434c0
...@@ -431,7 +431,7 @@ func (t CRDRESTOptionsGetter) GetRESTOptions(resource schema.GroupResource) (gen ...@@ -431,7 +431,7 @@ func (t CRDRESTOptionsGetter) GetRESTOptions(resource schema.GroupResource) (gen
Decorator: generic.UndecoratedStorage, Decorator: generic.UndecoratedStorage,
EnableGarbageCollection: t.EnableGarbageCollection, EnableGarbageCollection: t.EnableGarbageCollection,
DeleteCollectionWorkers: t.DeleteCollectionWorkers, DeleteCollectionWorkers: t.DeleteCollectionWorkers,
ResourcePrefix: t.StoragePrefix + "/" + resource.Group + "/" + resource.Resource, ResourcePrefix: resource.Group + "/" + resource.Resource,
} }
if t.EnableWatchCache { if t.EnableWatchCache {
ret.Decorator = genericregistry.StorageWithCacher(t.DefaultWatchCacheSize) ret.Decorator = genericregistry.StorageWithCacher(t.DefaultWatchCacheSize)
......
...@@ -382,7 +382,7 @@ func TestEtcdStorage(t *testing.T) { ...@@ -382,7 +382,7 @@ func TestEtcdStorage(t *testing.T) {
expectedObject *metaObject expectedObject *metaObject
}{ }{
"namespacedNoxuDefinition": { "namespacedNoxuDefinition": {
etcdPath: path.Join("/", etcdPrefix, "apiextensions.k8s.io/customresourcedefinitions/noxus.mygroup.example.com"), // TODO: Double check this, no namespace? etcdPath: "apiextensions.k8s.io/customresourcedefinitions/noxus.mygroup.example.com",
expectedObject: &metaObject{ expectedObject: &metaObject{
Kind: "CustomResourceDefinition", Kind: "CustomResourceDefinition",
APIVersion: "apiextensions.k8s.io/v1beta1", APIVersion: "apiextensions.k8s.io/v1beta1",
...@@ -394,7 +394,7 @@ func TestEtcdStorage(t *testing.T) { ...@@ -394,7 +394,7 @@ func TestEtcdStorage(t *testing.T) {
}, },
}, },
"namespacedNoxuInstance": { "namespacedNoxuInstance": {
etcdPath: path.Join("/", etcdPrefix, "mygroup.example.com/noxus/the-cruel-default/foo"), etcdPath: "mygroup.example.com/noxus/the-cruel-default/foo",
expectedObject: &metaObject{ expectedObject: &metaObject{
Kind: "WishIHadChosenNoxu", Kind: "WishIHadChosenNoxu",
APIVersion: "mygroup.example.com/v1beta1", APIVersion: "mygroup.example.com/v1beta1",
...@@ -407,7 +407,7 @@ func TestEtcdStorage(t *testing.T) { ...@@ -407,7 +407,7 @@ func TestEtcdStorage(t *testing.T) {
}, },
"clusteredCurletDefinition": { "clusteredCurletDefinition": {
etcdPath: path.Join("/", etcdPrefix, "apiextensions.k8s.io/customresourcedefinitions/curlets.mygroup.example.com"), etcdPath: "apiextensions.k8s.io/customresourcedefinitions/curlets.mygroup.example.com",
expectedObject: &metaObject{ expectedObject: &metaObject{
Kind: "CustomResourceDefinition", Kind: "CustomResourceDefinition",
APIVersion: "apiextensions.k8s.io/v1beta1", APIVersion: "apiextensions.k8s.io/v1beta1",
...@@ -420,7 +420,7 @@ func TestEtcdStorage(t *testing.T) { ...@@ -420,7 +420,7 @@ func TestEtcdStorage(t *testing.T) {
}, },
"clusteredCurletInstance": { "clusteredCurletInstance": {
etcdPath: path.Join("/", etcdPrefix, "mygroup.example.com/curlets/bar"), etcdPath: "mygroup.example.com/curlets/bar",
expectedObject: &metaObject{ expectedObject: &metaObject{
Kind: "Curlet", Kind: "Curlet",
APIVersion: "mygroup.example.com/v1beta1", APIVersion: "mygroup.example.com/v1beta1",
......
...@@ -135,7 +135,7 @@ func (f *SimpleRestOptionsFactory) GetRESTOptions(resource schema.GroupResource) ...@@ -135,7 +135,7 @@ func (f *SimpleRestOptionsFactory) GetRESTOptions(resource schema.GroupResource)
Decorator: generic.UndecoratedStorage, Decorator: generic.UndecoratedStorage,
EnableGarbageCollection: f.Options.EnableGarbageCollection, EnableGarbageCollection: f.Options.EnableGarbageCollection,
DeleteCollectionWorkers: f.Options.DeleteCollectionWorkers, DeleteCollectionWorkers: f.Options.DeleteCollectionWorkers,
ResourcePrefix: f.Options.StorageConfig.Prefix + "/" + resource.Group + "/" + resource.Resource, ResourcePrefix: resource.Group + "/" + resource.Resource,
} }
if f.Options.EnableWatchCache { if f.Options.EnableWatchCache {
ret.Decorator = genericregistry.StorageWithCacher(f.Options.DefaultWatchCacheSize) ret.Decorator = genericregistry.StorageWithCacher(f.Options.DefaultWatchCacheSize)
......
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