Update scale sub-resource to return the same error everywhere

Signed-off-by: Maciej Szulik <soltysh@gmail.com>
This commit is contained in:
Maciej Szulik 2025-01-24 19:45:36 +01:00
parent dba9475d5b
commit 1fa995224a
No known key found for this signature in database
GPG Key ID: F15E55D276FA84C4
3 changed files with 3 additions and 3 deletions

View File

@ -306,7 +306,7 @@ func (r *ScaleREST) Destroy() {
func (r *ScaleREST) Get(ctx context.Context, name string, options *metav1.GetOptions) (runtime.Object, error) {
obj, err := r.store.Get(ctx, name, options)
if err != nil {
return nil, errors.NewNotFound(apps.Resource("deployments/scale"), name)
return nil, err
}
deployment := obj.(*apps.Deployment)
scale, err := scaleFromDeployment(deployment)

View File

@ -202,7 +202,7 @@ func (r *ScaleREST) Destroy() {
func (r *ScaleREST) Get(ctx context.Context, name string, options *metav1.GetOptions) (runtime.Object, error) {
obj, err := r.store.Get(ctx, name, options)
if err != nil {
return nil, errors.NewNotFound(apps.Resource("replicasets/scale"), name)
return nil, err
}
rs := obj.(*apps.ReplicaSet)
scale, err := scaleFromReplicaSet(rs)

View File

@ -190,7 +190,7 @@ func (r *ScaleREST) Destroy() {
func (r *ScaleREST) Get(ctx context.Context, name string, options *metav1.GetOptions) (runtime.Object, error) {
obj, err := r.store.Get(ctx, name, options)
if err != nil {
return nil, errors.NewNotFound(autoscaling.Resource("replicationcontrollers/scale"), name)
return nil, err
}
rc := obj.(*api.ReplicationController)
return scaleFromRC(rc), nil