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

Refactor daemonset controller and fetch upstream codebase #883

Merged
merged 1 commit into from
Feb 12, 2022

Conversation

FillZpp
Copy link
Member

@FillZpp FillZpp commented Jan 7, 2022

Signed-off-by: FillZpp FillZpp.pub@gmail.com

Ⅰ. Describe what this PR does

Refactor daemonset controller and fetch upstream release-1.22 codebase.

Ⅱ. Does this pull request fix one issue?

fixes #873

Ⅲ. Special notes for reviews

Main changes:

  1. Surging type is deprecated, just use the Standard instead. Now you can choose maxUnavailable or maxSurge in Standard type, but only the former one can be used with InPlaceIfPossible type.
  2. The update code logic has rebased to be consistent with upstream, we only have to call inPlaceUpdatePods before delete the pods to update.
  3. There is no ignore-not-ready or ignore-unscheduable any more. I don't think they are necessary. But if you need them, just leave your comments below.

@FillZpp
Copy link
Member Author

FillZpp commented Jan 7, 2022

/cc @jetmuffin @evertrain

@kruise-bot
Copy link

@FillZpp: GitHub didn't allow me to request PR reviews from the following users: jetmuffin, evertrain.

Note that only openkruise members and repo collaborators can review this PR, and authors cannot review their own PRs.

In response to this:

/cc @jetmuffin @evertrain

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@codecov-commenter
Copy link

Codecov Report

Merging #883 (a5e1137) into master (586e2dc) will increase coverage by 1.28%.
The diff coverage is 50.81%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #883      +/-   ##
==========================================
+ Coverage   47.89%   49.17%   +1.28%     
==========================================
  Files         119      119              
  Lines       11235    11078     -157     
==========================================
+ Hits         5381     5448      +67     
+ Misses       5037     4790     -247     
- Partials      817      840      +23     
Flag Coverage Δ
unittests 49.17% <50.81%> (+1.28%) ⬆️

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

Impacted Files Coverage Δ
...emonset/validating/daemonset_validating_handler.go 43.61% <35.41%> (ø)
pkg/controller/daemonset/daemonset_history.go 35.71% <35.71%> (ø)
pkg/controller/daemonset/daemonset_util.go 57.01% <53.84%> (-6.75%) ⬇️
pkg/controller/daemonset/daemonset_update.go 54.09% <54.09%> (ø)
pkg/controller/daemonset/daemonset_controller.go 44.94% <55.62%> (+7.68%) ⬆️
...kg/controller/daemonset/daemonset_event_handler.go 76.10% <74.00%> (-0.59%) ⬇️
pkg/controller/cloneset/cloneset_controller.go 50.59% <0.00%> (-2.38%) ⬇️
pkg/controller/statefulset/stateful_set_control.go 62.50% <0.00%> (-0.28%) ⬇️
... and 1 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 586e2dc...a5e1137. Read the comment docs.

@FillZpp FillZpp force-pushed the optimize-daemonset-controller branch from a5e1137 to bb16e7f Compare January 7, 2022 07:01
@FillZpp FillZpp force-pushed the optimize-daemonset-controller branch 2 times, most recently from effbe38 to 9de17f0 Compare January 13, 2022 06:33
pkg/controller/daemonset/daemonset_event_handler.go Outdated Show resolved Hide resolved
pkg/controller/daemonset/daemonset_util.go Outdated Show resolved Hide resolved
case "", appsv1alpha1.StandardRollingUpdateType:
case appsv1alpha1.InplaceRollingUpdateType:
if hasSurge || !hasUnavailable {
allErrs = append(allErrs, field.Required(fldPath.Child("maxUnavailable"), "cannot be 0 for InPlaceIfPossible"))
Copy link
Member

Choose a reason for hiding this comment

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

no need to check hasSurge since the switch clause above had already made the check.

allErrs = append(allErrs, field.Required(fldPath.Child("maxUnavailable"), "cannot be 0 for InPlaceIfPossible"))
}
case appsv1alpha1.DeprecatedSurgingRollingUpdateType:
if !hasSurge || hasUnavailable {
Copy link
Member

Choose a reason for hiding this comment

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

no need to check hasUnavailable since the switch clause above had already made the check.

pkg/controller/daemonset/daemonset_controller.go Outdated Show resolved Hide resolved
pkg/controller/daemonset/daemonset_controller.go Outdated Show resolved Hide resolved
}
}
}

return requeueDuration.Get(), nil
updateSatisfied, unsatisfiedDuration, updateDirtyPods := dsc.updateExpectations.SatisfiedExpectations(dsKey, hash)
Copy link
Member

Choose a reason for hiding this comment

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

is it possible to move the following code block out of this function to make this function serve only a single purpose

Copy link
Member Author

Choose a reason for hiding this comment

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

If so, the two place may all have to getNodesToDaemonPods(ds), which means the pod list will be called twice.

@FillZpp FillZpp force-pushed the optimize-daemonset-controller branch from 9de17f0 to a250128 Compare February 10, 2022 04:04
Signed-off-by: FillZpp <FillZpp.pub@gmail.com>
@FillZpp FillZpp force-pushed the optimize-daemonset-controller branch from a250128 to 80d2f86 Compare February 11, 2022 08:31
@kruise-robot
Copy link

kruise-robot bot commented Feb 11, 2022

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: FillZpp

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

@furykerry
Copy link
Member

/lgtm

@FillZpp
Copy link
Member Author

FillZpp commented Feb 12, 2022

/remove-approve

@kruise-bot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: furykerry

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

@FillZpp FillZpp merged commit bc51fa4 into openkruise:master Feb 12, 2022
ppbits pushed a commit to ppbits/kruise that referenced this pull request Apr 4, 2024
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.

Make Advanced DaemonSet default behavior compatible with upstream
4 participants