create a proposal for addon dependency management - #157
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: elgnay The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
| // The default is false (soft dependency). | ||
| // +optional | ||
| // +kubebuilder:default=false | ||
| Required bool `json:"required,omitempty"` |
There was a problem hiding this comment.
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`. |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
I think the addon will not be deployed under this case
Should this work on a fresh install only, or rollout as well?
There was a problem hiding this comment.
If the addon is already installed and its dependent addon becomes unavailable, should the addon be uninstalled in that case?
There was a problem hiding this comment.
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.
03d652c to
8954e74
Compare
| // An empty list means the add-on has no dependencies. | ||
| // The default is an empty list. | ||
| // +optional | ||
| Dependencies []AddonDependency `json:"dependencies,omitempty"` |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
|
/assign @jnpacker |
|
|
||
| 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. |
There was a problem hiding this comment.
Do we have any examples of this?
Will you publish some type of warning message in this case?
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
I'm not sure I would have assumed it was optional by default.
Also do we need or want to consider any versioning semantics?
There was a problem hiding this comment.
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>
8954e74 to
4624636
Compare
| // 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. |
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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` |
There was a problem hiding this comment.
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` |
There was a problem hiding this comment.
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.") |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
Degraded works for Option, I'm not sure it makes sense for Required. At this point it is failed.
jnpacker
left a comment
There was a problem hiding this comment.
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.
Related issue: #156