-
Notifications
You must be signed in to change notification settings - Fork 859
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
Addon dependencies version range #5861
Comments
As discussed in our most recent community meeting, this would introduce a breaking change, since existing usages of We can avoid this issue by using a new property, but this leads to other questions:
Alternatively, we could add a feature flag to enable the version constraint behavior. Only if enabled, KubeVela checks whether the enabled version matches the version constraint and fails if the addon doesn't meet the constraint. The flag would be disabled by default to preserve backward compatibility. |
Hi @merusso I walked through all our addons in the catalog, almost all of the addons use dependency without specifying the version, like:
In this case, we can keep the compatiblity for this schematic: 1) check the existence of the dependency, 2) install the latest one if not exists. When specify the version, we can make the version range feature (which is also a constraint) work. |
Should this issue be moved to https://github.com/kubevela/kubevela? |
@merusso Yes, moving |
I agree with @wonderflow's point of view. For addons that dependents other addons, we can specify the version range of other dependent addons in the |
Sorry if I was unclear, but this is what I'm proposing above. I'm proposing that |
* Feat(#5861): Support addon dependencies version ranges This change enables addon maintainers to define version ranges for dependencies in an addon's metadata.yaml file. This behavior is similar to the version range allowed in the `system` section of the metadata file. The version range expression for `dependencies` follows the same format as for `system`. Example: ```yaml dependencies: - name: addon1 version: ">= 2.3.3, < 3.0.0" - name: addon2 version: ">= 0.1.0, < 1.0.0" ``` When installing an addon, the behavior varies depending on whether the dependency is already installed. If a dependency is already installed, the installed version will be validated against the version range, and installation will fail with an error if there's a mismatch. If a dependency is not installed, the version range will be used to select the addon version to be installed. If no addon version matching the range exists, the installation will fail with an error. Fixes #5861 Signed-off-by: Michael Russo <merusso@gmail.com> * fix(lint): remove unused ctx parameter Signed-off-by: Michael Russo <merusso@gmail.com> * fix(lint): Add comment for IsLocalRegistry Signed-off-by: Michael Russo <merusso@gmail.com> * fix(lint): unexport AddonInfoMap Signed-off-by: Michael Russo <merusso@gmail.com> * fix(lint): unexport addonInfo Signed-off-by: Michael Russo <merusso@gmail.com> * chore: replace map[string]addonInfo with addonInfoMap for consistency Signed-off-by: Michael Russo <merusso@gmail.com> * fix: add short circuit when dependency version is not specified Signed-off-by: Michael Russo <merusso@gmail.com> * feat: Add test for multiple validation errors Signed-off-by: Michael Russo <merusso@gmail.com> * fix: Run go mod tidy Signed-off-by: Michael Russo <merusso@gmail.com> * feat: add tests for ToVersionedRegistry Signed-off-by: Michael Russo <merusso@gmail.com> * fix: simplify listInstalledAddons loop Signed-off-by: Michael Russo <merusso@gmail.com> * feat: listAvailableAddons returns addons from multiple sources Changes: * implement ListAddonInfo in Registry * add interface to aid testing of listAvailableAddons * add tests for listAvailableAddons Signed-off-by: Michael Russo <merusso@gmail.com> * refactor: simplify validateAddonDependencies move logic from validateAddonDependencies to calculateDependencyVersionToInstall. Signed-off-by: Michael Russo <merusso@gmail.com> * fix(lint): Implicit memory aliasing in for loop. Signed-off-by: Michael Russo <merusso@gmail.com> * fix(lint): non-wrapping format verb for fmt.Errorf Signed-off-by: Michael Russo <merusso@gmail.com> * fix(lint): indent-error-flow: (revive) Signed-off-by: Michael Russo <merusso@gmail.com> * fix(lint): unexported-return Signed-off-by: Michael Russo <merusso@gmail.com> * fix(lint): exported type comment format (revive) Signed-off-by: Michael Russo <merusso@gmail.com> * fix(lint): refactor AddonInfo to ItemInfo, avoid "stutter" (revive) Signed-off-by: Michael Russo <merusso@gmail.com> * fix(lint): add comment to exported method Registry.ListAddonInfo Signed-off-by: Michael Russo <merusso@gmail.com> * fix(lint): fix stutter, rename AddonInfoLister to ItemInfoLister Signed-off-by: Michael Russo <merusso@gmail.com> * chore: Add suite tests for Registry.ListAddonInfo() Signed-off-by: Michael Russo <merusso@gmail.com> * Test: add test cases for addon.sortVersionsDescending Signed-off-by: Michael Russo <merusso@gmail.com> --------- Signed-off-by: Michael Russo <merusso@gmail.com>
As a KubeVela addon developer, when defining dependencies for an addon in metadata.yaml, I would like to set a version range for these dependencies, so that my addon will be restricted from being enabled in a cluster where the dependency version doesn't match the specified range.
I see in the docs that there is a dependencies[].version property, but KubeVela doesn't seem to use this value to enforce any version requirements. Ideally this property would work similarly to the existing
system
property.For example, in "metadata.yaml":
Specific behavior:
The text was updated successfully, but these errors were encountered: