-
Notifications
You must be signed in to change notification settings - Fork 49
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
Multi namespace #26
base: master
Are you sure you want to change the base?
Multi namespace #26
Conversation
Thank you for sending PR. I think that you are trying to add below three features in the one PR:
Could you separate this PR into 3 PRs? Quick feedback for each feature is as below:
|
Opened separated issues below. Let's discuss further there. I think that you can continue using this PR for #28 or create new PR.
|
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.
These are just my ideas. You can continue sending separate PRs without modifying them.
Let's discuss further once PR is separated.
@@ -1,4 +1,4 @@ | |||
IMAGE ?= mkimuram/k8sviz | |||
IMAGE ?= sguerard/k8sviz | |||
TAG ?= 0.3 |
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.
Actually, you don't need to modify Makefile. Instead, Just call below:
IMAGE=guerard/k8sviz make image-build
if outType == "dot" { | ||
if err := g.WriteDotFile(outFile); err != nil { | ||
fmt.Fprintf(os.Stderr, "Failed to output %q file with format %q for namespace %q: %v\n", outFile, outType, namespace, err) | ||
words := strings.Split(namespace, ",") |
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.
To parse comma separated strings to a slice of string, https://golang.org/src/flag/example_test.go might be a good reference.
fmt.Fprintf(os.Stderr, "Failed to output %q file with format %q for namespace %q: %v\n", outFile, outType, namespace, err) | ||
os.Exit(1) | ||
|
||
g := graph.NewGraph(res, dir) |
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.
Let's make NewGraph
take a slice of resources
and handle single name case and multiple namespaces case in the same way.
fmt.Fprintf(os.Stderr, "Failed to get namespace %q: %v\n", namespace, err) | ||
os.Exit(1) | ||
} | ||
//if !strings.Contains(namespace,",") { |
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.
If namespaces are parsed into the slice(see below), we will be able to check for all the namespaces here.
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.
By "below", I meant this comment. It appeared above this comment :)
@@ -125,15 +123,15 @@ func (g *Graph) generateCommon() { | |||
if err != nil { | |||
fmt.Fprintf(os.Stderr, "Failed to set to digraph: %v\n", err) | |||
} | |||
err = g.gviz.SetName("G") |
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.
Let's keep top level graph "G"
and add multiple subgraphs for each namespace inside it.
hey, any chance to get this into production? would love it! |
this modification allows digram generation for many namespace.