kgctl connect (#269)
* kgctl connect Use kgctl connect to connect your laptop to a cluster. Signed-off-by: leonnicolas <leonloechner@gmx.de> * cmd/kgctl: finish connect command This commit fixes some bugs and finishes the implementation of the `kgctl connect` command. Signed-off-by: Lucas Servén Marín <lserven@gmail.com> * e2e: add tests for kgctl connect Signed-off-by: Lucas Servén Marín <lserven@gmail.com> * docs: add documentation for `kgctl connect` Signed-off-by: Lucas Servén Marín <lserven@gmail.com> * pkg/mesh: move peer route generation to mesh Signed-off-by: Lucas Servén Marín <lserven@gmail.com> Co-authored-by: Lucas Servén Marín <lserven@gmail.com>
This commit is contained in:
@@ -34,15 +34,15 @@ func graph() *cobra.Command {
|
||||
func runGraph(_ *cobra.Command, _ []string) error {
|
||||
ns, err := opts.backend.Nodes().List()
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to list nodes: %v", err)
|
||||
return fmt.Errorf("failed to list nodes: %w", err)
|
||||
}
|
||||
ps, err := opts.backend.Peers().List()
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to list peers: %v", err)
|
||||
return fmt.Errorf("failed to list peers: %w", err)
|
||||
}
|
||||
// Obtain the Granularity by looking at the annotation of the first node.
|
||||
if opts.granularity, err = optainGranularity(opts.granularity, ns); err != nil {
|
||||
return fmt.Errorf("failed to obtain granularity: %w", err)
|
||||
if opts.granularity, err = determineGranularity(opts.granularity, ns); err != nil {
|
||||
return fmt.Errorf("failed to determine granularity: %w", err)
|
||||
}
|
||||
|
||||
var hostname string
|
||||
@@ -69,11 +69,11 @@ func runGraph(_ *cobra.Command, _ []string) error {
|
||||
}
|
||||
t, err := mesh.NewTopology(nodes, peers, opts.granularity, hostname, 0, wgtypes.Key{}, subnet, nodes[hostname].PersistentKeepalive, nil)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to create topology: %v", err)
|
||||
return fmt.Errorf("failed to create topology: %w", err)
|
||||
}
|
||||
g, err := t.Dot()
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to generate graph: %v", err)
|
||||
return fmt.Errorf("failed to generate graph: %w", err)
|
||||
}
|
||||
fmt.Println(g)
|
||||
return nil
|
||||
|
Reference in New Issue
Block a user