-
Notifications
You must be signed in to change notification settings - Fork 242
Description
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.