-
Notifications
You must be signed in to change notification settings - Fork 128
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
Dump metadata as a subcommand for virtletctl #587
Conversation
aaf6bcd
to
cfb2d72
Compare
Review status: 0 of 5 files reviewed at latest revision, 4 unresolved discussions. pkg/tools/common.go, line 67 at r1 (raw file):
ExecInContainer maybe? pkg/tools/dumpmetadata.go, line 63 at r1 (raw file):
"Virtlet pod name:" pkg/tools/dumpmetadata.go, line 82 at r1 (raw file):
maybe it would be better to dump it to stdout, like all kubectl commands behave for example? That would provide much more flexibility pkg/tools/subcommands.go, line 55 at r1 (raw file):
The default value must be blank and the description needs to be something like "master url (overrides the value from kubeconfig)". Otherwise the apiserver url from ~/.kube/config is never used Comments from Reviewable |
Review status: 0 of 5 files reviewed at latest revision, 4 unresolved discussions. pkg/tools/dumpmetadata.go, line 82 at r1 (raw file): Previously, ivan4th (Ivan Shvedunov) wrote…
Hmm oops it saves binary metadata. I thought there may be some kind of human-readable dump of it... Comments from Reviewable |
Review status: 0 of 5 files reviewed at latest revision, 4 unresolved discussions. pkg/tools/common.go, line 67 at r1 (raw file): Previously, ivan4th (Ivan Shvedunov) wrote…
Yep, better name. pkg/tools/dumpmetadata.go, line 63 at r1 (raw file): Previously, ivan4th (Ivan Shvedunov) wrote…
OK. pkg/tools/dumpmetadata.go, line 82 at r1 (raw file): Previously, ivan4th (Ivan Shvedunov) wrote…
Nope. it's WIP for this moment. Finally data will be read from these files and dumped in human readable form to stdout. pkg/tools/subcommands.go, line 55 at r1 (raw file): Previously, ivan4th (Ivan Shvedunov) wrote…
Will do that! Comments from Reviewable |
I'd suggest moving the dumper to pkg/metadata and adding a simple test for it (compare output for a prefilled db to some expected output), given that there are problems in the code. Review status: 0 of 5 files reviewed at latest revision, 6 unresolved discussions. pkg/tools/dumpmetadata.go, line 114 at r2 (raw file):
I'd make a Dumper struct that should contain the output stream and indent level. Dumper.indent(N) should return a new dumper with indent level increased. Make all print... funcs methods of the dumper pkg/tools/dumpmetadata.go, line 141 at r2 (raw file):
This is probably a bug? It'll just print numbers starting from 0. pkg/tools/dumpmetadata.go, line 149 at r2 (raw file):
This will probably look rather mangled. First of all, spew output should be split into separate lines via strings.Split and then these lines displayed with indent added. Second, spew sdump looks quite messy by default, I'd suggest cleaning it up a little bit, like this https://github.com/Mirantis/criproxy/blob/b6769d9d6fc4b2d3b9e191acce425e57c0a3d0e0/pkg/proxy/proxy.go#L519-L526 (although we probably need to have smth better than vanilla go-spew at some point) pkg/tools/dumpmetadata.go, line 174 at r2 (raw file):
maybe Comments from Reviewable |
34de466
to
5680d57
Compare
Review status: 0 of 5 files reviewed at latest revision, 6 unresolved discussions. pkg/tools/dumpmetadata.go, line 114 at r2 (raw file): Previously, ivan4th (Ivan Shvedunov) wrote…
Good idea but would like to do that as a followup. pkg/tools/dumpmetadata.go, line 141 at r2 (raw file): Previously, ivan4th (Ivan Shvedunov) wrote…
No, it's map so that iterates over the keys which are string. Give it a try ;) pkg/tools/dumpmetadata.go, line 149 at r2 (raw file): Previously, ivan4th (Ivan Shvedunov) wrote…
It was used to have a fast effect. Level 0 is used simply to not add any indentation for first line. pkg/tools/dumpmetadata.go, line 174 at r2 (raw file): Previously, ivan4th (Ivan Shvedunov) wrote…
Good idea. Done. Comments from Reviewable |
Review status: 0 of 5 files reviewed at latest revision, 6 unresolved discussions. pkg/tools/dumpmetadata.go, line 141 at r2 (raw file): Previously, jellonek (Piotr Skamruk) wrote…
Example output:
Comments from Reviewable |
Review status: 0 of 5 files reviewed at latest revision, 6 unresolved discussions. pkg/tools/subcommands.go, line 55 at r1 (raw file): Previously, jellonek (Piotr Skamruk) wrote…
Done. Comments from Reviewable |
Reviewed 2 of 5 files at r1, 1 of 2 files at r2. pkg/tools/dumpmetadata.go, line 114 at r2 (raw file): Previously, jellonek (Piotr Skamruk) wrote…
Ok. pkg/tools/dumpmetadata.go, line 141 at r2 (raw file): Previously, jellonek (Piotr Skamruk) wrote…
Sorry, dunno why I thought it was a slice. My bad. pkg/tools/dumpmetadata.go, line 149 at r2 (raw file): Previously, jellonek (Piotr Skamruk) wrote…
Ok let's keep it this way for now. Comments from Reviewable |
Review status: 3 of 5 files reviewed at latest revision, all discussions resolved. Comments from Reviewable |
Review status: 3 of 5 files reviewed at latest revision, 1 unresolved discussion. pkg/tools/common.go, line 59 at r3 (raw file):
ExecInContainer Comments from Reviewable |
This PR provides a base for multi command binary
virtletctl
with beginning of first command, dump of metadata store from all instances of virtlet containers on the cluster.This change is