Skip to content

Commit 5f1492f

Browse files
Address comments
1 parent 62d3e53 commit 5f1492f

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

internal/contract/controlplane.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -239,9 +239,10 @@ func (c *ControlPlaneContract) IsUpgrading(obj *unstructured.Unstructured) (bool
239239
// A control plane is considered scaling if:
240240
// - status.replicas is not yet set.
241241
// - spec.replicas != status.replicas.
242-
// - spec.replicas != status.updatedReplicas.
242+
// - spec.replicas != status.upToDateReplicas.
243243
// - spec.replicas != status.readyReplicas.
244244
// - status.unavailableReplicas > 0.
245+
// NOTE: this function is used only in E2E tests.
245246
func (c *ControlPlaneContract) IsScaling(obj *unstructured.Unstructured, contractVersion string) (bool, error) {
246247
desiredReplicas, err := c.Replicas().Get(obj)
247248
if err != nil {
@@ -259,7 +260,7 @@ func (c *ControlPlaneContract) IsScaling(obj *unstructured.Unstructured, contrac
259260
return false, errors.Wrapf(err, "failed to get control plane %s", c.StatusReplicas().Path().String())
260261
}
261262

262-
upToDatedReplicas, err := c.UpToDateReplicas(contractVersion).Get(obj)
263+
upToDateReplicas, err := c.UpToDateReplicas(contractVersion).Get(obj)
263264
if err != nil {
264265
if errors.Is(err, ErrFieldNotFound) {
265266
// If updatedReplicas is not set on the control plane
@@ -302,7 +303,7 @@ func (c *ControlPlaneContract) IsScaling(obj *unstructured.Unstructured, contrac
302303
availableReplicas, err = c.AvailableReplicas().Get(obj)
303304
if err != nil {
304305
if errors.Is(err, ErrFieldNotFound) {
305-
// If readyReplicas is not set on the control plane
306+
// If availableReplicas is not set on the control plane
306307
// we should consider the control plane to be scaling so that
307308
// we block any operation that expect the control plane to be stable.
308309
return true, nil
@@ -315,7 +316,7 @@ func (c *ControlPlaneContract) IsScaling(obj *unstructured.Unstructured, contrac
315316
// * .spec.replicas, .status.replicas, .status.upToDateReplicas,
316317
// .status.readyReplicas, .status.availableReplicas are not equal.
317318
if *statusReplicas != *desiredReplicas ||
318-
*upToDatedReplicas != *desiredReplicas ||
319+
*upToDateReplicas != *desiredReplicas ||
319320
*readyReplicas != *desiredReplicas ||
320321
*availableReplicas != *desiredReplicas {
321322
return true, nil

0 commit comments

Comments
 (0)