Thanks to visit codestin.com
Credit goes to github.com

Skip to content

pkg/configmap: sort configmap data by key when loading bundle #1630

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

joelanford
Copy link
Member

@joelanford joelanford commented Apr 4, 2025

Description of the change:
Sort configmap data by key when loading bundle (which is derived from filenames in the bundle directories)

Motivation for the change:

This functionality is used by OLMv0 to construct an api.Bundle object that is needed to create install plan steps, which are eventually put into the installplan.status.plan field. It is important to have deterministic ordering of slice fields in Kubernetes APIs to avoid constant re-reconciliation and/or false positive change detection.

Specifically in the case of InstallPlan steps, the order of the steps does have some semantic requirements (CSV, then CRDs, then everything else). The problem is that if "everything else" is in a random order, the order of the resulting steps will still have non-determinism.

If we have deterministic order of steps, OLM may be able to resolve a class of bugs related to unnecessary creation of multiple install plans that would otherwise be identical.

Reviewer Checklist

  • Implementation matches the proposed design, or proposal is updated to match implementation
  • Sufficient unit test coverage
  • Sufficient end-to-end test coverage
  • Docs updated or added to /docs
  • Commit messages sensible and descriptive

This functionality is used by OLMv0 to construct an `api.Bundle` object
that is needed to create install plan steps, which are eventually put
into the installplan.status.plan field. It is important to have
deterministic ordering of slice fields in Kubernetes APIs to avoid
constant re-reconciliation and/or false positive change detection.

Specifically in the case of InstallPlan steps, the order of the steps
does have _some_ semantic requirements (CSV, then CRDs, then everything
else). The problem is that if "everything else" is in a random order,
the order of the resulting steps will still have non-determinism.

If we have deterministic order of steps, OLM may be able to resolve a
class of bugs related to unnecessary creation of multiple install plans
that would otherwise be identical.

Signed-off-by: Joe Lanford <[email protected]>
@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 4, 2025
Copy link

codecov bot commented Apr 4, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 46.79%. Comparing base (c3f19ec) to head (71956f7).
Report is 9 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1630   +/-   ##
=======================================
  Coverage   46.79%   46.79%           
=======================================
  Files         135      135           
  Lines       15887    15888    +1     
=======================================
+ Hits         7434     7435    +1     
  Misses       7412     7412           
  Partials     1041     1041           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@dinhxuanvu
Copy link
Member

dinhxuanvu commented Apr 5, 2025

While I don't see any harms on sorting items in configmap data using their names, ultimately I don't see the point of doing so. The order that actually matters is the order of steps in InstallPlan. While steps are being installed, at each step, OLM simply looks up the correlative item in the configmap. So changing the order in configmap has no impact on anything. If there is, you need to add a test case to show the correlation between InstallPlan steps and Configmap items.
Secondly, new InstallPlan is being generated when the resolution state changes AKA new version, new operator and etc. I haven't seen the case there are multiple identical InstallPlans. Each IP should be different. InstallPlans or Configmaps are not a part of resolution consideration. I fail to see how they matter in that area.

Copy link
Contributor

@camilamacedo86 camilamacedo86 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Apr 16, 2025
Copy link
Contributor

openshift-ci bot commented Apr 16, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: camilamacedo86, joelanford

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-merge-bot openshift-merge-bot bot merged commit e80f892 into operator-framework:master Apr 16, 2025
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants