Skip to content

Preserve input instance order for zone_based stoppable check #3028

@LZD-PratyushBhatt

Description

@LZD-PratyushBhatt

Currently, getZoneBasedInstances() which zone_based check calls internally uses a TreeSet, which leads to lexicographical sorting of instances during the stoppable check. This behavior results in the output instance order being different from the input list, even when multiple instances are equally stoppable.

This issue proposes to make the ordering deterministic based on user input, by introducing a new boolean parameter preserveOrder to facilitate preserving order for zone based checks and relevant REST API changes.

When preserveOrder is set to true, the original order of the input list will be preserved.

Default behavior (preserveOrder = false) will maintain backward compatibility for OSS users who may rely on the current output order.

This change aims to improve predictability in testing and usage scenarios where instance order matters. We'll ensure this behavior is clearly documented to avoid incorrect assumptions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions