Merge pull request #81342 from knight42/fix/kubectl-patch-scale
Refactor `kubectl scale` to patch scale subresource
This commit is contained in:
@@ -120,7 +120,7 @@ func DeleteRCAndWaitForGC(c clientset.Interface, ns, name string) error {
|
||||
|
||||
// ScaleRC scales Replication Controller to be desired size.
|
||||
func ScaleRC(clientset clientset.Interface, scalesGetter scaleclient.ScalesGetter, ns, name string, size uint, wait bool) error {
|
||||
return ScaleResource(clientset, scalesGetter, ns, name, size, wait, api.Kind("ReplicationController"), api.Resource("replicationcontrollers"))
|
||||
return ScaleResource(clientset, scalesGetter, ns, name, size, wait, api.Kind("ReplicationController"), api.SchemeGroupVersion.WithResource("replicationcontrollers"))
|
||||
}
|
||||
|
||||
// RunRC Launches (and verifies correctness) of a Replication Controller
|
||||
|
||||
@@ -2183,10 +2183,10 @@ func ScaleResource(
|
||||
size uint,
|
||||
wait bool,
|
||||
kind schema.GroupKind,
|
||||
gr schema.GroupResource,
|
||||
gvr schema.GroupVersionResource,
|
||||
) error {
|
||||
ginkgo.By(fmt.Sprintf("Scaling %v %s in namespace %s to %d", kind, name, ns, size))
|
||||
if err := testutils.ScaleResourceWithRetries(scalesGetter, ns, name, size, gr); err != nil {
|
||||
if err := testutils.ScaleResourceWithRetries(scalesGetter, ns, name, size, gvr); err != nil {
|
||||
return fmt.Errorf("error while scaling RC %s to %d replicas: %v", name, size, err)
|
||||
}
|
||||
if !wait {
|
||||
|
||||
@@ -691,7 +691,7 @@ func scaleResource(wg *sync.WaitGroup, config testutils.RunObjectConfig, scaling
|
||||
newSize,
|
||||
true,
|
||||
config.GetKind(),
|
||||
config.GetGroupResource(),
|
||||
config.GetGroupVersionResource(),
|
||||
),
|
||||
fmt.Sprintf("scaling %v %v", config.GetKind(), config.GetName()))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user