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

🌱 addon consume rollout helpers #225

Conversation

haoqing0110
Copy link
Member

@haoqing0110 haoqing0110 commented Jul 20, 2023

Summary

Addon consuming rollout helper functions of open-cluster-management-io/api#254. This PR includes the rollout type All, Progressive and PreogresivePerGroup, timeout is not included.

Related issue(s)

#114

@haoqing0110
Copy link
Member Author

cc @qiujian16

@codecov
Copy link

codecov bot commented Jul 28, 2023

Codecov Report

Patch coverage: 79.50% and project coverage change: +0.05% 🎉

Comparison is base (bd4982f) 61.03% compared to head (2463035) 61.09%.
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #225      +/-   ##
==========================================
+ Coverage   61.03%   61.09%   +0.05%     
==========================================
  Files         128      129       +1     
  Lines       13719    13752      +33     
==========================================
+ Hits         8374     8402      +28     
  Misses       4579     4579              
- Partials      766      771       +5     
Flag Coverage Δ
unit 61.09% <79.50%> (+0.05%) ⬆️

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

Files Changed Coverage Δ
pkg/work/helper/helpers.go 68.98% <ø> (+1.64%) ⬆️
...addon/controllers/addonconfiguration/controller.go 16.12% <9.09%> (-16.63%) ⬇️
pkg/addon/controllers/addonconfiguration/graph.go 85.55% <82.70%> (-1.95%) ⬇️
...donconfiguration/addon_configuration_reconciler.go 87.17% <100.00%> (ø)
...configuration/mgmt_addon_progressing_reconciler.go 90.90% <100.00%> (+0.13%) ⬆️
pkg/common/helpers/clusters.go 100.00% <100.00%> (ø)
...troller/manifestworkreplicaset_deploy_reconcile.go 68.93% <100.00%> (ø)

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

@haoqing0110 haoqing0110 force-pushed the addon-rollout branch 2 times, most recently from 36e2ffa to 6dc54ef Compare August 9, 2023 09:16
@haoqing0110 haoqing0110 changed the title [wip] addon consume rollout helpers 🌱 addon consume rollout helpers Aug 16, 2023
@haoqing0110
Copy link
Member Author

/hold

@@ -121,6 +122,13 @@ func (c *addonConfigurationController) sync(ctx context.Context, syncCtx factory
return err
}

// snapshot the rollout result before calling reconcile()
// so that all the reconcilers are using the same rollout result
err = graph.getRolloutResult()
Copy link
Member

Choose a reason for hiding this comment

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

it this is snapshot, just call it snapshot.

Copy link
Member Author

Choose a reason for hiding this comment

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

rename to generateRolloutResult()


// get placement
placement, err := c.getPlacement(installProgression.PlacementRef.Name, installProgression.PlacementRef.Namespace)
Copy link
Member

Choose a reason for hiding this comment

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

It seems to me this part should be done within adding placementNode

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

@@ -341,3 +383,11 @@ func desiredConfigsEqual(a, b addonConfigMap) bool {

return true
}

func initClusters(pdTracker *clusterv1beta1.PlacementDecisionClustersTracker) (sets.Set[string], error) {
Copy link
Member

Choose a reason for hiding this comment

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

I am not quite sure why we need this func

Copy link
Member Author

Choose a reason for hiding this comment

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

The input pdTracker does not include any clusters, so want to call Get() to fill in the existingScheduledClusterGroups and return the existing clusters. Might need to enhance the PlacementDecisionClustersTracker functions rather than add initClusters() here.

Copy link
Member Author

Choose a reason for hiding this comment

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

remove this func

placementRef := installProgression.PlacementRef
installConfigReference := installProgression.ConfigReferences

// init pdTracker clusters
Copy link
Member

Choose a reason for hiding this comment

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

enhance the comment here, it is not quite clear the intention

Copy link
Member Author

Choose a reason for hiding this comment

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

remove initClusters func and add comments // refresh and get existing decision clusters

for _, addon := range n.children {
if desiredConfigsEqual(addon.desiredConfigs, n.desiredConfigs) && addon.mcaUpgradeStatus == upgraded {
count += 1
func (n *installStrategyNode) getRolloutResult() error {
Copy link
Member

Choose a reason for hiding this comment

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

call it getXXX is confusing, since it does not return a result. Commonly such get func should return a result and not change the internal state. You might want to call if generateRolloutResult

Copy link
Member Author

Choose a reason for hiding this comment

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

rename to generateRolloutResult()

@qiujian16
Copy link
Member

/approve

would you also check the ut coverage?

@haoqing0110
Copy link
Member Author

@qiujian16 yes, will add more UT, and another 2 PRs need to merge before merging this one. open-cluster-management-io/api#260 open-cluster-management-io/addon-framework#208

@haoqing0110 haoqing0110 force-pushed the addon-rollout branch 3 times, most recently from f2027dc to d1803d5 Compare September 19, 2023 10:47
Signed-off-by: haoqing0110 <qhao@redhat.com>
@qiujian16
Copy link
Member

/approve
/lgtm

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Sep 20, 2023

[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

@haoqing0110
Copy link
Member Author

/unhold

@openshift-merge-robot openshift-merge-robot merged commit c8410bf into open-cluster-management-io:main Sep 20, 2023
13 checks passed
@haoqing0110 haoqing0110 deleted the addon-rollout branch September 20, 2023 02:28
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