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

Support undo function of the kruise rollout object #78

Merged
merged 1 commit into from
Dec 18, 2023

Conversation

myname4423
Copy link
Contributor

1.kubectl-kruise rollout undo命令现在可以支持kruise Rollout作为参数(args),Rollout对象可以作为rollout undo命令的入口,通过Rollout对象的WorkloadRef字段来获取其绑定的workload,然后对workload进行回滚。相比直接对工作负载进行回滚多了一次服务端访问

@kruise-bot
Copy link

Welcome @myname4423! It looks like this is your first PR to openkruise/kruise-tools 🎉

@hantmac
Copy link
Member

hantmac commented Dec 7, 2023

@myname4423 Thanks for your contribution! Please signed off according to this doc

Copy link
Member

@hantmac hantmac left a comment

Choose a reason for hiding this comment

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

Can we use to-revision flag in kruise rollout undo? Such as kruise rollout undo rollout/abc to-revision 1.

@myname4423
Copy link
Contributor Author

Can we use to-revision flag in kruise rollout undo? Such as kruise rollout undo rollout/abc to-revision 1.

yes, kruise rollout undo rollout/abc support options supported by other args ("deployment", "daemonset", "statefulset", "cloneset", "advanced statefulset"), like --to-revision --dry-run, because the UndoOptions except args keep unchanged before and after resolving rollout/abc. Here is an example:
image

@hantmac
Copy link
Member

hantmac commented Dec 10, 2023

Can we use to-revision flag in kruise rollout undo? Such as kruise rollout undo rollout/abc to-revision 1.

yes, kruise rollout undo rollout/abc support options supported by other args ("deployment", "daemonset", "statefulset", "cloneset", "advanced statefulset"), like --to-revision --dry-run, because the UndoOptions except args keep unchanged before and after resolving rollout/abc. Here is an example: image

Cool! Please fix the CI check.

updatedAnnotations map[string]string,
toRevision int64,
dryRunStrategy cmdutil.DryRunStrategy) (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.

can we move the checkrollout logic here, and construct and call the corresponding rollback for workload?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've updated the code this week with the following enhancements:

  1. Resources are now retrieved only once.
  2. Added deduplication logic.
  3. Enhanced error reporting for better clarity when undo operations fail.

pkg/cmd/rollout/rollout_undo.go Show resolved Hide resolved
Copy link
Member

@hantmac hantmac left a comment

Choose a reason for hiding this comment

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

Mostly LGTM!

pkg/cmd/rollout/rollout_undo.go Outdated Show resolved Hide resolved
Copy link
Member

@furykerry furykerry left a comment

Choose a reason for hiding this comment

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

plz rebase the master so as to squash the commits

README.md Outdated Show resolved Hide resolved
README.md Show resolved Hide resolved
Signed-off-by: yunbo <yunbo10124scut@gmail.com>

[temporary] temporary commit for sync

Signed-off-by: yunbo <yunbo10124scut@gmail.com>

[temporary] temporary commit for sync from local to work

Signed-off-by: yunbo <yunbo10124scut@gmail.com>

[temporary] temporary commit for sync from local to work

Signed-off-by: yunbo <yunbo10124scut@gmail.com>

rollout undo integration version2

Signed-off-by: yunbo <yunbo10124scut@gmail.com>

update README.md

Signed-off-by: yunbo <yunbo10124scut@gmail.com>

remove the comment code

Signed-off-by: yunbo <yunbo10124scut@gmail.com>

hide the same-workload-error

Signed-off-by: yunbo <yunbo10124scut@gmail.com>

update README
@furykerry
Copy link
Member

/lgtm

@furykerry
Copy link
Member

/approve

@kruise-bot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: furykerry, hantmac

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

@kruise-bot kruise-bot merged commit d4bbc24 into openkruise:master Dec 18, 2023
3 of 4 checks passed
@hantmac hantmac changed the title 集成kruise rollout对象的undo功能 Integrate the undo function of the kruise rollout object Dec 20, 2023
@hantmac hantmac changed the title Integrate the undo function of the kruise rollout object Support undo function of the kruise rollout object Dec 20, 2023
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.

4 participants