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

Implement StatusCheck in Workflow #3067

Merged
merged 8 commits into from
Apr 14, 2022

Conversation

iguoyr
Copy link
Member

@iguoyr iguoyr commented Mar 28, 2022

Signed-off-by: SiyuChen ryougi201@gmail.com

What problem does this PR solve?

Close #3048

What's changed and how it works?

Related changes

  • Need to update chaos-mesh/website
  • Need to update Dashboard UI
  • Need to cheery-pick to release branches
    • release-2.1
    • release-2.0

Checklist

Tests

  • Unit test
  • E2E test
  • No code
  • Manual test (add steps below)

Side effects

  • Breaking backward compatibility

Release note

Please add a release note.

You can safely ignore this section if you don't think this PR needs a release note.

DCO

If you find the DCO check fails, please run commands like below (Depends on the actual situations. For example, if the failed commit isn't the most recent) to fix it:

git commit --amend --signoff
git push --force

Signed-off-by: SiyuChen <ryougi201@gmail.com>
@ti-chi-bot
Copy link
Member

ti-chi-bot commented Mar 28, 2022

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • STRRL
  • WangXiangUSTC

To complete the pull request process, please ask the reviewers in the list to review by filling /cc @reviewer in the comment.
After your PR has acquired the required number of LGTMs, you can assign this pull request to the committer in the list by filling /assign @committer in the comment to help you merge this pull request.

The full list of commands accepted by this bot can be found here.

Reviewer can indicate their review by submitting an approval review.
Reviewer can cancel approval by submitting a request changes review.

Signed-off-by: SiyuChen <ryougi201@gmail.com>
@iguoyr iguoyr marked this pull request as ready for review April 1, 2022 04:54
…rkflow

Signed-off-by: SiyuChen <ryougi201@gmail.com>
@codecov
Copy link

codecov bot commented Apr 1, 2022

Codecov Report

Merging #3067 (483f8a1) into master (4cfc1ea) will decrease coverage by 0.67%.
The diff coverage is 23.89%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3067      +/-   ##
==========================================
- Coverage   37.10%   36.42%   -0.68%     
==========================================
  Files         106      109       +3     
  Lines        9634    10044     +410     
==========================================
+ Hits         3575     3659      +84     
- Misses       5736     6052     +316     
- Partials      323      333      +10     
Impacted Files Coverage Δ
pkg/workflow/controllers/statuscheck_reconciler.go 7.57% <7.57%> (ø)
controllers/utils/recorder/workflow.go 15.38% <12.19%> (-1.14%) ⬇️
pkg/workflow/controllers/abort_node_reconciler.go 15.11% <15.11%> (ø)
.../workflow/controllers/abort_workflow_reconciler.go 48.97% <48.97%> (ø)
.../workflow/controllers/workflow_entry_reconciler.go 49.18% <66.66%> (-3.73%) ⬇️
pkg/workflow/controllers/bootstrap.go 76.19% <74.28%> (-0.74%) ⬇️
pkg/workflow/controllers/new_node.go 69.15% <100.00%> (+0.58%) ⬆️
pkg/workflow/controllers/utils.go 86.04% <100.00%> (+0.33%) ⬆️
pkg/selector/generic/mode.go 25.64% <0.00%> (-2.57%) ⬇️
... 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 4cfc1ea...483f8a1. Read the comment docs.

@iguoyr iguoyr requested review from a team April 2, 2022 03:14
api/v1alpha1/statuscheck_types.go Show resolved Hide resolved
api/v1alpha1/workflownode_types.go Outdated Show resolved Hide resolved
pkg/workflow/controllers/abort_node_reconciler.go Outdated Show resolved Hide resolved
// Reconcile watches `WorkflowNodes`, if:
// 1. the abort condition is `False`, just return.
// 2. the abort condition is `True`, the node is not `TypeStatusCheck`, it will propagate abort condition to children nodes.
// 3. the abort condition is `True`, the node is `TypeStatusCheck`, it will add abort annotation to the parent workflow.
Copy link
Contributor

Choose a reason for hiding this comment

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

Does the StatusCheck's parent continue to add abort annotation to its parent?

Copy link
Member Author

Choose a reason for hiding this comment

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

No, the abort 'flow' is top-down, only the parent node will abort the children nodes.

Copy link
Member Author

Choose a reason for hiding this comment

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

So I add another reconciler (AbortWorkflowReconciler), it will set the abort condition of the entry node to True.

pkg/workflow/controllers/abort_workflow_reconciler.go Outdated Show resolved Hide resolved
Signed-off-by: SiyuChen <ryougi201@gmail.com>
Signed-off-by: SiyuChen <ryougi201@gmail.com>
for _, item := range statusChecks[1:] {
statusCheckToRemove = append(statusCheckToRemove, item.GetName())
}
it.logger.Info("removing duplicated StatusCheck",
Copy link
Contributor

Choose a reason for hiding this comment

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

why exist some duplicate status checks?

Copy link
Member Author

Choose a reason for hiding this comment

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

It's the same reason with #3112 🤣.

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 update duplicated to redundant later

api/v1alpha1/workflownode_types.go Show resolved Hide resolved
Signed-off-by: SiyuChen <ryougi201@gmail.com>
@iguoyr iguoyr requested a review from a team April 13, 2022 07:23
Copy link
Member

@STRRL STRRL left a comment

Choose a reason for hiding this comment

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

IMO, the abort should recover all the injected chaos. How do you think about it ?

Comment on lines 127 to 129
// Abort describe whether to abort the workflow when the failure threshold of StatusCheck is exceeded. Only used when Type is TypeStatusCheck.
// +optional
Abort bool `json:"abort,omitempty"`
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
// Abort describe whether to abort the workflow when the failure threshold of StatusCheck is exceeded. Only used when Type is TypeStatusCheck.
// +optional
Abort bool `json:"abort,omitempty"`
// Abort describe whether to abort the workflow when the failure threshold of StatusCheck is exceeded. Only used when Type is TypeStatusCheck.
// +optional
AbortWithStatusCheck bool `json:"abortWithStatusCheck,omitempty"`

I suggest using more words as the name of this field. Only one word in a plain workflow.yaml without these comments might bring confusion.

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated! PTAL

api/v1alpha1/workflownode_types.go Outdated Show resolved Hide resolved
@STRRL
Copy link
Member

STRRL commented Apr 14, 2022

IMO, the abort should recover all the injected chaos. How do you think about it ?

Sorry, I missed changes on WorkflowNodeFinished in pkg/workflow/controllers/utils.go. This behavior has been built by it.

Signed-off-by: SiyuChen <ryougi201@gmail.com>
Copy link
Contributor

@WangXiangUSTC WangXiangUSTC left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@STRRL STRRL left a comment

Choose a reason for hiding this comment

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

LGTM!

@STRRL
Copy link
Member

STRRL commented Apr 14, 2022

/merge

@ti-chi-bot
Copy link
Member

This pull request has been accepted and is ready to merge.

Commit hash: c769b4b

@ti-chi-bot ti-chi-bot merged commit 92c0311 into chaos-mesh:master Apr 14, 2022
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.

Feature: Implement StatusCheck in Workflow
4 participants