Skip to content

create a proposal for addon dependency management - #157

Open
elgnay wants to merge 1 commit into
open-cluster-management-io:mainfrom
elgnay:addon-dependency
Open

create a proposal for addon dependency management#157
elgnay wants to merge 1 commit into
open-cluster-management-io:mainfrom
elgnay:addon-dependency

Conversation

@elgnay

@elgnay elgnay commented Oct 22, 2025

Copy link
Copy Markdown

Related issue: #156

@openshift-ci
openshift-ci Bot requested review from deads2k and qiujian16 October 22, 2025 04:28
@openshift-ci

openshift-ci Bot commented Oct 22, 2025

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: elgnay
Once this PR has been reviewed and has the lgtm label, please assign qiujian16 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

// The default is false (soft dependency).
// +optional
// +kubebuilder:default=false
Required bool `json:"required,omitempty"`

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

boolean needs to be avoided.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Replaced Required with Type, using explicit values "Optional" and "Required".


- **Soft dependencies (default, required=false)**: The addon can still function with reduced functionality when the dependency is missing. When a soft dependency is not satisfied, the addon-manager will set `Degraded=True` with reason `DependencyNotSatisfied`, but the klusterlet-agent will not modify the `Available` condition, allowing the addon to remain available if its health checks pass.

- **Hard dependencies (required=true)**: The addon cannot function at all without the dependency. When a hard dependency is not satisfied, the addon-manager will set `Degraded=True` with reason `RequiredDependencyNotSatisfied`, and the klusterlet-agent will detect this specific reason and set `Available=False`.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think the addon will not be deployed under this case, like we should have a status that condition are or met, then addon-framework will deploy the resource.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think the addon will not be deployed under this case

Should this work on a fresh install only, or rollout as well?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

If the addon is already installed and its dependent addon becomes unavailable, should the addon be uninstalled in that case?

@qiujian16 qiujian16 Oct 29, 2025

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I do not think so, but we should have a degrade condition with the message that some dependencies are missing. With the second thought, maybe we do not need to disable installation, a degraded status condition will be good.

// An empty list means the add-on has no dependencies.
// The default is an empty list.
// +optional
Dependencies []AddonDependency `json:"dependencies,omitempty"`

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'm not sure if there is a case: for one addon, it has different dependencies on different type of managed clusters, for instance, on the OCP clusters it depends on the managed-serviceaccount addon, but on the eks clusters, it does not or even depends on other addons. I am asking because we have a similar case for the addon health checking recently.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

At present, we don’t have such a requirement, and we aim to keep the initial design as simple as possible. The case you mentioned is very interesting. In the future, the current API could be extended by adding a new field in AddonDependency — for example, when — that allows specifying a CEL expression to determine whether an addon actually depends on another.

@qiujian16

Copy link
Copy Markdown
Member

/assign @jnpacker

Comment thread enhancements/sig-architecture/156-addon-dependency/README.md

There are two types of dependencies:

- **Optional dependencies (default, type=Optional)**: The addon can still function with reduced functionality when the dependency is missing. When an optional dependency is not satisfied, the addon-manager will set `Degraded=True` with reason `DependencyNotSatisfied`, but the klusterlet-agent will not modify the `Available` condition, allowing the addon to remain available if its health checks pass.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Do we have any examples of this?
Will you publish some type of warning message in this case?

@elgnay elgnay Nov 6, 2025

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Do we have any examples of this?

The work-manager is one of the MultiCluster Engine add-ons. Its pod log viewing feature depends on the managed-serviceaccount add-on. If that add-on is missing, other features—such as cluster view and cluster action—will still work.

Will you publish some type of warning message in this case?

Added an optional field, message, to capture this type of warning or informational message.

description: "An addon that optionally uses ManagedServiceAccount API"
dependencies:
- name: managed-serviceaccount
# type: Optional is the default, can be omitted

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I was going to say that optional is default, but without any other type of cue, I would have expected it to be optional: false from just reading the keys. you have.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

That makes sense. Changed the default from Optional to Required.

// condition should be set to False when the dependency is not satisfied.
// +optional
// +kubebuilder:validation:Enum=Optional;Required
// +kubebuilder:default=Optional

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'm not sure I would have assumed it was optional by default.

Also do we need or want to consider any versioning semantics?

@elgnay elgnay Nov 6, 2025

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I'm not sure I would have assumed it was optional by default.

Changed the default from Optional to Required.

Also do we need or want to consider any versioning semantics?

Since the ClusterManagementAddOn itself does not include any add-on version information, it’s not possible to define dependencies based on specific versions.

Signed-off-by: Yang Le <yangle@redhat.com>
// condition should be set to False when the dependency is not satisfied.
// - "Optional": The addon can work with reduced functionality without this dependency.
// The Degraded condition will be set with reason DependencyNotSatisfied when the dependency is not satisfied,
// but the Available condition may remain True if the addon is otherwise functional.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think this use case has poor UX and that you should consider saying it is False Available, with DependencyNotSatisfied = Degraded... Just a thought. having available true, make it less likely that a problem is correctly identified.


- **Required dependencies (default, type=Required)**: The addon cannot function at all without the dependency. When a required dependency is not satisfied, the addon-manager will set `Degraded=True` with reason `RequiredDependencyNotSatisfied`, and the klusterlet-agent will detect this specific reason and set `Available=False`.

- **Optional dependencies (type=Optional)**: The addon can still function with reduced functionality when the dependency is missing. When an optional dependency is not satisfied, the addon-manager will set `Degraded=True` with reason `DependencyNotSatisfied`, but the klusterlet-agent will not modify the `Available` condition, allowing the addon to remain available if its health checks pass.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

If something is truly optional, then the addon my NOT be degraded, it might just have been a nice to have.


2. **Check each dependency**: For each dependency in the list:
- Check if a `ManagedClusterAddOn` with the same name exists in the same namespace (managed cluster namespace)
- Check if the dependent addon's `Available` condition is `True`

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Does this imply that I can have a dependent addon (child) and it has some optional dependents that are missing and so the Dependent is Available=True, but it's actually degraded?


3. **Set Degraded condition based on dependency type**:
- **If all dependencies are satisfied**:
- Ensure the `Degraded` condition is not set with reason `DependencyNotSatisfied` or `RequiredDependencyNotSatisfied`

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I see here is the Dependency Degraded check... So the Available check above is technically separate.

- **If any optional dependency is not satisfied** (type=Optional):
- Set the `Degraded` condition to `True` with:
- Reason: `DependencyNotSatisfied`
- Message: Clear description of which dependencies are missing, including the custom message if provided (e.g., "Optional addon 'managed-serviceaccount' is not installed or not available. Token-based access to managed clusters is unavailable.")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Not just missing but degraded as well.

- Test complete workflow:
1. Install addon A with dependency on addon B (B not installed) - verify Degraded condition
2. Install addon B - verify addon A becomes Available
3. Delete addon B - verify addon A becomes Degraded

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Degraded works for Option, I'm not sure it makes sense for Required. At this point it is failed.

@jnpacker jnpacker left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looking to discuss or maybe a table with degrade, failed and Availability matrixed out based on the types of dependencies, and then I'm good.

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.

5 participants