Skip to content
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

feat(pkg-mgr): Support dependency version upgrades #6017

Merged
merged 4 commits into from
Oct 21, 2024

Conversation

ezgidemirel
Copy link
Member

@ezgidemirel ezgidemirel commented Oct 18, 2024

Description of your changes

How Package Manager Works

pkg-mgr-high-level

How Lock Reconciler Works Before & After This Change

resolver-reconciler

I used following packages to test different scenarios. You can find the package dependencies and tag conventions below:

  • gt: greater than
  • dod: depends on digest

Success installations:

  • level-1 configuration and configuration-nop depends on provider-nop with different constraints
# Digest: sha256:8cd2b5901f2d1b05bf1cc9fc230a38520cf55ab8fd8c884acffd3c6eaf27b9c6
xpkg.upbound.io/ezgiorg/ezgi-configuration-level-1:v0.1.1-gt
    - xpkg.upbound.io/crossplane-contrib/provider-nop:v0.2.1
    - xpkg.upbound.io/ezgiorg/ezgi-configuration-nop:v0.1.0-gt
        - xpkg.upbound.io/crossplane-contrib/provider-nop>=v0.2.0
  • level-1 configuration and configuration-nop depends on provider-nop with the same digest
# Digest: sha256:51dcd4e66e23ad2f306ba7c801e5c1e05b882850fe74959c4ecfb8d28cea2ae6
xpkg.upbound.io/ezgiorg/ezgi-configuration-level-1:v0.1.0-dod
    - xpkg.upbound.io/crossplane-contrib/provider-nop@sha256:ecc25c121431dfc7058754427f97c034ecde26d4aafa0da16d258090e0443904
    - xpkg.upbound.io/ezgiorg/ezgi-configuration-nop:v0.1.1-dod
        - xpkg.upbound.io/crossplane-contrib/provider-nop@sha256:ecc25c121431dfc7058754427f97c034ecde26d4aafa0da16d258090e0443904

Failure insallations:

  • level-1 configuration and configuration-nop depends on provider-nop with different versions
# Digest: sha256:c86ade852872557833afc21d6b89418bb9fcb8827c0844f77b60c7d28d68f934
xpkg.upbound.io/ezgiorg/ezgi-configuration-level-1:v0.1.1
    - xpkg.upbound.io/crossplane-contrib/provider-nop:v0.2.0
    - xpkg.upbound.io/ezgiorg/ezgi-configuration-nop:v0.1.1
        - xpkg.upbound.io/crossplane-contrib/provider-nop:v0.2.1

events on lock obj:

Events:
  Type     Reason          Age              From                             Message
  ----     ------          ----             ----                             -------
  Warning  NoValidVersion  4s (x3 over 9s)  packages/lock.pkg.crossplane.io  version downgrade is required to satisfy constraints, manual intervention required
  • level-1 configuration and configuration-nop depends on provider-nop with different constraints, requires provider-nop version downgrade to satisfy the constraints which is not done automatically.
# Digest: sha256:c78424376217b503aed947b9ee12d078db3057e918428e6a57c346f09165e4ff
xpkg.upbound.io/ezgiorg/ezgi-configuration-level-1:v0.1.0-gt
    - xpkg.upbound.io/ezgiorg/provider-nop>=v0.2.0
    - xpkg.upbound.io/ezgiorg/ezgi-configuration-nop:v0.1.0
        - xpkg.upbound.io/crossplane-contrib/provider-nop:v0.2.0

events on lock obj:

Events:
 Type     Reason          Age                From                             Message
  ----     ------          ----               ----                             -------
  Warning  NoValidVersion  0s                 packages/lock.pkg.crossplane.io  dependency (xpkg.upbound.io/crossplane-contrib/provider-nop) does not have version in constraints ([v0.2.0 v0.2.1])

Success upgrades:

  • xpkg.upbound.io/ezgiorg/ezgi-configuration-nop version update from v0.1.0 to v0.1.1 causes dependency version update
# Digest: sha256:0b9c670e75fa6c8502269e43f70b75f5449825929c40931d81f15a1fdefa6889
xpkg.upbound.io/ezgiorg/ezgi-configuration-nop:v0.1.0
    - xpkg.upbound.io/crossplane-contrib/provider-nop:v0.2.0
# Digest: sha256:8387cf10e0cd7a3a80993b30392bac053c6a2a6c0e77c57389822fbec760e943
xpkg.upbound.io/ezgiorg/ezgi-configuration-nop:v0.1.1
    - xpkg.upbound.io/crossplane-contrib/provider-nop:v0.2.1

Fixes #4511

I have:

Need help with this checklist? See the cheat sheet.

@ezgidemirel ezgidemirel requested review from negz, a team and turkenh as code owners October 18, 2024 15:38
@ezgidemirel ezgidemirel requested a review from phisco October 18, 2024 15:38
@ezgidemirel ezgidemirel force-pushed the dependency-version-update branch 3 times, most recently from a329967 to 1633d9d Compare October 18, 2024 15:46
@turkenh
Copy link
Member

turkenh commented Oct 19, 2024

@ezgidemirel noticed that some of the review comments I left on #5991 still apply here. Could you please do a quick pass and resolve them here and/or hit resolve there if they are no longer relevant

Comment on lines 84 to 93
reasonErrBuildDAG event.Reason = "BuildDAGError"
reasonCyclicDependency event.Reason = "CyclicDependency"
reasonInvalidDependency event.Reason = "InvalidDependency"
reasonNoValidVersion event.Reason = "NoValidVersion"
reasonErrCreate event.Reason = "CreateError"
reasonErrUpdate event.Reason = "UpdateError"
Copy link
Member

Choose a reason for hiding this comment

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

Could be a follow up, but, I am starting to think to have a condition on the lock objects instead or in addition 🤔

cmd/crossplane/core/core.go Outdated Show resolved Hide resolved
cmd/crossplane/core/core.go Outdated Show resolved Hide resolved
Signed-off-by: ezgidemirel <ezgidemirel91@gmail.com>
@ezgidemirel ezgidemirel force-pushed the dependency-version-update branch 3 times, most recently from e6d8aeb to 1e8475f Compare October 21, 2024 09:19
Signed-off-by: ezgidemirel <ezgidemirel91@gmail.com>
@ezgidemirel ezgidemirel force-pushed the dependency-version-update branch from 1e8475f to 01fb4d1 Compare October 21, 2024 09:20
@turkenh turkenh force-pushed the dependency-version-update branch from 36bc5b5 to 428ac7f Compare October 21, 2024 10:53
Signed-off-by: Hasan Turken <turkenh@gmail.com>
@turkenh turkenh force-pushed the dependency-version-update branch from 428ac7f to 44dba2c Compare October 21, 2024 11:16
@turkenh turkenh changed the title feat(pkg-mgr): Support dependency version update feat(pkg-mgr): Support dependency version upgrades Oct 21, 2024
Signed-off-by: ezgidemirel <ezgidemirel91@gmail.com>
Copy link
Member

@turkenh turkenh left a comment

Choose a reason for hiding this comment

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

Great work implementing a long-awaited functionality, thanks @ezgidemirel 🙌

The PR looks good to me with the following open points which we could tackled as quick follow-ups:

  • Use e2e artifacts from xpkg.upbound.io/crossplane/... and include metadata to generate those packages just like other test cases.
  • Extend e2e coverage including ensuring we prevent downgrades, finding the lowest possible version if multiple packages rely on the same package with different constraints etc.
  • Error reporting and propagation. We are introducing lock error reporting with events in this PR and I am not sure if it would be better if we introduced a condition. Then, we could propagate that condition to packages or packagerevisions so that one could see what is wrong in case of a package fails with dependency resolution.

@turkenh turkenh merged commit 6c0f3c3 into crossplane:main Oct 21, 2024
16 of 17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature: Crossplane packages should support upgrading dependencies
2 participants