Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backport origin pr 18219 limit all #18478

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.