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

✨ set configured condition in mca #635

Conversation

haoqing0110
Copy link
Member

Summary

Related issue(s)

Fixes #

@openshift-ci openshift-ci bot requested review from elgnay and zhujian7 September 30, 2024 03:02
Copy link

codecov bot commented Sep 30, 2024

Codecov Report

Attention: Patch coverage is 92.85714% with 4 lines in your changes missing coverage. Please review.

Project coverage is 64.08%. Comparing base (e683e8c) to head (bdd22c7).
Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
...donconfiguration/addon_configuration_reconciler.go 87.50% 2 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #635      +/-   ##
==========================================
+ Coverage   63.90%   64.08%   +0.17%     
==========================================
  Files         180      181       +1     
  Lines       14116    14166      +50     
==========================================
+ Hits         9021     9078      +57     
+ Misses       4192     4185       -7     
  Partials      903      903              
Flag Coverage Δ
unit 64.08% <92.85%> (+0.17%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@haoqing0110
Copy link
Member Author

/assign @qiujian16 @elgnay

if configured.Has(addon.mca.Namespace) {
continue
}
if !meta.IsStatusConditionFalse(addon.mca.Status.Conditions, addonv1alpha1.ManagedClusterAddOnConditionConfigured) {
Copy link
Member

Choose a reason for hiding this comment

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

this if is not necessary.

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed.

// should set condition to true.
// 2. Addons with configurations and already rollout successfully. In upgrade scenario, when the
// addon configurations do not change while addon components upgrade, should set condition to true.
for _, addon := range graph.getAddonsSucceeded() {
Copy link
Member

Choose a reason for hiding this comment

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

this is not clear to me, should toUpdate and toApply include all addons need to be set? ToSuccess always comes from toUpdate.

Copy link
Member Author

Choose a reason for hiding this comment

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

For addons that don't define any configs, the rollout status will be set to success insetRolloutStatus directly, and will never appear in the toUpdate or toApply.
Another case is for example, addon defines config A, and in next release, both addon-framework and addon-manager upgrades while it keeps using config A, since the desired config already matches the actual, will not have change to add configured condition in toUpdate or toApply.

@@ -96,6 +97,11 @@ func (a *CRDTemplateAgentAddon) Manifests(
cluster *clusterv1.ManagedCluster,
addon *addonapiv1alpha1.ManagedClusterAddOn) ([]runtime.Object, error) {

if !meta.IsStatusConditionTrue(addon.Status.Conditions, addonapiv1alpha1.ManagedClusterAddOnConditionConfigured) {
Copy link
Member

Choose a reason for hiding this comment

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

if we have addon-framework check the conds, do we still need this?

Copy link
Member Author

Choose a reason for hiding this comment

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

Currently, the code to "check the conds" is added at the beginning of each implementation of Manifests(), so both template and addon-framework have this piece of code.

Copy link
Member Author

Choose a reason for hiding this comment

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

will try to find a better place to add the check.

Status: metav1.ConditionTrue,
Reason: "ConfigurationsConfigured",
Message: "Configurations configured",
})
Copy link
Member

Choose a reason for hiding this comment

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

we need an integration test for the case that only when condition is set, the addon-template will start render.

Copy link
Member Author

Choose a reason for hiding this comment

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

will do.

@haoqing0110 haoqing0110 force-pushed the br_config-condition branch 2 times, most recently from 2ff21d5 to 27ae996 Compare October 8, 2024 04:15
Signed-off-by: haoqing0110 <qhao@redhat.com>
@haoqing0110 haoqing0110 force-pushed the br_config-condition branch 2 times, most recently from 2a2aca7 to bdd22c7 Compare October 8, 2024 09:23
@haoqing0110
Copy link
Member Author

Have updated the code based on comments and will create another PR to update the framework and add testing case for addon template.

Copy link
Member

@qiujian16 qiujian16 left a comment

Choose a reason for hiding this comment

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

/approve
/lgtm

@openshift-ci openshift-ci bot added the lgtm label Oct 8, 2024
Copy link
Contributor

openshift-ci bot commented Oct 8, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: haoqing0110, qiujian16

The full list of commands accepted by this bot can be found here.

The pull request process is described 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

@openshift-ci openshift-ci bot added the approved label Oct 8, 2024
@openshift-merge-bot openshift-merge-bot bot merged commit 851d015 into open-cluster-management-io:main Oct 8, 2024
15 checks passed
@haoqing0110 haoqing0110 deleted the br_config-condition branch December 6, 2024 07:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants