Skip to content

Conversation

@elgnay
Copy link
Contributor

@elgnay elgnay commented Oct 22, 2025

Related issue: #156

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

openshift-ci bot commented Oct 22, 2025

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

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
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
Contributor 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
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
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
Contributor 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?

Copy link
Member

@qiujian16 qiujian16 Oct 29, 2025

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
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
Contributor 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
Member

/assign @jnpacker

### Non-Goals

- Automatic installation of dependencies (users still need to explicitly install required addons)
- Dependency resolution and ordering during installation
Copy link
Member

Choose a reason for hiding this comment

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

I assume this means if you have two dependencies set there is not ordering of the two dependencies. If you want ordering then you create a chain of dependent addons?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, that’s right. There’s no implicit ordering between multiple dependencies — creating a dependency chain is the way to enforce sequence.


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
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?

Copy link
Contributor Author

@elgnay elgnay Nov 6, 2025

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
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
Contributor 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
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?

Copy link
Contributor Author

@elgnay elgnay Nov 6, 2025

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.

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