Skip to content

Write the migration-related settings in a fixed order - #1692

Open
fontaineajulien wants to merge 1 commit into
pulp:mainfrom
fontaineajulien:deterministic-migration-settings
Open

fontaineajulien wants to merge 1 commit into
pulp:mainfrom
fontaineajulien:deterministic-migration-settings

Conversation

@fontaineajulien

Copy link
Copy Markdown

Fixes #1691.

needsMigrationSetting() ranged over MigrationSettingsList(), which is a map, and returned at the first false setting. Go map order is random, so the same CR produced a different settings.py from one reconcile to the next. Depending on the order, REDIRECT_TO_OBJECT_STORAGE = True was present or missing, or the two lines swapped places. Each change rewrote the <name>-server Secret and reprovisioned the pulpcore pods, and the resulting rollout triggered more reconciles, so the loop fed itself.

This PR:

  • iterates over the sorted keys, using the existing sortKeys helper;
  • uses continue instead of return on a false setting, so a false setting no longer hides the ones after it.

Tests: the new controllers/repo_manager/secret_test.go runs the function 100 times. On the current code both cases fail within a few runs:

  • settings = "" instead of REDIRECT_TO_OBJECT_STORAGE = True;
  • the two lines come out in swapped order.

With the fix, both tests pass. go test ./... passes, including the envtest suite.

needsMigrationSetting() ranged over a map and returned at the first false
setting, so settings.py differed between reconciles: the pulp-server Secret
flipped, the pulpcore pods were reprovisioned, and the rollout triggered more
reconciles. Iterate over sorted keys and skip false settings instead of
stopping.

fixes pulp#1691

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@openshift-ci
openshift-ci Bot requested review from git-hyagi and ipanova October 5, 2026 13:49
@openshift-ci

openshift-ci Bot commented Oct 5, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: fontaineajulien
Once this PR has been reviewed and has the lgtm label, please assign dkliban for approval. For more information see the Code Review Process.

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

Details 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-ci

openshift-ci Bot commented Oct 5, 2026

Copy link
Copy Markdown

Hi @fontaineajulien. Thanks for your PR.

I'm waiting for a pulp member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work.

Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

settings.py flaps between reconciles: needsMigrationSetting depends on map iteration order

1 participant