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

feat: do not follower scheduling when dry run #296

Merged
merged 1 commit into from
Dec 13, 2023

Conversation

Poor12
Copy link
Collaborator

@Poor12 Poor12 commented Dec 8, 2023

No description provided.

Copy link

codecov bot commented Dec 8, 2023

Codecov Report

Attention: 8 lines in your changes are missing coverage. Please review.

Comparison is base (4200c1b) 31.42% compared to head (ec4b269) 31.44%.

Files Patch % Lines
pkg/controllers/sync/controller.go 0.00% 6 Missing ⚠️
pkg/controllers/follower/controller.go 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #296      +/-   ##
==========================================
+ Coverage   31.42%   31.44%   +0.02%     
==========================================
  Files         123      122       -1     
  Lines       14343    14346       +3     
==========================================
+ Hits         4507     4511       +4     
+ Misses       9423     9421       -2     
- Partials      413      414       +1     
Flag Coverage Δ
unittests 31.44% <46.66%> (+0.02%) ⬆️

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.

Comment on lines 357 to 358
if fedObj.GetAnnotations()[common.EnableFollowerSchedulingAnnotation] != common.AnnotationValueTrue ||
fedObj.GetAnnotations()[common.NoSchedulingAnnotation] == common.AnnotationValueTrue || util.SkipSync(fedObj) {
Copy link
Member

Choose a reason for hiding this comment

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

Is checking the DryRun annotation sufficient? Ideally follower controller shouldn't need to care about the federated object status.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think it needs. For example, assume the workload have been propagated to member clusters, users added the dry-run anno, at this time, dry run will not work, but because we cut off the relationship of leader and follower, follower will not propagate, this will cause the original workload to not work properly.

Copy link
Member

Choose a reason for hiding this comment

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

Makes sense. But if this is the case, we probably shouldn't have written the dry-run results into placements, as they can easily be misused by other controllers. An annotation would be better. What do you think?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I have tested several situations, and I think they are relatively stable. Placements now only have three controller: global-scheduler, follower-controller and ns-auto controller. 90% of all cases are global-scheduler. Another point is that we are not yet sure whether this restriction len(fo.status().clusters) == 0will be removed in the future. This is mainly because there is no such scenario yet. So, I think putting into placement is OK.

@Poor12 Poor12 force-pushed the no-follower-when-dryrun branch from 9c979e1 to 42e8371 Compare December 12, 2023 02:52
fedResource.RecordEvent("DryRunWorked", "Dry run worked for %s", fedResource.FederatedName())
return worker.StatusAllOK
}
fedResource.RecordEvent("DryRunSkipped", "Dry run skipped because resource has been propagated")
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Add an event to prompt the user that dryRun does not take effect.

@Poor12 Poor12 force-pushed the no-follower-when-dryrun branch from 42e8371 to ec4b269 Compare December 12, 2023 09:44
@mrlihanbo mrlihanbo merged commit 72fa461 into kubewharf:main Dec 13, 2023
6 of 7 checks passed
miraclejzd pushed a commit to miraclejzd/kubeadmiral that referenced this pull request Jan 3, 2024
feat: do not follower scheduling when dry run
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.

3 participants