-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
remove deploymentconfig registry #15858
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,7 +30,7 @@ import ( | |
"github.com/openshift/origin/pkg/build/webhook/github" | ||
"github.com/openshift/origin/pkg/build/webhook/gitlab" | ||
deployapiv1 "github.com/openshift/origin/pkg/deploy/apis/apps/v1" | ||
deployconfigregistry "github.com/openshift/origin/pkg/deploy/registry/deployconfig" | ||
oappsclient "github.com/openshift/origin/pkg/deploy/generated/internalclientset" | ||
deployconfigetcd "github.com/openshift/origin/pkg/deploy/registry/deployconfig/etcd" | ||
deploylogregistry "github.com/openshift/origin/pkg/deploy/registry/deploylog" | ||
deployconfiginstantiate "github.com/openshift/origin/pkg/deploy/registry/instantiate" | ||
|
@@ -150,7 +150,6 @@ func (c OpenshiftAPIConfig) GetRestStorage() (map[schema.GroupVersion]map[string | |
if err != nil { | ||
return nil, fmt.Errorf("error building REST storage: %v", err) | ||
} | ||
deployConfigRegistry := deployconfigregistry.NewRegistry(deployConfigStorage) | ||
|
||
hostSubnetStorage, err := hostsubnetetcd.NewREST(c.GenericConfig.RESTOptionsGetter) | ||
if err != nil { | ||
|
@@ -260,13 +259,6 @@ func (c OpenshiftAPIConfig) GetRestStorage() (map[schema.GroupVersion]map[string | |
Secrets: c.KubeClientInternal.Core(), | ||
} | ||
|
||
deployRollbackClient := deployrollback.Client{ | ||
DCFn: deployConfigRegistry.GetDeploymentConfig, | ||
RCFn: clientDeploymentInterface{c.KubeClientInternal}.GetDeployment, | ||
GRFn: deployrollback.NewRollbackGenerator().GenerateRollback, | ||
} | ||
deployConfigRollbackStorage := deployrollback.NewREST(c.DeprecatedOpenshiftClient, c.KubeClientInternal, externalVersionCodec) | ||
|
||
projectStorage := projectproxy.NewREST(c.KubeClientInternal.Core().Namespaces(), c.ProjectAuthorizationCache, c.ProjectAuthorizationCache, c.ProjectCache) | ||
|
||
namespace, templateName, err := configapi.ParseNamespaceAndName(c.ProjectRequestTemplate) | ||
|
@@ -333,6 +325,20 @@ func (c OpenshiftAPIConfig) GetRestStorage() (map[schema.GroupVersion]map[string | |
return nil, fmt.Errorf("error building REST storage: %v", err) | ||
} | ||
|
||
originAppsClient, err := oappsclient.NewForConfig(c.GenericConfig.LoopbackClientConfig) | ||
if err != nil { | ||
return nil, err | ||
} | ||
coreClient, err := kclientset.NewForConfig(c.GenericConfig.LoopbackClientConfig) | ||
if err != nil { | ||
return nil, err | ||
} | ||
deployRollbackClient := deployrollback.Client{ | ||
GRFn: deployrollback.NewRollbackGenerator().GenerateRollback, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
DeploymentConfigGetter: originAppsClient.Apps(), | ||
ReplicationControllerGetter: coreClient.Core(), | ||
} | ||
deployConfigRollbackStorage := deployrollback.NewREST(c.DeprecatedOpenshiftClient, c.KubeClientInternal, externalVersionCodec) | ||
storage := map[schema.GroupVersion]map[string]rest.Storage{ | ||
v1.SchemeGroupVersion: { | ||
// TODO: Deprecate these | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -51,16 +51,16 @@ func NewREST(optsGetter restoptions.Getter) (*REST, *StatusREST, *ScaleREST, err | |
|
||
statusStore := *store | ||
statusStore.UpdateStrategy = deployconfig.StatusStrategy | ||
|
||
statusREST := &StatusREST{store: &statusStore} | ||
scaleREST := &ScaleREST{registry: deployconfig.NewRegistry(deploymentConfigREST)} | ||
|
||
scaleREST := &ScaleREST{store: store} | ||
|
||
return deploymentConfigREST, statusREST, scaleREST, nil | ||
} | ||
|
||
// ScaleREST contains the REST storage for the Scale subresource of DeploymentConfigs. | ||
type ScaleREST struct { | ||
registry deployconfig.Registry | ||
store *registry.Store | ||
} | ||
|
||
// ScaleREST implements Patcher | ||
|
@@ -73,20 +73,21 @@ func (r *ScaleREST) New() runtime.Object { | |
|
||
// Get retrieves (computes) the Scale subresource for the given DeploymentConfig name. | ||
func (r *ScaleREST) Get(ctx apirequest.Context, name string, options *metav1.GetOptions) (runtime.Object, error) { | ||
deploymentConfig, err := r.registry.GetDeploymentConfig(ctx, name, options) | ||
deploymentConfig, err := r.store.Get(ctx, name, options) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
return deployapi.ScaleFromConfig(deploymentConfig), nil | ||
return deployapi.ScaleFromConfig(deploymentConfig.(*deployapi.DeploymentConfig)), nil | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i guess we don't need to check this assertion? |
||
} | ||
|
||
// Update scales the DeploymentConfig for the given Scale subresource, returning the updated Scale. | ||
func (r *ScaleREST) Update(ctx apirequest.Context, name string, objInfo rest.UpdatedObjectInfo) (runtime.Object, bool, error) { | ||
deploymentConfig, err := r.registry.GetDeploymentConfig(ctx, name, &metav1.GetOptions{}) | ||
uncastObj, err := r.store.Get(ctx, name, &metav1.GetOptions{}) | ||
if err != nil { | ||
return nil, false, errors.NewNotFound(extensions.Resource("scale"), name) | ||
} | ||
deploymentConfig := uncastObj.(*deployapi.DeploymentConfig) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. check? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
It would be programmer error. I don't feel too bad about panic-ing here. |
||
|
||
old := deployapi.ScaleFromConfig(deploymentConfig) | ||
obj, err := objInfo.UpdatedObject(ctx, old) | ||
|
@@ -104,7 +105,7 @@ func (r *ScaleREST) Update(ctx apirequest.Context, name string, objInfo rest.Upd | |
} | ||
|
||
deploymentConfig.Spec.Replicas = scale.Spec.Replicas | ||
if err := r.registry.UpdateDeploymentConfig(ctx, deploymentConfig); err != nil { | ||
if _, _, err := r.store.Update(ctx, deploymentConfig.Name, rest.DefaultUpdatedObjectInfo(deploymentConfig, kapi.Scheme)); err != nil { | ||
return nil, false, err | ||
} | ||
|
||
|
This file was deleted.
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: why not appsclient?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
collides with upstream