cmd/kgctl: allow specifying port

This commit is contained in:
Lucas Servén Marín 2019-09-24 01:00:16 +02:00
parent 676007938e
commit 3df87f0e71
No known key found for this signature in database
GPG Key ID: 586FEAF680DA74AD
2 changed files with 3 additions and 1 deletions

View File

@ -58,6 +58,7 @@ var (
opts struct {
backend mesh.Backend
granularity mesh.Granularity
port uint32
}
backend string
granularity string
@ -108,6 +109,7 @@ func main() {
cmd.PersistentFlags().StringVar(&backend, "backend", k8s.Backend, fmt.Sprintf("The backend for the mesh. Possible values: %s", availableBackends))
cmd.PersistentFlags().StringVar(&granularity, "mesh-granularity", string(mesh.LogicalGranularity), fmt.Sprintf("The granularity of the network mesh to create. Possible values: %s", availableGranularities))
cmd.PersistentFlags().StringVar(&kubeconfig, "kubeconfig", os.Getenv("KUBECONFIG"), "Path to kubeconfig.")
cmd.PersistentFlags().Uint32Var(&opts.port, "port", mesh.DefaultKiloPort, "The WireGuard port over which the nodes communicate.")
for _, subCmd := range []*cobra.Command{
graph(),

View File

@ -147,7 +147,7 @@ func runShowConfNode(_ *cobra.Command, args []string) error {
}
}
t, err := mesh.NewTopology(nodes, peers, opts.granularity, hostname, mesh.DefaultKiloPort, []byte{}, subnet)
t, err := mesh.NewTopology(nodes, peers, opts.granularity, hostname, opts.port, []byte{}, subnet)
if err != nil {
return fmt.Errorf("failed to create topology: %v", err)
}