-
Notifications
You must be signed in to change notification settings - Fork 806
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
chaosctl add recover subcommand #3056
chaosctl add recover subcommand #3056
Conversation
Signed-off-by: xixi <i@hexilee.me>
Signed-off-by: xixi <i@hexilee.me>
Signed-off-by: xixi <i@hexilee.me>
Signed-off-by: xixi <i@hexilee.me>
Signed-off-by: xixi <i@hexilee.me>
Signed-off-by: xixi <i@hexilee.me>
Signed-off-by: xixi <i@hexilee.me>
Signed-off-by: xixi <i@hexilee.me>
Signed-off-by: xixi <i@hexilee.me>
Signed-off-by: xixi <i@hexilee.me>
Signed-off-by: xixi <i@hexilee.me>
Signed-off-by: xixi <i@hexilee.me>
Signed-off-by: xixi <i@hexilee.me>
Signed-off-by: xixi <i@hexilee.me>
Signed-off-by: xixi <i@hexilee.me>
Signed-off-by: xixi <i@hexilee.me>
Signed-off-by: xixi <i@hexilee.me>
Signed-off-by: xixi <i@hexilee.me>
Signed-off-by: xixi <i@hexilee.me>
Signed-off-by: xixi <i@hexilee.me>
[REVIEW NOTIFICATION] This pull request has been approved by:
To complete the pull request process, please ask the reviewers in the list to review by filling The full list of commands accepted by this bot can be found here. Reviewer can indicate their review by submitting an approval review. |
Signed-off-by: xixi <i@hexilee.me>
Codecov Report
@@ Coverage Diff @@
## master #3056 +/- ##
==========================================
+ Coverage 38.24% 38.41% +0.16%
==========================================
Files 105 105
Lines 9182 9181 -1
==========================================
+ Hits 3512 3527 +15
+ Misses 5361 5346 -15
+ Partials 309 308 -1
Continue to review full report at Codecov.
|
Signed-off-by: xixi <i@hexilee.me>
Signed-off-by: xixi <i@hexilee.me>
Signed-off-by: xixi <i@hexilee.me>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rest LGTM
Signed-off-by: xixi <i@hexilee.me>
Signed-off-by: xixi <i@hexilee.me>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Currently unimplemented. | ||
|
||
Examples: | ||
# Recover network chaos from pods in namespace default |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does the feature support recover chaos experiment by specific chaos experiment name and namepsace?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't support. It's designed to forcedly recover pods, we should not assume the Chaos Mesh still works as expected. Moreover, if multiple experiments affect the same pod, we cannot only recover one of them forcedly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why just default namespace here? Can we support recover on a specific namespace?
|
||
recoverCmd.PersistentFlags().StringVarP(&o.namespace, "namespace", "n", "default", "namespace to find pods") | ||
o.labels = recoverCmd.PersistentFlags().StringSliceP("label", "l", nil, "labels to select pods") | ||
err := recoverCmd.RegisterFlagCompletionFunc("namespace", func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When is the registered function will be called?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When you enter TAB (auto-completion).
pkg/chaosctl/cmd/recover.go
Outdated
selector.Pods = map[string][]string{o.namespace: names} | ||
} | ||
|
||
labelSelector := map[string]string{} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use pkg/label
pkg to parse label
directly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
@@ -54,8 +55,8 @@ func (d *networkDebugger) Collect(ctx context.Context, namespace, chaosName stri | |||
Name string | |||
Pod struct { | |||
Ipset string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NetworkChaos experiment may use multiple IPSets. Here may need to use []string
type.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IPSets are unnecessary in forced recovery, we don't need to parse it server-side in this PR. If it's necessary for other use-cases, we should parse it in another PR.
pkg/ctrl/client/ctrlclient.go
Outdated
) | ||
|
||
type CtrlClient struct { | ||
QueryClient *graphql.Client | ||
SubscriptionClient *graphql.SubscriptionClient | ||
} | ||
|
||
type PartialPod struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add some comments to descript what this struct is and when to use it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, now the PartialPod
is moved to pkg/chaosctl/recover
.
Signed-off-by: xixi <i@hexilee.me>
Signed-off-by: xixi <i@hexilee.me>
Signed-off-by: xixi <i@hexilee.me>
Signed-off-by: xixi <i@hexilee.me>
Signed-off-by: xixi <i@hexilee.me>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rest LGTM, I think some of this PR may be changed in the following PR of recover in chaosctl.
Signed-off-by: xixi <i@hexilee.me>
@Andrewmatilde PTAL again! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
/merge |
This pull request has been accepted and is ready to merge. Commit hash: 81c02b1
|
What problem does this PR solve?
Add recover subcommand for chaosctl. This is a part split from #2992.
What's changed and how it works?
Related changes
chaos-mesh/website
Dashboard UI
Checklist
Tests
Side effects
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: