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

Descriptions for dividing subscription should be generated after related localizations was synced. #772

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

cumirror
Copy link
Contributor

@cumirror cumirror commented Dec 7, 2023

What type of PR is this?

bugfix

What this PR does / why we need it:

Descriptions for dividing subscription should be generated after related localizations was synced.

Which issue(s) this PR fixes:

Fixes #688

Special notes for your reviewer:

@cumirror cumirror requested a review from a team as a code owner December 7, 2023 02:54
@cumirror cumirror requested a review from dixudx December 7, 2023 02:54
@codecov-commenter
Copy link

codecov-commenter commented Dec 7, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (e2ffa5f) 13.60% compared to head (6064757) 14.12%.
Report is 129 commits behind head on main.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #772      +/-   ##
==========================================
+ Coverage   13.60%   14.12%   +0.52%     
==========================================
  Files          66       79      +13     
  Lines        7492     9070    +1578     
==========================================
+ Hits         1019     1281     +262     
- Misses       6391     7692    +1301     
- Partials       82       97      +15     

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

// If the sub associated with base is a dividing strategy, check if there are derived loc resources, if not, do not create desc
if sub, _ := deployer.subsController.FindSubByUID(baseCopy.Labels[known.ConfigSubscriptionUIDLabel]); sub != nil {
if sub.Spec.SchedulingStrategy == appsapi.DividingSchedulingStrategyType {
if locs, _ := deployer.locLister.Localizations(baseCopy.Namespace).List(labels.SelectorFromSet(labels.Set{
Copy link
Member

Choose a reason for hiding this comment

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

We still need a way to ensure these localizations are up to date. cc @abstractmj for a look.

For sure, we can use the count len(locs) for new base objects.

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree with you. Further consideration needs to be given here to adjust the number of replicas and how to handle resource updates.

Copy link
Contributor

Choose a reason for hiding this comment

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

maybe we can associate the resourceversion of loc and sub

Copy link
Member

Choose a reason for hiding this comment

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

maybe we can associate the resourceversion of loc and sub

There are some cases that those updates are triggered by manifests/feeds.

I think we should add hash labels for these generated localizations (for replica diving case). These hash labels should indicate whether manifest/feed and finv are up to date.

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree with your idea, because the current logic is that manifests will be directly synchronized to description after updating the resource size, which is not reasonable.

By the way, in the case of dividing, can we just give up using localization for replicas settings? At the same time, you can consider putting the latest feedinventory version in the sub.

Copy link
Contributor

Choose a reason for hiding this comment

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

The essential reason is the logic of controller-manager is independent of the logic of scheduler

@dixudx dixudx added this to the v0.17.0 milestone Dec 11, 2023
@dixudx dixudx added the kind/bug Something isn't working label Dec 11, 2023
@dixudx
Copy link
Member

dixudx commented Dec 13, 2023

After offline discussions with @abstractmj, we've got some clues that may help us find a way out of this dilemma.

This dilemma only exists in dividing scheduling. This is the context for the below content.

The goal is to avoid updating twice, no matter it is due to the replicas or other fields changing. In Clusternet, Manifest, FeedInventory, Subscription, Localization are closely related.

  1. We need to ensure that clusternet-scheduler starts scheduling only if FeedInventory is up to date.
  2. We need to ensure Base objects are enqueued only if the status of Subscription get changed.
  3. We need to ensure Localization objects are up to date before updating Description.
  4. Clusternet generated Localizations DO NOT trigger the updates of Descriptions. The updates of Descriptions could only be triggered by
    • user-defined Localizations
    • updates of base objects (including base.spec.feeds, base.spec.finvHash)

Below fields could be added.

finv.spec.feeds[i].feedHash (manifest hash)

sub.status.finvHash
sub.status.feedHashes

base.spec.finvHash

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Descriptions for dividing subscription should be generated after related localizations was synced
4 participants