Skip to content

Commit ed7d590

Browse files
committed
add dir persistent flag
1 parent 9d12c3b commit ed7d590

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

cmd/node-joiner/main.go

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
package main
22

33
import (
4-
"os"
5-
64
"github.com/sirupsen/logrus"
75
"github.com/spf13/cobra"
86

@@ -11,11 +9,6 @@ import (
119

1210
func main() {
1311

14-
wd, err := os.Getwd()
15-
if err != nil {
16-
logrus.Fatal(err)
17-
}
18-
1912
nodesAddCmd := &cobra.Command{
2013
Use: "add-nodes",
2114
Short: "Generates an ISO that could be used to boot the configured nodes to let them join an existing cluster",
@@ -24,22 +17,27 @@ func main() {
2417
if err != nil {
2518
return err
2619
}
27-
return nodejoiner.NewAddNodesCommand(wd, kubeConfig)
20+
dir, err := cmd.Flags().GetString("dir")
21+
if err != nil {
22+
return err
23+
}
24+
return nodejoiner.NewAddNodesCommand(dir, kubeConfig)
2825
},
2926
}
3027

3128
nodesMonitorCmd := &cobra.Command{
3229
Use: "monitor-add-nodes",
3330
Short: "Monitors the configured nodes while they are joining an existing cluster",
3431
RunE: func(cmd *cobra.Command, args []string) error {
35-
return nodejoiner.NewMonitorAddNodesCommand(wd)
32+
return nodejoiner.NewMonitorAddNodesCommand("")
3633
},
3734
}
3835

3936
rootCmd := &cobra.Command{
4037
Use: "node-joiner",
4138
}
4239
rootCmd.PersistentFlags().String("kubeconfig", "", "Path to the kubeconfig file.")
40+
rootCmd.PersistentFlags().String("dir", ".", "assets directory")
4341

4442
rootCmd.AddCommand(nodesAddCmd)
4543
rootCmd.AddCommand(nodesMonitorCmd)

0 commit comments

Comments
 (0)