fix: Incorrect comparison logic when comparing lists#1060
fix: Incorrect comparison logic when comparing lists#1060aali309 wants to merge 7 commits intoredhat-developer:masterfrom
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
ranakan19
left a comment
There was a problem hiding this comment.
Do we have any data on the impact of sorting before comparison here? Maybe we have any performance tests that can be run to measure the impact?
My concern is that sorting generally has a higher time complexity (O(nlogn) in the best cases). Unless size is bound or is not performance-sensitive, I'm cautious of sorting beforehand. So looking for more context about this decision
|
Question, not an objection: Can we assume that list order is insignificant in all those cases? For instance, Thinking about EnvVars that override one another, or VolumeMounts that either override, or mount inside one another's mount path. If I, as an admin, get them in a wrong order and then fix it, the operator may refuse to update it therefore not letting me fix it. |
From what I understand so far, the deployment generated by the operator doesn’t support duplicate env var names or overlapping volume mount paths. Because of that, the order of these lists doesn’t seem to carry semantic meaning in this context. Sorting them helps avoid false positives caused by non-deterministic ordering from etcd, without hiding any meaningful changes. |
Thought of this, these lists(containers, env, volumes, tolerations) are very small and this code runs only during reconciliation, not in a hot path. So I think In this case, sorting is more efficient than the alternative(unnecessary updates and API calls during reconciliation caused by false positives due to non-deterministic list ordering from etcd). |
|
/retest |
a9a8edc to
931ca4c
Compare
|
I have tried to test So skipping the test if the OCP version running the test is lower than startMajorVersion (4.14 in GitHub CI) and |
|
/test v4.14-kuttl-parallel |
5320c69 to
c4773d8
Compare
|
/retest |
09e5eca to
58d8c57
Compare
Signed-off-by: Atif Ali <atali@redhat.com> cleanup: remove redundant empty/nil slice checks Signed-off-by: Atif Ali <atali@redhat.com>
Signed-off-by: Atif Ali <atali@redhat.com>
Signed-off-by: Atif Ali <atali@redhat.com> improve e2e test Signed-off-by: Atif Ali <atali@redhat.com> Fix test failure Signed-off-by: Atif Ali <atali@redhat.com> Fix test failure Signed-off-by: Atif Ali <atali@redhat.com>
Signed-off-by: Atif Ali <atali@redhat.com> trigger reconciliation via GitopsService not ArgoCD Signed-off-by: Atif Ali <atali@redhat.com> test debug Signed-off-by: Atif Ali <atali@redhat.com> fix fmt Signed-off-by: Atif Ali <atali@redhat.com>
Signed-off-by: Atif Ali <atali@redhat.com> add configv1 to the E2E fixture to read the clusterVersion Signed-off-by: Atif Ali <atali@redhat.com>
b263d6f to
b232e07
Compare
Signed-off-by: Atif Ali <atali@redhat.com>
|
/retest |
|
@aali309: The following tests failed, say
Full PR test history. Your PR dashboard. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
What type of PR is this?
See: GITOPS-8018
/kind bug
What does this PR do / why we need it:
This change sorts deployment lists before comparison to prevent false updates when
etcd returns containers, volumes, or tolerations in different order.
Have you updated the necessary documentation?
Which issue(s) this PR fixes:
Fixes: GITOPS-8018
Test acceptance criteria:
How to test changes / Special notes to the reviewer: