Skip to content

Commit

Permalink
Merge pull request #18478 from juanvallejo/backport-origin-pr-18219-l…
Browse files Browse the repository at this point in the history
…imit-all

Automatic merge from submit-queue.

Backport origin pr 18219 limit all

Picks kubernetes/kubernetes#49624
Picks #18219

Depends on #18476

Addresses #18473 (comment)

cc @deads2k
  • Loading branch information
openshift-merge-robot authored Feb 9, 2018
2 parents 284b8b7 + 23dc949 commit 1ce3eee
Show file tree
Hide file tree
Showing 14 changed files with 111 additions and 23 deletions.
9 changes: 9 additions & 0 deletions pkg/apps/registry/deployconfig/etcd/etcd.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,3 +144,12 @@ func (r *StatusREST) Get(ctx apirequest.Context, name string, options *metav1.Ge
func (r *StatusREST) Update(ctx apirequest.Context, name string, objInfo rest.UpdatedObjectInfo) (runtime.Object, bool, error) {
return r.store.Update(ctx, name, objInfo)
}

// LegacyREST allows us to wrap and alter some behavior
type LegacyREST struct {
*REST
}

func (r *LegacyREST) Categories() []string {
return []string{}
}
9 changes: 9 additions & 0 deletions pkg/build/registry/build/etcd/etcd.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,12 @@ func (r *DetailsREST) New() runtime.Object {
func (r *DetailsREST) Update(ctx apirequest.Context, name string, objInfo rest.UpdatedObjectInfo) (runtime.Object, bool, error) {
return r.store.Update(ctx, name, objInfo)
}

// LegacyREST allows us to wrap and alter some behavior
type LegacyREST struct {
*REST
}

func (r *LegacyREST) Categories() []string {
return []string{}
}
9 changes: 9 additions & 0 deletions pkg/build/registry/buildconfig/etcd/etcd.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,12 @@ func NewREST(optsGetter restoptions.Getter) (*REST, error) {

return &REST{store}, nil
}

// LegacyREST allows us to wrap and alter some behavior
type LegacyREST struct {
*REST
}

func (r *LegacyREST) Categories() []string {
return []string{}
}
33 changes: 20 additions & 13 deletions pkg/cmd/server/origin/legacy.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ import (

"github.com/openshift/origin/pkg/apps/registry/deployconfig"
deploymentconfigetcd "github.com/openshift/origin/pkg/apps/registry/deployconfig/etcd"
buildetcd "github.com/openshift/origin/pkg/build/registry/build/etcd"
buildconfig "github.com/openshift/origin/pkg/build/registry/buildconfig"
buildconfigetcd "github.com/openshift/origin/pkg/build/registry/buildconfig/etcd"
imagestreametcd "github.com/openshift/origin/pkg/image/registry/imagestream/etcd"
routeregistry "github.com/openshift/origin/pkg/route/registry/route"
routeetcd "github.com/openshift/origin/pkg/route/registry/route/etcd"
)
Expand Down Expand Up @@ -197,24 +199,29 @@ func LegacyStorage(storage map[schema.GroupVersion]map[string]rest.Storage) map[
// Kube only did this for a select few resources which were controller managed and established links
// via a workload controller. In openshift, these will all conform to registry.Store so we
// can actually wrap the "normal" storage here.
switch resource {
case "buildConfigs":
restStorage := s.(*buildconfigetcd.REST)
store := *restStorage.Store
switch storage := s.(type) {
case *buildetcd.REST:
legacyStorage[resource] = &buildetcd.LegacyREST{REST: storage}

case *buildconfigetcd.REST:
store := *storage.Store
store.DeleteStrategy = buildconfig.LegacyStrategy
store.CreateStrategy = buildconfig.LegacyStrategy
legacyStorage[resource] = &buildconfigetcd.REST{Store: &store}
case "deploymentConfigs":
restStorage := s.(*deploymentconfigetcd.REST)
store := *restStorage.Store
legacyStorage[resource] = &buildconfigetcd.LegacyREST{REST: &buildconfigetcd.REST{Store: &store}}

case *deploymentconfigetcd.REST:
store := *storage.Store
store.CreateStrategy = deployconfig.LegacyStrategy
store.DeleteStrategy = deployconfig.LegacyStrategy
legacyStorage[resource] = &deploymentconfigetcd.REST{Store: &store}
case "routes":
restStorage := s.(*routeetcd.REST)
store := *restStorage.Store
legacyStorage[resource] = &deploymentconfigetcd.LegacyREST{REST: &deploymentconfigetcd.REST{Store: &store}}

case *imagestreametcd.REST:
legacyStorage[resource] = &imagestreametcd.LegacyREST{REST: storage}

case *routeetcd.REST:
store := *storage.Store
store.Decorator = routeregistry.DecorateLegacyRouteWithEmptyDestinationCACertificates
legacyStorage[resource] = &routeetcd.REST{Store: &store}
legacyStorage[resource] = &routeetcd.LegacyREST{REST: &routeetcd.REST{Store: &store}}

default:
legacyStorage[resource] = s
Expand Down
9 changes: 9 additions & 0 deletions pkg/image/registry/imagestream/etcd/etcd.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,3 +127,12 @@ func (r *InternalREST) Create(ctx apirequest.Context, obj runtime.Object, _ bool
func (r *InternalREST) Update(ctx apirequest.Context, name string, objInfo rest.UpdatedObjectInfo) (runtime.Object, bool, error) {
return r.store.Update(ctx, name, objInfo)
}

// LegacyREST allows us to wrap and alter some behavior
type LegacyREST struct {
*REST
}

func (r *LegacyREST) Categories() []string {
return []string{}
}
9 changes: 9 additions & 0 deletions pkg/route/registry/route/etcd/etcd.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,12 @@ func (r *StatusREST) Get(ctx apirequest.Context, name string, options *metav1.Ge
func (r *StatusREST) Update(ctx apirequest.Context, name string, objInfo kapirest.UpdatedObjectInfo) (runtime.Object, bool, error) {
return r.store.Update(ctx, name, objInfo)
}

// LegacyREST allows us to wrap and alter some behavior
type LegacyREST struct {
*REST
}

func (r *LegacyREST) Categories() []string {
return []string{}
}
9 changes: 9 additions & 0 deletions pkg/security/registry/securitycontextconstraints/etcd/etcd.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,12 @@ func NewREST(optsGetter generic.RESTOptionsGetter) *REST {
}
return &REST{store}
}

// LegacyREST allows us to wrap and alter some behavior
type LegacyREST struct {
*REST
}

func (r *LegacyREST) Categories() []string {
return []string{}
}
4 changes: 2 additions & 2 deletions vendor/k8s.io/kubernetes/pkg/kubectl/cmd/util/factory_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 1ce3eee

Please sign in to comment.